-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
74 lines (72 loc) · 2.18 KB
/
eslint.config.js
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
import globals from 'globals';
import js from '@eslint/js';
/** @type {import('eslint').Linter.Config[]} */
export default [
{
ignores: ['dist/**', 'node_modules/**', '*.min.js', '*.d.ts'],
},
{
languageOptions: {
ecmaVersion: 2024,
sourceType: 'module',
globals: {
...globals.node,
...globals.browser,
},
},
linterOptions: {
reportUnusedDisableDirectives: true,
},
rules: {
...js.configs.recommended.rules,
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'no-constant-condition': ['error', { checkLoops: false }],
'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],
quotes: ['error', 'single', { avoidEscape: true }],
semi: ['error', 'always'],
indent: ['error', 2, { SwitchCase: 1 }],
'comma-dangle': ['error', 'always-multiline'],
'arrow-parens': ['error', 'as-needed'], // Changed from 'avoid' to 'as-needed'
'object-curly-spacing': ['error', 'always'],
'array-bracket-spacing': ['error', 'never'],
'space-before-function-paren': [
'error',
{
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
},
],
'no-trailing-spaces': 'error',
'eol-last': ['error', 'always'],
'prefer-const': 'error',
'no-var': 'error',
eqeqeq: ['error', 'always'],
curly: ['error', 'all'],
'brace-style': ['error', '1tbs', { allowSingleLine: false }],
'keyword-spacing': ['error', { before: true, after: true }],
'space-infix-ops': 'error',
'comma-spacing': ['error', { before: false, after: true }],
'no-multi-spaces': 'error',
'no-irregular-whitespace': 'error',
'no-mixed-spaces-and-tabs': 'error',
'no-else-return': 'error',
},
},
{
files: ['src/TokenCleaner.js'],
rules: {
'no-useless-escape': 'off',
},
},
{
files: ['**/*.test.js', '**/*.spec.js'],
languageOptions: {
globals: {
...globals.jest,
},
},
},
];