|
| 1 | +// @ts-check |
| 2 | +import eslint from '@eslint/js'; |
| 3 | +import { defineConfig } from 'eslint/config'; |
| 4 | +import tseslint from 'typescript-eslint'; |
| 5 | +import globals from 'globals'; |
| 6 | +// @ts-expect-error missing declarations |
| 7 | +import pluginChaiFriendly from 'eslint-plugin-chai-friendly'; |
| 8 | +import pluginImport from 'eslint-plugin-import'; |
| 9 | +import pluginStylistic from '@stylistic/eslint-plugin'; |
| 10 | + |
| 11 | +export default defineConfig( |
| 12 | + eslint.configs.recommended, |
| 13 | + tseslint.configs.recommended, |
| 14 | + { |
| 15 | + languageOptions: { |
| 16 | + ecmaVersion: 2022, |
| 17 | + sourceType: 'module', |
| 18 | + parserOptions: { |
| 19 | + projectService: true, |
| 20 | + tsconfigRootDir: import.meta.dirname |
| 21 | + }, |
| 22 | + globals: { |
| 23 | + ...globals.browser, |
| 24 | + ...globals.mocha |
| 25 | + } |
| 26 | + }, |
| 27 | + settings: { |
| 28 | + 'import/resolver': { |
| 29 | + typescript: { alwaysTryTypes: true } |
| 30 | + } |
| 31 | + }, |
| 32 | + plugins: { |
| 33 | + 'chai-friendly': pluginChaiFriendly, |
| 34 | + 'import': pluginImport, |
| 35 | + '@stylistic': pluginStylistic |
| 36 | + }, |
| 37 | + rules: { |
| 38 | + 'no-unused-vars': 'off', |
| 39 | + '@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_', 'varsIgnorePattern': '^_' }], |
| 40 | + 'no-redeclare': 'off', |
| 41 | + '@typescript-eslint/no-redeclare': 'error', |
| 42 | + 'prefer-spread': 'off', |
| 43 | + 'no-restricted-syntax': 'off', |
| 44 | + 'consistent-return': 'off', |
| 45 | + 'object-curly-newline': 'off', |
| 46 | + 'prefer-template': 'off', |
| 47 | + 'no-plusplus': 'off', |
| 48 | + 'no-continue': 'off', |
| 49 | + 'no-bitwise': 'off', |
| 50 | + 'no-await-in-loop': 'off', |
| 51 | + 'no-sequences': 'warn', |
| 52 | + 'no-param-reassign': 'warn', |
| 53 | + 'no-return-assign': 'warn', |
| 54 | + 'no-else-return': ['error', { 'allowElseIf': true }], |
| 55 | + 'no-shadow': 'off', |
| 56 | + 'no-undef': 'error', |
| 57 | + 'no-constant-condition': ['error', { 'checkLoops': 'all' }], |
| 58 | + 'no-unused-expressions': 'off', |
| 59 | + '@typescript-eslint/no-unused-expressions': 'off', |
| 60 | + 'chai-friendly/no-unused-expressions': [ 'error', { allowShortCircuit: true } ], |
| 61 | + 'arrow-body-style': 'off', |
| 62 | + 'space-before-function-paren': 'off', |
| 63 | + 'operator-linebreak': 'off', |
| 64 | + 'implicit-arrow-linebreak': 'off', |
| 65 | + 'no-underscore-dangle': 'off', |
| 66 | + 'import/prefer-default-export': 'off', |
| 67 | + 'import/no-extraneous-dependencies': 'off', |
| 68 | + 'import/no-unassigned-import': 'error', |
| 69 | + 'import/named': 'error', |
| 70 | + 'max-len': ['error', { |
| 71 | + 'ignoreComments': true, |
| 72 | + 'code': 130, |
| 73 | + 'ignoreStrings': true, |
| 74 | + 'ignoreTemplateLiterals': true, |
| 75 | + 'ignoreRegExpLiterals': true |
| 76 | + }], |
| 77 | + 'no-multiple-empty-lines': ['error'], |
| 78 | + 'no-trailing-spaces': ['error'], |
| 79 | + 'eol-last': ['error'], |
| 80 | + 'padded-blocks': 'off', |
| 81 | + 'max-classes-per-file': 'off', |
| 82 | + 'no-empty': 'off', |
| 83 | + '@stylistic/semi': 'error', |
| 84 | + '@stylistic/indent': ['error', 2], |
| 85 | + '@stylistic/quotes': ['error', 'single', { 'avoidEscape': true }], |
| 86 | + '@typescript-eslint/no-explicit-any': 'off' |
| 87 | + } |
| 88 | + } |
| 89 | +); |
0 commit comments