-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy patheslint.config.mjs
More file actions
59 lines (58 loc) · 2.12 KB
/
Copy patheslint.config.mjs
File metadata and controls
59 lines (58 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import tseslint from 'typescript-eslint';
import eslintConfigPrettier from 'eslint-config-prettier';
import globals from 'globals';
// Flat config (eslint 10), replacing the former .eslintrc.js files. Mirrors the
// previous setup: typescript-eslint recommended + type-checked, prettier last,
// and the same project rules. (`@typescript-eslint/semi` is gone — removed in
// typescript-eslint v8; prettier enforces semicolons.)
export default tseslint.config(
{
ignores: [
'**/dist/**',
'**/.wireit/**',
'**/node_modules/**',
'**/*.test.ts',
'**/*.generated.ts',
],
},
// Match eslint 8's default: don't flag pre-existing eslint-disable comments as
// unused. eslint 9+ defaults this to "warn"; leaving the repo's existing
// directives in place keeps the diff minimal and avoids churning lines that
// other tools (DeepSource) attribute as newly-introduced issues.
{
linterOptions: { reportUnusedDisableDirectives: 'off' },
},
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
files: ['**/*.ts'],
languageOptions: {
globals: { ...globals.browser },
parserOptions: {
// Use the same tsconfig the build/old config used (tsconfig.eslint.json,
// module: commonjs). projectService picks tsconfig.json (node16
// resolution), which resolves different tfjs .d.ts overloads and produces
// spurious no-unnecessary-type-assertion errors that disagree with tsc.
project: [
'./tsconfig.eslint.json',
'./packages/*/tsconfig.eslint.json',
'./models/tsconfig.eslint.json',
'./internals/tsconfig.eslint.json',
'./internals/*/tsconfig.eslint.json',
],
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'comma-dangle': ['error', 'always'],
'curly': ['error', 'all'],
'no-empty': ['error', { allowEmptyCatch: true }],
},
},
// JS files aren't part of a TS project; type-checked rules can't run on them.
{
files: ['**/*.{js,cjs,mjs}'],
...tseslint.configs.disableTypeChecked,
},
eslintConfigPrettier,
);