-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mts
More file actions
143 lines (128 loc) · 4.06 KB
/
eslint.config.mts
File metadata and controls
143 lines (128 loc) · 4.06 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import eslint from '@eslint/js';
import globals from 'globals';
import reactPlugin from 'eslint-plugin-react';
import tseslint from 'typescript-eslint';
import importPlugin from 'eslint-plugin-import';
import nPlugin from 'eslint-plugin-n';
import promisePlugin from 'eslint-plugin-promise';
export default [
// Ignores
{
ignores: [
'node_modules/',
'coverage/',
'build/',
'dist/'
]
},
// Base language options and plugins
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
...globals.mocha
}
},
settings: {
react: { version: 'detect' }
},
plugins: {
react: reactPlugin,
import: importPlugin,
n: nPlugin,
promise: promisePlugin
}
},
// Recommended configs
eslint.configs.recommended,
...tseslint.configs.recommended,
// SemiStandard rules configuration
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '*.mts'],
rules: {
// Standard/SemiStandard base rules
'no-var': 'error',
'prefer-const': 'error',
// "no-console": "warn",
'no-debugger': 'error',
'no-unused-vars': 'off', // handled by TypeScript
'no-undef': 'off', // handled by TypeScript
// Semicolons (SemiStandard requires semicolons)
'semi': ['error', 'always'],
'semi-spacing': ['error', { 'before': false, 'after': true }],
'semi-style': ['error', 'last'],
// Quotes (single quotes)
'quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }],
// Trailing commas
'comma-dangle': ['error', {
'arrays': 'never',
'objects': 'never',
'imports': 'never',
'exports': 'never',
'functions': 'never'
}],
// Space before function parentheses
'space-before-function-paren': ['error', {
'anonymous': 'always',
'named': 'never',
'asyncArrow': 'always'
}],
// No trailing spaces
'no-trailing-spaces': 'error',
// Import plugin rules (disabled for TypeScript projects with path mapping)
'import/no-unresolved': 'off', // Disabled due to TypeScript path mapping
'import/named': 'off', // Disabled due to TypeScript path mapping
'import/default': 'off', // Disabled due to TypeScript path mapping
'import/namespace': 'off', // Disabled due to TypeScript path mapping
'import/export': 'error',
'import/no-named-as-default': 'error',
'import/no-named-as-default-member': 'off', // Disabled due to i18next compatibility issues
'import/no-duplicates': 'error',
'import/order': 'off', // Disabled due to TypeScript path mapping complexity
// Promise plugin rules
'promise/param-names': 'error',
'promise/always-return': 'error',
'promise/catch-or-return': 'error',
'promise/no-nesting': 'warn',
// Node plugin rules
'n/no-unpublished-require': 'off', // Not applicable for browser code
'n/no-missing-require': 'off', // Not applicable for browser code
'n/no-missing-import': 'off' // Handled by TypeScript
}
},
// TypeScript-specific rules
{
files: ['**/*.ts', '**/*.tsx', '**/*.d.ts', '*.mts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
// types are hoisted; avoid false positives in TS
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'off',
// Disable base rules that are covered by TypeScript
'no-undef': 'off',
'no-unused-vars': 'off'
}
},
// Enable JSX parsing for React files
{
files: ['**/*.jsx', '**/*.tsx'],
languageOptions: {
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 2022,
sourceType: 'module'
}
},
rules: {
// React-specific rules
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/jsx-no-undef': 'error',
'react/jsx-no-duplicate-props': 'error',
'react/no-unknown-property': 'error'
}
}
];