chore(vscode-ide-companion, webui): update plan md

This commit is contained in:
yiliang114 2026-01-18 23:23:16 +08:00
parent 3f42639d49
commit 73b4a9b560
6 changed files with 203 additions and 201 deletions

View file

@ -1,6 +1,3 @@
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
import storybook from "eslint-plugin-storybook";
/** /**
* @license * @license
* Copyright 2025 Google LLC * Copyright 2025 Google LLC
@ -15,22 +12,26 @@ import prettierConfig from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import'; import importPlugin from 'eslint-plugin-import';
import vitest from '@vitest/eslint-plugin'; import vitest from '@vitest/eslint-plugin';
import globals from 'globals'; import globals from 'globals';
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
import storybook from "eslint-plugin-storybook";
export default tseslint.config({ export default tseslint.config(
// Global ignores {
ignores: [ // Global ignores
'node_modules/*', ignores: [
'packages/**/dist/**', 'node_modules/*',
'bundle/**', 'packages/**/dist/**',
'package/bundle/**', 'bundle/**',
'.integration-tests/**', 'package/bundle/**',
'packages/**/.integration-test/**', '.integration-tests/**',
'dist/**', 'packages/**/.integration-test/**',
'docs-site/.next/**', 'dist/**',
'docs-site/out/**', 'docs-site/.next/**',
], 'docs-site/out/**',
}, eslint.configs.recommended, ...tseslint.configs.recommended, reactHooks.configs['recommended-latest'], reactPlugin.configs.flat.recommended, // Add this if you are using React 17+ ],
reactPlugin.configs.flat['jsx-runtime'], { },
eslint.configs.recommended, ...tseslint.configs.recommended, reactHooks.configs['recommended-latest'], reactPlugin.configs.flat.recommended, // Add this if you are using React 17+
reactPlugin.configs.flat['jsx-runtime'], {
// Settings for eslint-plugin-react // Settings for eslint-plugin-react
settings: { settings: {
react: { react: {
@ -54,105 +55,106 @@ reactPlugin.configs.flat['jsx-runtime'], {
'import/no-default-export': 'warn', 'import/no-default-export': 'warn',
'import/no-unresolved': 'off', // Disable for now, can be noisy with monorepos/paths 'import/no-unresolved': 'off', // Disable for now, can be noisy with monorepos/paths
}, },
}, { },
// General overrides and rules for the project (TS/TSX files) {
files: ['packages/*/src/**/*.{ts,tsx}'], // Target only TS/TSX in the cli package // General overrides and rules for the project (TS/TSX files)
plugins: { files: ['packages/*/src/**/*.{ts,tsx}'], // Target only TS/TSX in the cli package
import: importPlugin, plugins: {
}, import: importPlugin,
settings: {
'import/resolver': {
node: true,
}, },
}, settings: {
languageOptions: { 'import/resolver': {
globals: { node: true,
...globals.node, },
...globals.es2021,
}, },
}, languageOptions: {
rules: { globals: {
// We use TypeScript for React components; prop-types are unnecessary ...globals.node,
'react/prop-types': 'off', ...globals.es2021,
// General Best Practice Rules (subset adapted for flat config)
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'arrow-body-style': ['error', 'as-needed'],
curly: ['error', 'multi-line'],
eqeqeq: ['error', 'always', { null: 'ignore' }],
'@typescript-eslint/consistent-type-assertions': [
'error',
{ assertionStyle: 'as' },
],
'@typescript-eslint/explicit-member-accessibility': [
'error',
{ accessibility: 'no-public' },
],
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-inferrable-types': [
'error',
{ ignoreParameters: true, ignoreProperties: true },
],
'@typescript-eslint/consistent-type-imports': [
'error',
{ disallowTypeAnnotations: false },
],
'@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }],
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
}, },
], },
'import/no-internal-modules': [ rules: {
'error', // We use TypeScript for React components; prop-types are unnecessary
{ 'react/prop-types': 'off',
allow: [ // General Best Practice Rules (subset adapted for flat config)
'react-dom/test-utils', '@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'react-dom/client', 'arrow-body-style': ['error', 'as-needed'],
'memfs/lib/volume.js', curly: ['error', 'multi-line'],
'yargs/**', eqeqeq: ['error', 'always', { null: 'ignore' }],
'msw/node', '@typescript-eslint/consistent-type-assertions': [
'**/generated/**', 'error',
'./styles/tailwind.css', { assertionStyle: 'as' },
'./styles/App.css', ],
'./styles/style.css' '@typescript-eslint/explicit-member-accessibility': [
], 'error',
}, { accessibility: 'no-public' },
], ],
'import/no-relative-packages': 'error', '@typescript-eslint/no-explicit-any': 'error',
'no-cond-assign': 'error', '@typescript-eslint/no-inferrable-types': [
'no-debugger': 'error', 'error',
'no-duplicate-case': 'error', { ignoreParameters: true, ignoreProperties: true },
'no-restricted-syntax': [ ],
'error', '@typescript-eslint/consistent-type-imports': [
{ 'error',
selector: 'CallExpression[callee.name="require"]', { disallowTypeAnnotations: false },
message: 'Avoid using require(). Use ES6 imports instead.', ],
}, '@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }],
{ '@typescript-eslint/no-unused-vars': [
selector: 'ThrowStatement > Literal:not([value=/^\\w+Error:/])', 'error',
message: {
'Do not throw string literals or non-Error objects. Throw new Error("...") instead.', argsIgnorePattern: '^_',
}, varsIgnorePattern: '^_',
], caughtErrorsIgnorePattern: '^_',
'no-unsafe-finally': 'error', },
'no-unused-expressions': 'off', // Disable base rule ],
'@typescript-eslint/no-unused-expressions': [ 'import/no-internal-modules': [
// Enable TS version 'error',
'error', {
{ allowShortCircuit: true, allowTernary: true }, allow: [
], 'react-dom/test-utils',
'no-var': 'error', 'react-dom/client',
'object-shorthand': 'error', 'memfs/lib/volume.js',
'one-var': ['error', 'never'], 'yargs/**',
'prefer-arrow-callback': 'error', 'msw/node',
'prefer-const': ['error', { destructuring: 'all' }], '**/generated/**',
radix: 'error', './styles/tailwind.css',
'default-case': 'error', './styles/App.css',
}, './styles/style.css'
}, { ],
},
],
'import/no-relative-packages': 'error',
'no-cond-assign': 'error',
'no-debugger': 'error',
'no-duplicate-case': 'error',
'no-restricted-syntax': [
'error',
{
selector: 'CallExpression[callee.name="require"]',
message: 'Avoid using require(). Use ES6 imports instead.',
},
{
selector: 'ThrowStatement > Literal:not([value=/^\\w+Error:/])',
message:
'Do not throw string literals or non-Error objects. Throw new Error("...") instead.',
},
],
'no-unsafe-finally': 'error',
'no-unused-expressions': 'off', // Disable base rule
'@typescript-eslint/no-unused-expressions': [
// Enable TS version
'error',
{ allowShortCircuit: true, allowTernary: true },
],
'no-var': 'error',
'object-shorthand': 'error',
'one-var': ['error', 'never'],
'prefer-arrow-callback': 'error',
'prefer-const': ['error', { destructuring: 'all' }],
radix: 'error',
'default-case': 'error',
},
}, {
files: ['packages/*/src/**/*.test.{ts,tsx}', 'packages/**/test/**/*.test.{ts,tsx}'], files: ['packages/*/src/**/*.test.{ts,tsx}', 'packages/**/test/**/*.test.{ts,tsx}'],
plugins: { plugins: {
vitest, vitest,
@ -171,26 +173,26 @@ reactPlugin.configs.flat['jsx-runtime'], {
], ],
}, },
}, // extra settings for scripts that we run directly with node }, // extra settings for scripts that we run directly with node
{ {
files: ['./scripts/**/*.js', 'esbuild.config.js', 'packages/*/scripts/**/*.js'], files: ['./scripts/**/*.js', 'esbuild.config.js', 'packages/*/scripts/**/*.js'],
languageOptions: { languageOptions: {
globals: { globals: {
...globals.node, ...globals.node,
process: 'readonly', process: 'readonly',
console: 'readonly', console: 'readonly',
},
},
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
}, },
], },
}, rules: {
}, { '@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
},
}, {
files: ['packages/vscode-ide-companion/esbuild.js'], files: ['packages/vscode-ide-companion/esbuild.js'],
languageOptions: { languageOptions: {
globals: { globals: {
@ -204,72 +206,74 @@ reactPlugin.configs.flat['jsx-runtime'], {
'@typescript-eslint/no-require-imports': 'off', '@typescript-eslint/no-require-imports': 'off',
}, },
}, // extra settings for scripts that we run directly with node }, // extra settings for scripts that we run directly with node
{ {
files: ['packages/vscode-ide-companion/scripts/**/*.js'], files: ['packages/vscode-ide-companion/scripts/**/*.js'],
languageOptions: { languageOptions: {
globals: { globals: {
...globals.node, ...globals.node,
process: 'readonly', process: 'readonly',
console: 'readonly', console: 'readonly',
},
},
rules: {
'no-restricted-syntax': 'off',
'@typescript-eslint/no-require-imports': 'off',
},
}, // extra settings for core package scripts
{
files: ['packages/core/scripts/**/*.js'],
languageOptions: {
globals: {
...globals.node,
process: 'readonly',
console: 'readonly',
},
},
rules: {
'no-restricted-syntax': 'off',
'@typescript-eslint/no-require-imports': 'off',
},
}, // Prettier config must be last
prettierConfig, // extra settings for scripts that we run directly with node
{
files: ['./integration-tests/**/*.{js,ts,tsx}'],
languageOptions: {
globals: {
...globals.node,
process: 'readonly',
console: 'readonly',
},
},
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
},
}, // Settings for docs-site directory
{
files: ['docs-site/**/*.{js,jsx}'],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
}, },
}, },
rules: {
'no-restricted-syntax': 'off',
'@typescript-eslint/no-require-imports': 'off',
},
}, // extra settings for core package scripts
{
files: ['packages/core/scripts/**/*.js'],
languageOptions: {
globals: {
...globals.node,
process: 'readonly',
console: 'readonly',
},
},
rules: {
'no-restricted-syntax': 'off',
'@typescript-eslint/no-require-imports': 'off',
},
}, // Prettier config must be last
prettierConfig, // extra settings for scripts that we run directly with node
{
files: ['./integration-tests/**/*.{js,ts,tsx}'],
languageOptions: {
globals: {
...globals.node,
process: 'readonly',
console: 'readonly',
},
},
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
},
}, // Settings for docs-site directory
{
files: ['docs-site/**/*.{js,jsx}'],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
// Allow relaxed rules for documentation site
'@typescript-eslint/no-unused-vars': 'off',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
},
}, },
rules: { storybook.configs["flat/recommended"]
// Allow relaxed rules for documentation site );
'@typescript-eslint/no-unused-vars': 'off',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
},
}, storybook.configs["flat/recommended"]);

View file

@ -2,8 +2,6 @@
* @license * @license
* Copyright 2025 Qwen Team * Copyright 2025 Qwen Team
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*
* Re-export completion item types from webui for backward compatibility
*/ */
export type { CompletionItem, CompletionItemType } from '@qwen-code/webui'; export type { CompletionItem, CompletionItemType } from '@qwen-code/webui';