-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
110 lines (103 loc) · 3.64 KB
/
eslint.config.mjs
File metadata and controls
110 lines (103 loc) · 3.64 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
import js from '@eslint/js';
import globals from 'globals';
import nodejs from 'eslint-plugin-n';
export default [
// Base configurations
js.configs.recommended,
nodejs.configs['flat/recommended'],
// Global variables
{
languageOptions: {
globals: {
...globals.node,
...globals.jest
},
ecmaVersion: 2022,
sourceType: 'module',
}
},
// File patterns and ignored files
{
ignores: [
'node_modules/',
'coverage/',
'.github/',
'dist/',
'build/',
'**/*.min.js',
'jest.config.mjs'
]
},
// Rules configuration
{
rules: {
// Disable specific rules for this project
'no-undef': 'off', // Disable undefined variable checks (we have variables from outer scopes)
// Error prevention
'no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'no-console': 'off',
'no-constant-condition': 'warn',
'no-debugger': 'error',
'no-duplicate-case': 'error',
'no-empty': 'warn',
'no-extra-boolean-cast': 'warn',
'no-fallthrough': 'warn',
'no-irregular-whitespace': 'warn',
'no-prototype-builtins': 'warn',
'no-return-await': 'warn',
'no-var': 'error',
'prefer-const': 'warn',
// Style
'camelcase': ['warn', { properties: 'never' }],
'semi': ['error', 'always'],
'indent': ['warn', 2, { SwitchCase: 1 }],
'quotes': ['warn', 'single', { allowTemplateLiterals: true, avoidEscape: true }],
'arrow-spacing': ['warn', { before: true, after: true }],
'block-spacing': ['warn', 'always'],
'brace-style': ['warn', '1tbs', { allowSingleLine: true }],
'comma-dangle': ['warn', 'only-multiline'],
'comma-spacing': ['warn', { before: false, after: true }],
'comma-style': ['warn', 'last'],
'eol-last': ['warn', 'always'],
'func-call-spacing': ['warn', 'never'],
'key-spacing': ['warn', { beforeColon: false, afterColon: true }],
'keyword-spacing': ['warn', { before: true, after: true }],
'linebreak-style': ['error', 'unix'],
'max-len': ['warn', { code: 120, ignoreUrls: true, ignoreStrings: true, ignoreTemplateLiterals: true }],
'no-multiple-empty-lines': ['warn', { max: 2, maxEOF: 1 }],
'no-trailing-spaces': 'warn',
'object-curly-spacing': ['warn', 'always'],
'padded-blocks': ['warn', 'never'],
'space-before-blocks': ['warn', 'always'],
'space-before-function-paren': ['warn', { anonymous: 'always', named: 'never', asyncArrow: 'always' }],
'space-in-parens': ['warn', 'never'],
'space-infix-ops': 'warn',
// Node.js specific
'n/exports-style': ['error', 'module.exports'],
'n/file-extension-in-import': ['error', 'always', { '.js': 'never', '.mjs': 'always' }],
'n/prefer-global/buffer': ['error', 'always'],
'n/prefer-global/console': ['error', 'always'],
'n/prefer-global/process': ['error', 'always'],
'n/prefer-global/url-search-params': ['error', 'always'],
'n/prefer-global/url': ['error', 'always'],
'n/prefer-promises/dns': 'error',
'n/prefer-promises/fs': 'error',
'n/no-deprecated-api': 'warn',
'n/no-unpublished-require': 'off',
'n/no-missing-import': 'off',
'n/no-unpublished-import': 'off',
'n/no-unsupported-features/es-syntax': 'off',
// Allow process.exit() in CLI applications
'n/no-process-exit': 'off'
}
},
{
files: ['**/*.test.js', '**/*.test.mjs'],
rules: {
// Allow importing @jest/globals in test files
'n/no-extraneous-import': ['error', {
allowModules: ['@jest/globals']
}]
}
}
];