Skip to content

Commit a996782

Browse files
authored
Wrap all eslint configs in tseslint.config (#2182)
1 parent b9ca390 commit a996782

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

eslint.config.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@ const tseslint = require('typescript-eslint');
55
const prettier = require('eslint-config-prettier');
66
//const jsdoc = require('eslint-plugin-jsdoc');
77

8-
// Using tseslint config helper to customise its setup the tseslint way.
8+
// Only run tseslint on the files that we have included for TypeScript.
99
const tsconfigTsFiles = ['**/*.{ts,mts}']; // match "include" in tsconfig.ts.json;
1010
const tsconfigJsFiles = ['*.{js,mjs}', 'lib/**/*.{js,mjs}']; // match "include" in tsconfig.js.json
11-
const tseslintConfigs = tseslint.config(
11+
12+
// Using tseslint.config adds some type safety and `extends` to simplify customising config array.
13+
module.exports = tseslint.config(
14+
// Add recommended rules.
15+
esLintjs.configs.recommended,
16+
// jsdoc.configs['flat/recommended'],
17+
jest.configs['flat/recommended'],
18+
// tseslint with different setup for js/ts
1219
{
1320
files: tsconfigJsFiles,
21+
extends: [...tseslint.configs.recommended],
1422
languageOptions: {
1523
parserOptions: { project: './tsconfig.js.json' },
1624
},
17-
extends: [...tseslint.configs.recommended],
1825
rules: {
19-
'@typescript-eslint/no-var-requires': 'off', // (tseslint does not autodetect commonjs context )
26+
'@typescript-eslint/no-var-requires': 'off', // tseslint does not autodetect commonjs context
2027
},
2128
},
2229
{
2330
files: tsconfigTsFiles,
31+
extends: [...tseslint.configs.recommended],
2432
languageOptions: {
2533
parserOptions: { project: './tsconfig.ts.json' },
2634
},
27-
extends: [...tseslint.configs.recommended],
2835
},
29-
);
30-
31-
module.exports = [
32-
esLintjs.configs.recommended,
33-
// jsdoc.configs['flat/recommended'],
34-
jest.configs['flat/recommended'],
35-
...tseslintConfigs,
3636
prettier, // Do Prettier last so it can override previous configs.
3737

3838
// Customise rules.
@@ -72,4 +72,4 @@ module.exports = [
7272
],
7373
},
7474
},
75-
];
75+
);

0 commit comments

Comments
 (0)