2025-10-31 16:14:23 +08:00
|
|
|
import eslint from '@eslint/js';
|
|
|
|
|
import tseslint from 'typescript-eslint';
|
|
|
|
|
|
|
|
|
|
export default [
|
|
|
|
|
eslint.configs.recommended,
|
|
|
|
|
...tseslint.configs.recommended,
|
|
|
|
|
{
|
|
|
|
|
files: ['packages/**/src/**/*.{ts,tsx,js,jsx}'],
|
|
|
|
|
languageOptions: {
|
|
|
|
|
parser: tseslint.parser,
|
|
|
|
|
parserOptions: {
|
|
|
|
|
ecmaVersion: 2020,
|
2025-11-02 12:45:47 +08:00
|
|
|
sourceType: 'module',
|
|
|
|
|
project: true,
|
|
|
|
|
tsconfigRootDir: import.meta.dirname
|
2025-10-31 16:14:23 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
rules: {
|
2025-11-02 23:50:41 +08:00
|
|
|
'semi': ['warn', 'always'],
|
|
|
|
|
'quotes': ['warn', 'single', { avoidEscape: true }],
|
|
|
|
|
'indent': ['warn', 4, {
|
|
|
|
|
SwitchCase: 1,
|
|
|
|
|
ignoredNodes: [
|
|
|
|
|
'PropertyDefinition[decorators.length > 0]',
|
|
|
|
|
'TSTypeParameterInstantiation'
|
|
|
|
|
]
|
|
|
|
|
}],
|
|
|
|
|
'no-trailing-spaces': 'warn',
|
|
|
|
|
'eol-last': ['warn', 'always'],
|
|
|
|
|
'comma-dangle': ['warn', 'never'],
|
|
|
|
|
'object-curly-spacing': ['warn', 'always'],
|
|
|
|
|
'array-bracket-spacing': ['warn', 'never'],
|
|
|
|
|
'arrow-parens': ['warn', 'always'],
|
|
|
|
|
'no-multiple-empty-lines': ['warn', { max: 2, maxEOF: 1 }],
|
2025-10-31 16:14:23 +08:00
|
|
|
'no-console': 'off',
|
2025-11-02 23:50:41 +08:00
|
|
|
'no-empty': 'warn',
|
|
|
|
|
'no-case-declarations': 'warn',
|
|
|
|
|
'no-useless-catch': 'warn',
|
|
|
|
|
'no-prototype-builtins': 'warn',
|
|
|
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
2025-11-02 12:45:47 +08:00
|
|
|
'@typescript-eslint/no-unsafe-assignment': 'warn',
|
|
|
|
|
'@typescript-eslint/no-unsafe-member-access': 'warn',
|
|
|
|
|
'@typescript-eslint/no-unsafe-call': 'warn',
|
|
|
|
|
'@typescript-eslint/no-unsafe-return': 'warn',
|
|
|
|
|
'@typescript-eslint/no-unsafe-argument': 'warn',
|
2025-11-02 23:50:41 +08:00
|
|
|
'@typescript-eslint/no-unsafe-function-type': 'warn',
|
2025-10-31 16:14:23 +08:00
|
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
|
|
|
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
2025-11-02 12:45:47 +08:00
|
|
|
'@typescript-eslint/no-non-null-assertion': 'off'
|
2025-10-31 16:14:23 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
ignores: [
|
|
|
|
|
'node_modules/**',
|
|
|
|
|
'**/node_modules/**',
|
|
|
|
|
'dist/**',
|
|
|
|
|
'**/dist/**',
|
|
|
|
|
'bin/**',
|
|
|
|
|
'**/bin/**',
|
|
|
|
|
'build/**',
|
|
|
|
|
'**/build/**',
|
|
|
|
|
'coverage/**',
|
|
|
|
|
'**/coverage/**',
|
|
|
|
|
'thirdparty/**',
|
|
|
|
|
'examples/lawn-mower-demo/**',
|
|
|
|
|
'extensions/**',
|
|
|
|
|
'**/*.min.js',
|
2025-11-23 14:49:37 +08:00
|
|
|
'**/*.d.ts',
|
|
|
|
|
'**/wasm/**'
|
2025-10-31 16:14:23 +08:00
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
];
|