|
| 1 | +import jest from 'eslint-plugin-jest' |
| 2 | +import typescriptEslint from '@typescript-eslint/eslint-plugin' |
| 3 | +import globals from 'globals' |
| 4 | +import tsParser from '@typescript-eslint/parser' |
| 5 | +import path from 'node:path' |
| 6 | +import { fileURLToPath } from 'node:url' |
| 7 | +import js from '@eslint/js' |
| 8 | +import { FlatCompat } from '@eslint/eslintrc' |
| 9 | + |
| 10 | +const __filename = fileURLToPath(import.meta.url) |
| 11 | +const __dirname = path.dirname(__filename) |
| 12 | +const compat = new FlatCompat({ |
| 13 | + baseDirectory: __dirname, |
| 14 | + recommendedConfig: js.configs.recommended, |
| 15 | + allConfig: js.configs.all |
| 16 | +}) |
| 17 | + |
| 18 | +export default [ |
| 19 | + { |
| 20 | + ignores: [ |
| 21 | + '!**/.*', |
| 22 | + '**/node_modules/.*', |
| 23 | + '**/dist/.*', |
| 24 | + '**/coverage/.*', |
| 25 | + '**/*.json', |
| 26 | + 'lib/**', |
| 27 | + 'dist/**', |
| 28 | + 'coverage/**', |
| 29 | + 'test/**', |
| 30 | + '**/.github/linters/**' |
| 31 | + ] |
| 32 | + }, |
| 33 | + ...compat.extends( |
| 34 | + 'eslint:recommended', |
| 35 | + 'plugin:@typescript-eslint/recommended-type-checked', |
| 36 | + 'plugin:jest/recommended' |
| 37 | + ), |
| 38 | + { |
| 39 | + plugins: { |
| 40 | + jest, |
| 41 | + '@typescript-eslint': typescriptEslint |
| 42 | + }, |
| 43 | + |
| 44 | + languageOptions: { |
| 45 | + globals: { |
| 46 | + ...globals.node, |
| 47 | + ...globals.jest, |
| 48 | + Atomics: 'readonly', |
| 49 | + SharedArrayBuffer: 'readonly' |
| 50 | + }, |
| 51 | + |
| 52 | + parser: tsParser, |
| 53 | + ecmaVersion: 2023, |
| 54 | + sourceType: 'module', |
| 55 | + |
| 56 | + parserOptions: { |
| 57 | + project: ['./.github/linters/tsconfig.json', './tsconfig.json'] |
| 58 | + } |
| 59 | + }, |
| 60 | + |
| 61 | + rules: { |
| 62 | + camelcase: 'off', |
| 63 | + 'eslint-comments/no-use': 'off', |
| 64 | + 'eslint-comments/no-unused-disable': 'off', |
| 65 | + 'i18n-text/no-en': 'off', |
| 66 | + 'import/no-namespace': 'off', |
| 67 | + 'no-console': 'off', |
| 68 | + semi: 'off', |
| 69 | + '@typescript-eslint/array-type': 'error', |
| 70 | + '@typescript-eslint/consistent-type-assertions': 'error', |
| 71 | + |
| 72 | + '@typescript-eslint/explicit-member-accessibility': [ |
| 73 | + 'error', |
| 74 | + { |
| 75 | + accessibility: 'no-public' |
| 76 | + } |
| 77 | + ], |
| 78 | + |
| 79 | + '@typescript-eslint/explicit-function-return-type': [ |
| 80 | + 'error', |
| 81 | + { |
| 82 | + allowExpressions: true |
| 83 | + } |
| 84 | + ], |
| 85 | + |
| 86 | + '@typescript-eslint/no-empty-interface': 'error', |
| 87 | + '@typescript-eslint/no-extraneous-class': 'error', |
| 88 | + '@typescript-eslint/no-inferrable-types': 'error', |
| 89 | + '@typescript-eslint/no-non-null-assertion': 'warn', |
| 90 | + '@typescript-eslint/no-unnecessary-qualifier': 'error', |
| 91 | + '@typescript-eslint/no-useless-constructor': 'error', |
| 92 | + '@typescript-eslint/no-var-requires': 'error', |
| 93 | + '@typescript-eslint/prefer-for-of': 'warn', |
| 94 | + '@typescript-eslint/prefer-function-type': 'warn', |
| 95 | + '@typescript-eslint/prefer-includes': 'error', |
| 96 | + '@typescript-eslint/prefer-string-starts-ends-with': 'error', |
| 97 | + '@typescript-eslint/promise-function-async': 'error', |
| 98 | + '@typescript-eslint/require-array-sort-compare': 'error', |
| 99 | + '@typescript-eslint/space-before-function-paren': 'off' |
| 100 | + } |
| 101 | + } |
| 102 | +] |
0 commit comments