Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
57 lines (56 loc) · 1.85 KB
/
Copy patheslint.config.js
File metadata and controls
57 lines (56 loc) · 1.85 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
// Flat config (ESLint 9), shared by every package in the workspace.
//
// Formatting is Prettier's job, so eslint-config-prettier turns off the
// stylistic rules that would fight it.
import prettier from 'eslint-config-prettier'
import tseslint from 'typescript-eslint'
export default tseslint.config(
{
ignores: [
'**/dist/**',
'**/coverage/**',
'**/node_modules/**',
'**/*.tsbuildinfo',
// Config files are not source and are not in a TS project. A mistake in
// one fails at load time, which is a stronger check than linting it.
'**/eslint.config.js',
'**/*.config.mjs',
],
},
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
// A ceremony surface is fed arbitrary cross-origin data, so readers take
// `unknown` and narrow explicitly. `no-explicit-any` stays on to keep
// that honest.
'@typescript-eslint/no-explicit-any': 'error',
},
},
{
// Build scripts are plain ESM with no TS project behind them. Type-aware
// rules cannot run, but the rest can — these have real logic and are worth
// linting, unlike the config files above which are ignored outright.
files: ['**/scripts/*.mjs'],
extends: [tseslint.configs.disableTypeChecked],
languageOptions: {
globals: { console: 'readonly', process: 'readonly' },
},
},
{
files: ['**/*.test.ts'],
rules: {
// Test doubles legitimately hand in shapes the production types reject.
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
},
},
prettier,
)