-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
83 lines (78 loc) · 2.22 KB
/
eslint.config.mjs
File metadata and controls
83 lines (78 loc) · 2.22 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
// @ts-check
import antfu from '@antfu/eslint-config';
export default antfu(
{
// Enable stylistic formatting rules
stylistic: {
indent: 2,
quotes: 'single',
semi: true,
},
// TypeScript and Vue are disabled by default, customize as needed
typescript: false,
vue: false,
// Disable jsonc and yaml rules if you don't need them
jsonc: false,
yaml: false,
// `.eslintignore` is no longer supported in ESLint 9 flat config, use ignores instead
ignores: [
'**/node_modules',
'**/dist',
'**/build',
'**/coverage',
'**/.nyc_output',
'**/logs',
'**/public',
'**/.tmp',
'**/.cache',
'**/temporal.db',
'**/*.min.js',
'**/package-lock.json',
'**/yarn.lock',
'**/pnpm-lock.yaml',
],
},
{
// Custom rules for your project
rules: {
// Adjust these based on your preferences
'no-console': 'off', // Allow console.log in Node.js projects
'antfu/if-newline': 'off', // Less strict about if-statement formatting
'node/prefer-global/process': 'off', // Allow process usage
'perfectionist/sort-imports': 'error', // Keep imports sorted
'unused-imports/no-unused-vars': 'warn', // Warn on unused vars instead of error
// Replace buddy.js magic number detection
'no-magic-numbers': ['warn', {
ignore: [0, 1, -1], // Common numbers are fine
ignoreArrayIndexes: true,
ignoreDefaultValues: true,
enforceConst: true,
}],
},
},
{
// Test file specific overrides
files: ['tests/**/*.js', 'tests/**/*.test.js'],
languageOptions: {
globals: {
describe: 'readonly',
it: 'readonly',
before: 'readonly',
after: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
expect: 'readonly',
assert: 'readonly',
chai: 'readonly',
sinon: 'readonly',
faker: 'readonly',
app: 'readonly',
},
},
rules: {
'no-magic-numbers': 'off', // Allow magic numbers in tests
'no-unused-vars': 'off', // Allow unused vars in tests
'unused-imports/no-unused-vars': 'off', // Allow unused vars in tests
},
},
);