Skip to content

Commit 2a058cc

Browse files
committed
refactor(eslint): Add type aware eslint config, disable rules that conflict for now
Signed-off-by: Drew Hoener <[email protected]>
1 parent 452dfbb commit 2a058cc

File tree

3 files changed

+595
-11
lines changed

3 files changed

+595
-11
lines changed

eslint.config.js

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
1+
// @ts-check
2+
3+
import eslint from '@eslint/js';
4+
import tseslint from 'typescript-eslint';
15
import globals from 'globals';
26

3-
export default [
7+
export default tseslint.config(
8+
eslint.configs.recommended,
9+
{
10+
// Linting rules for TS files, should be combined with the base config when migration is complete
11+
files: ['**/*.{ts,tsx}'],
12+
extends: [
13+
...tseslint.configs.strictTypeChecked,
14+
...tseslint.configs.stylisticTypeChecked,
15+
],
16+
languageOptions: {
17+
parser: tseslint.parser,
18+
parserOptions: {
19+
projectService: true,
20+
},
21+
}
22+
},
423
{
524
languageOptions: {
625
'globals': {
26+
...globals.es2020,
727
...globals.browser,
828
...globals.node,
929
'bson': true
@@ -18,6 +38,14 @@ export default [
1838
{
1939
ignores: ['dist']
2040
},
41+
{
42+
// FIXME: Recommended rules that have been turned off to maintain compatibility with the current codebase
43+
rules: {
44+
'no-useless-escape': 0,
45+
'no-unused-vars': 0,
46+
'no-prototype-builtins': 0,
47+
}
48+
},
2149
{
2250
rules: {
2351
curly: 2,
@@ -35,6 +63,6 @@ export default [
3563
'linebreak-style': 2,
3664
'key-spacing': [2, {afterColon: true}]
3765
},
38-
files: ['**/*.{js,jsx,cjs}']
66+
files: ['**/*.{js,jsx,ts,tsx,cjs}'],
3967
}
40-
];
68+
);

0 commit comments

Comments
 (0)