|
| 1 | +import eslint from '@eslint/js'; |
| 2 | +import tseslint from 'typescript-eslint'; |
| 3 | +import stylistic from '@stylistic/eslint-plugin'; |
| 4 | +import globals from 'globals'; |
| 5 | + |
| 6 | +export default tseslint.config( |
| 7 | + { |
| 8 | + ignores: ['out/', 'dist/'], |
| 9 | + }, |
| 10 | + eslint.configs.recommended, |
| 11 | + tseslint.configs.recommendedTypeChecked, |
| 12 | + stylistic.configs.customize({ |
| 13 | + arrowParens: 'always', |
| 14 | + braceStyle: '1tbs', |
| 15 | + commaDangle: 'only-multiline', |
| 16 | + indent: 4, |
| 17 | + quotes: 'single', |
| 18 | + semi: 'always', |
| 19 | + }), |
| 20 | + { |
| 21 | + files: ['resources/*.js'], |
| 22 | + languageOptions: { |
| 23 | + globals: { |
| 24 | + acquireVsCodeApi: true, // available for VSCode WebViews |
| 25 | + }, |
| 26 | + }, |
| 27 | + }, |
| 28 | + { |
| 29 | + languageOptions: { |
| 30 | + globals: { |
| 31 | + ...globals.node, |
| 32 | + ...globals.browser, |
| 33 | + }, |
| 34 | + parserOptions: { |
| 35 | + project: true, |
| 36 | + tsconfigRootDir: import.meta.dirname, |
| 37 | + }, |
| 38 | + }, |
| 39 | + |
| 40 | + rules: { |
| 41 | + '@typescript-eslint/no-base-to-string': 'off', // 1 instance |
| 42 | + |
| 43 | + '@stylistic/indent-binary-ops': 'off', // this is a weird rule |
| 44 | + '@stylistic/max-len': ['error', { |
| 45 | + code: 160, |
| 46 | + ignoreTrailingComments: true, |
| 47 | + }], |
| 48 | + '@stylistic/max-statements-per-line': ['error', { |
| 49 | + ignoredNodes: ['IfStatement'], |
| 50 | + }], |
| 51 | + '@stylistic/member-delimiter-style': ['error', { |
| 52 | + multiline: { delimiter: 'semi' }, |
| 53 | + singleline: { delimiter: 'semi' }, |
| 54 | + }], |
| 55 | + '@stylistic/no-multi-spaces': ['error', { |
| 56 | + ignoreEOLComments: true, |
| 57 | + }], |
| 58 | + '@stylistic/quote-props': ['error', 'as-needed', { |
| 59 | + unnecessary: false, |
| 60 | + }], |
| 61 | + } |
| 62 | + }, |
| 63 | + { |
| 64 | + // the following rules are being heavily violated in the current codebase, |
| 65 | + // we should work on being able to enable them... |
| 66 | + rules: { |
| 67 | + '@typescript-eslint/no-unsafe-member-access': 'off', // 742 instances |
| 68 | + '@typescript-eslint/no-unsafe-call': 'off', // 432 instances |
| 69 | + '@typescript-eslint/no-unsafe-assignment': 'off', // 429 instances |
| 70 | + '@typescript-eslint/no-unsafe-argument': 'off', // 401 instances |
| 71 | + '@typescript-eslint/no-explicit-any': 'off', // 226 instances |
| 72 | + '@typescript-eslint/no-unused-vars': 'off', // 204 instances |
| 73 | + '@typescript-eslint/no-unsafe-return': 'off', // 83 instances |
| 74 | + '@typescript-eslint/no-misused-promises': 'off', // 57 instances |
| 75 | + '@typescript-eslint/no-floating-promises': 'off', // 55 instances |
| 76 | + 'no-useless-escape': 'off', // 38 instances |
| 77 | + '@typescript-eslint/prefer-promise-reject-errors': 'off', // 36 instances |
| 78 | + 'no-async-promise-executor': 'off', // 29 instances |
| 79 | + '@typescript-eslint/no-require-imports': 'off', // 24 instances |
| 80 | + 'no-cond-assign': 'off', // 21 instances |
| 81 | + '@typescript-eslint/require-await': 'off', // 11 instances |
| 82 | + } |
| 83 | + }, |
| 84 | + { |
| 85 | + files: ['**/*.{js,mjs}'], |
| 86 | + extends: [tseslint.configs.disableTypeChecked], |
| 87 | + }, |
| 88 | +); |
0 commit comments