|
1 | | -const {FlatCompat} = require('@eslint/eslintrc') |
| 1 | +const eslint = require('@eslint/js') |
| 2 | +const tseslint = require('typescript-eslint') |
| 3 | +const escompatPlugin = require('eslint-plugin-escompat') |
| 4 | +const github = require('../../plugin') |
2 | 5 |
|
3 | | -const compat = new FlatCompat({resolvePluginsRelativeTo: __dirname}) |
4 | | - |
5 | | -const typescriptModule = { |
6 | | - ...compat.config({ |
7 | | - extends: ['plugin:@typescript-eslint/recommended', 'prettier', 'plugin:escompat/typescript-2020'], |
8 | | - plugins: ['@typescript-eslint', 'escompat'], |
9 | | - parser: '@typescript-eslint/parser', |
10 | | - rules: { |
11 | | - camelcase: 'off', |
12 | | - 'no-unused-vars': 'off', |
13 | | - 'no-shadow': 'off', |
14 | | - 'no-invalid-this': 'off', |
15 | | - '@typescript-eslint/no-invalid-this': ['error'], |
16 | | - '@typescript-eslint/no-shadow': ['error'], |
17 | | - '@typescript-eslint/interface-name-prefix': 'off', |
18 | | - '@typescript-eslint/array-type': ['error', {default: 'array-simple'}], |
19 | | - '@typescript-eslint/no-use-before-define': 'off', |
20 | | - '@typescript-eslint/explicit-member-accessibility': 'off', |
21 | | - '@typescript-eslint/explicit-function-return-type': 'off', |
22 | | - '@typescript-eslint/no-non-null-assertion': 'off', |
23 | | - '@typescript-eslint/no-unused-vars': 'error', |
24 | | - '@typescript-eslint/explicit-module-boundary-types': 'off', |
25 | | - }, |
26 | | - }), |
27 | | -} |
28 | | -// Need to merge to get the appropriate structure for the config |
29 | | -const mergedConfig = {} |
30 | | - |
31 | | -for (const obj of Object.values(typescriptModule)) { |
32 | | - Object.assign(mergedConfig, { |
33 | | - languageOptions: {...mergedConfig.languageOptions, ...obj.languageOptions}, |
34 | | - plugins: {...mergedConfig.plugins, ...obj.plugins}, |
35 | | - rules: {...mergedConfig.rules, ...obj.rules}, |
36 | | - files: [...(mergedConfig.files || []), ...(obj.files || [])], |
37 | | - }) |
38 | | -} |
39 | | - |
40 | | -module.exports = mergedConfig |
| 6 | +module.exports = tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended, { |
| 7 | + languageOptions: { |
| 8 | + parser: tseslint.parser, |
| 9 | + }, |
| 10 | + plugins: {'@typescript-eslint': tseslint.plugin, escompatPlugin, github}, |
| 11 | + rules: { |
| 12 | + camelcase: 'off', |
| 13 | + 'no-unused-vars': 'off', |
| 14 | + 'no-shadow': 'off', |
| 15 | + 'no-invalid-this': 'off', |
| 16 | + '@typescript-eslint/no-invalid-this': ['error'], |
| 17 | + '@typescript-eslint/no-shadow': ['error'], |
| 18 | + '@typescript-eslint/interface-name-prefix': 'off', |
| 19 | + '@typescript-eslint/array-type': ['error', {default: 'array-simple'}], |
| 20 | + '@typescript-eslint/no-use-before-define': 'off', |
| 21 | + '@typescript-eslint/explicit-member-accessibility': 'off', |
| 22 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 23 | + '@typescript-eslint/no-non-null-assertion': 'off', |
| 24 | + '@typescript-eslint/no-unused-vars': 'error', |
| 25 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 26 | + }, |
| 27 | +}) |
0 commit comments