|
1 | | -module.exports = { |
2 | | - parser: '@typescript-eslint/parser', |
3 | | - parserOptions: { |
4 | | - project: 'tsconfig.json', |
5 | | - tsconfigRootDir: __dirname, |
6 | | - sourceType: 'module', |
| 1 | +import { dirname } from 'path'; |
| 2 | +import { fileURLToPath } from 'url'; |
| 3 | +import tsPlugin from '@typescript-eslint/eslint-plugin'; |
| 4 | +import tsParser from '@typescript-eslint/parser'; |
| 5 | +import prettierConfig from 'eslint-config-prettier'; |
| 6 | +import prettierPlugin from 'eslint-plugin-prettier'; |
| 7 | + |
| 8 | +const __filename = fileURLToPath(import.meta.url); |
| 9 | +const __dirname = dirname(__filename); |
| 10 | + |
| 11 | +export default [ |
| 12 | + { |
| 13 | + ignores: [ |
| 14 | + '**/node_modules/**', |
| 15 | + '**/dist/**', |
| 16 | + '**/.eslintrc.js', |
| 17 | + '**/coverage/**', |
| 18 | + ], |
7 | 19 | }, |
8 | | - plugins: ['@typescript-eslint/eslint-plugin'], |
9 | | - extends: [ |
10 | | - 'plugin:@typescript-eslint/recommended', |
11 | | - 'plugin:prettier/recommended', |
12 | | - ], |
13 | | - root: true, |
14 | | - env: { |
15 | | - node: true, |
16 | | - jest: true, |
| 20 | + { |
| 21 | + files: ['**/*.ts'], |
| 22 | + languageOptions: { |
| 23 | + parser: tsParser, |
| 24 | + parserOptions: { |
| 25 | + project: './tsconfig.json', |
| 26 | + tsconfigRootDir: __dirname, |
| 27 | + sourceType: 'module', |
| 28 | + }, |
| 29 | + globals: { |
| 30 | + node: true, |
| 31 | + jest: true, |
| 32 | + }, |
| 33 | + }, |
| 34 | + plugins: { |
| 35 | + '@typescript-eslint': tsPlugin, |
| 36 | + prettier: prettierPlugin, |
| 37 | + }, |
| 38 | + rules: { |
| 39 | + ...tsPlugin.configs.recommended.rules, |
| 40 | + ...prettierConfig.rules, |
| 41 | + '@typescript-eslint/interface-name-prefix': 'off', |
| 42 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 43 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 44 | + '@typescript-eslint/no-explicit-any': 'off', |
| 45 | + '@typescript-eslint/no-unused-vars': 'warn', |
| 46 | + '@typescript-eslint/ban-ts-comment': 'warn', |
| 47 | + 'prettier/prettier': [ |
| 48 | + 'error', |
| 49 | + { |
| 50 | + endOfLine: 'auto', |
| 51 | + }, |
| 52 | + ], |
| 53 | + }, |
17 | 54 | }, |
18 | | - ignorePatterns: ['.eslintrc.js'], |
19 | | - rules: { |
20 | | - '@typescript-eslint/interface-name-prefix': 'off', |
21 | | - '@typescript-eslint/explicit-function-return-type': 'off', |
22 | | - '@typescript-eslint/explicit-module-boundary-types': 'off', |
23 | | - '@typescript-eslint/no-explicit-any': 'off', |
24 | | - }, |
25 | | - "prettier/prettier": [ |
26 | | - "error", |
27 | | - { |
28 | | - "endOfLine": "auto" |
29 | | - } |
30 | | - ] |
31 | | -}; |
| 55 | +]; |
0 commit comments