forked from remix-run/remix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
86 lines (82 loc) · 2.49 KB
/
eslint.config.js
File metadata and controls
86 lines (82 loc) · 2.49 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import tseslint from 'typescript-eslint'
import preferLet from 'eslint-plugin-prefer-let'
/** @type {import('eslint').Linter.Config[]} */
export default [
{
ignores: [
'**/*.d.ts',
'**/dist/**',
'**/coverage/**',
'**/bench/**',
'**/examples/**',
'**/*.min.js',
'node_modules/**',
],
},
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
// Enable typed linting across the monorepo without listing every tsconfig
projectService: true,
},
},
plugins: {
'@typescript-eslint': tseslint.plugin,
},
rules: {
// Always use `import type { X }` and keep type imports separate from value imports
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
fixStyle: 'separate-type-imports',
},
],
// Always use `export type { X }`; avoid mixing type and value exports
'@typescript-eslint/consistent-type-exports': [
'error',
{
// false => prefer splitting into separate `export type {}` and `export {}`
fixMixedExportsWithInlineTypeSpecifier: false,
},
],
// Prefer native public and #private over TS accessibility modifiers
// Disallow `public`/`private`/`protected` on class fields, methods, and parameter properties
'no-restricted-syntax': [
'error',
{
selector: 'PropertyDefinition[accessibility]',
message: "Use native class fields: omit 'public' and use '#private' for private state.",
},
{
selector: 'MethodDefinition[accessibility]',
message:
"Use native methods: omit 'public'; for private behavior use '#private' fields/methods.",
},
{
selector: 'TSParameterProperty[accessibility]',
message:
"Avoid TS parameter properties; declare fields explicitly and use '#private' when needed.",
},
],
// Ensure no rule asks for explicit member accessibility
'@typescript-eslint/explicit-member-accessibility': 'off',
},
},
{
files: ['**/*.{ts,tsx,js,jsx}'],
plugins: {
'prefer-let': preferLet,
},
rules: {
// Prefer `let` for locals; allow `const` only at module scope
'prefer-let/prefer-let': 'error',
// Disallow `var` entirely
'no-var': 'error',
},
},
]