|
| 1 | +import eslint from '@eslint/js'; |
| 2 | +import prettier from 'eslint-config-prettier'; |
| 3 | +import importPlugin from 'eslint-plugin-import'; |
| 4 | +import lit from 'eslint-plugin-lit'; |
| 5 | +import wc from 'eslint-plugin-wc'; |
| 6 | +import ymlPlugin from 'eslint-plugin-yml'; |
| 7 | +import globals from 'globals'; |
| 8 | +import ts from 'typescript-eslint'; |
| 9 | + |
| 10 | +export default ts.config( |
| 11 | + { |
| 12 | + ignores: ['coverage/', 'docs/', 'demo/dist/', 'lib/', 'lit-redux-router.*'], |
| 13 | + }, |
| 14 | + eslint.configs.all, |
| 15 | + importPlugin.flatConfigs.recommended, |
| 16 | + importPlugin.configs.typescript, |
| 17 | + lit.configs['flat/recommended'], |
| 18 | + wc.configs['flat/recommended'], |
| 19 | + ...ymlPlugin.configs['flat/recommended'], |
| 20 | + ...ymlPlugin.configs['flat/prettier'], |
| 21 | + { |
| 22 | + files: ['**/*.js', '**/*.ts'], |
| 23 | + languageOptions: { |
| 24 | + ecmaVersion: 'latest', |
| 25 | + globals: { ...globals.node }, |
| 26 | + parserOptions: { project: 'tsconfig.json' }, |
| 27 | + sourceType: 'module', |
| 28 | + }, |
| 29 | + rules: { |
| 30 | + 'import/no-unresolved': 'off', |
| 31 | + 'max-lines': ['error', { max: 133, skipBlankLines: true, skipComments: true }], |
| 32 | + 'max-lines-per-function': ['error', { max: 30, skipBlankLines: true, skipComments: true }], |
| 33 | + 'max-statements': ['error', { max: 35 }], |
| 34 | + 'no-ternary': 'off', |
| 35 | + 'one-var': 'off', |
| 36 | + 'sort-imports': 'off', |
| 37 | + }, |
| 38 | + settings: { 'import/resolver': { typescript: {} } }, |
| 39 | + }, |
| 40 | + { |
| 41 | + // eslint-disable-next-line import/no-named-as-default-member |
| 42 | + extends: [...ts.configs.all], |
| 43 | + files: ['**/*.ts'], |
| 44 | + rules: { |
| 45 | + '@typescript-eslint/class-methods-use-this': 'off', |
| 46 | + // eslint-disable-next-line no-magic-numbers |
| 47 | + '@typescript-eslint/no-magic-numbers': ['error', { ignore: [0, 1, 2] }], |
| 48 | + '@typescript-eslint/prefer-readonly-parameter-types': 'off', |
| 49 | + }, |
| 50 | + }, |
| 51 | + { |
| 52 | + files: ['**/*.test.*'], |
| 53 | + rules: { |
| 54 | + '@typescript-eslint/no-floating-promises': 'off', |
| 55 | + '@typescript-eslint/no-magic-numbers': 'off', |
| 56 | + 'max-lines': 'off', |
| 57 | + 'max-lines-per-function': 'off', |
| 58 | + }, |
| 59 | + }, |
| 60 | + prettier, |
| 61 | +); |
0 commit comments