-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.eslintrc.js
More file actions
104 lines (95 loc) · 2.9 KB
/
.eslintrc.js
File metadata and controls
104 lines (95 loc) · 2.9 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
module.exports = {
env: {
node: true,
es2021: true,
},
extends: ['eslint:recommended'],
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module', // ES modules
},
rules: {
// Code style
'indent': ['error', 2, { SwitchCase: 1 }],
'quotes': ['error', 'single', { avoidEscape: true }],
'semi': ['error', 'always'],
'comma-dangle': ['error', 'always-multiline'],
'comma-spacing': ['error', { before: false, after: true }],
'comma-style': ['error', 'last'],
'eol-last': ['error', 'always'],
'no-trailing-spaces': 'error',
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }],
// Best practices
'no-console': 'off', // Console.log is used for examples
'no-unused-vars': ['error', {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
}],
'no-undef': 'error',
'no-unreachable': 'error',
'no-var': 'error',
'prefer-const': 'error',
'prefer-arrow-callback': 'error', // ES modules prefer arrow functions
'arrow-parens': ['error', 'always'],
'arrow-spacing': ['error', { before: true, after: true }],
// Spacing
'space-before-blocks': 'error',
'space-before-function-paren': ['error', {
anonymous: 'always',
named: 'never',
asyncArrow: 'always',
}],
'space-in-parens': ['error', 'never'],
'space-infix-ops': 'error',
'space-unary-ops': ['error', {
words: true,
nonwords: false,
}],
'keyword-spacing': ['error', { before: true, after: true }],
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'curly': ['error', 'all'],
'object-curly-spacing': ['error', 'always'],
'array-bracket-spacing': ['error', 'never'],
'computed-property-spacing': ['error', 'never'],
// Naming conventions
'camelcase': ['error', {
properties: 'always',
ignoreDestructuring: false,
ignoreImports: false,
ignoreGlobals: false,
}],
// Node.js specific
'no-process-env': 'off', // process.env is used for configuration
// Async/await
'require-await': 'off', // Functions return promises that are awaited by callers
'no-async-promise-executor': 'error',
// Code quality
'eqeqeq': ['error', 'always'],
'no-eval': 'error',
'no-implied-eval': 'error',
'no-new-func': 'error',
'no-return-await': 'error',
'prefer-promise-reject-errors': 'error',
// Formatting
'max-len': ['warn', {
code: 120,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
}],
'max-lines-per-function': ['warn', {
max: 100,
skipBlankLines: true,
skipComments: true,
}],
'max-params': ['warn', 5],
// Node.js specific
'no-buffer-constructor': 'error',
'no-path-concat': 'error',
},
globals: {
// Java bridge globals (if used)
java: 'readonly',
},
}