Repository navigation
Expand file tree
/
Copy patheslint.config.mjs
More file actions
127 lines (124 loc) · 4.54 KB
/
Copy patheslint.config.mjs
File metadata and controls
127 lines (124 loc) · 4.54 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
// Approximates the Node.js core lint rules, so that code can move between
// this repository and core with minimal changes.
import js from '@eslint/js';
import stylistic from '@stylistic/eslint-plugin';
import globals from 'globals';
export default [
{
ignores: ['node_modules/', 'coverage/'],
},
js.configs.recommended,
{
files: ['**/*.js', '**/*.cjs'],
languageOptions: {
sourceType: 'commonjs',
},
},
{
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
languageOptions: {
ecmaVersion: 'latest',
globals: {
...globals.node,
},
},
plugins: {
'@stylistic': stylistic,
},
rules: {
'eqeqeq': ['error', 'smart'],
'no-empty': ['error', { allowEmptyCatch: true }],
'no-unused-vars': ['error', {
args: 'none',
caughtErrors: 'none',
ignoreRestSiblings: true,
}],
'no-self-compare': 'error',
'no-unused-expressions': ['error', { allowShortCircuit: true }],
'no-var': 'error',
'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
'strict': ['error', 'global'],
'@stylistic/arrow-parens': 'error',
'@stylistic/arrow-spacing': 'error',
'@stylistic/block-spacing': 'error',
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
'@stylistic/comma-dangle': ['error', 'always-multiline'],
'@stylistic/comma-spacing': 'error',
'@stylistic/comma-style': 'error',
'@stylistic/computed-property-spacing': 'error',
'@stylistic/dot-location': ['error', 'property'],
'@stylistic/eol-last': 'error',
'@stylistic/function-call-spacing': 'error',
'@stylistic/indent': ['error', 2, {
ArrayExpression: 'first',
CallExpression: { arguments: 'first' },
FunctionDeclaration: { parameters: 'first' },
FunctionExpression: { parameters: 'first' },
MemberExpression: 'off',
ObjectExpression: 'first',
SwitchCase: 1,
}],
'@stylistic/key-spacing': 'error',
'@stylistic/keyword-spacing': 'error',
'@stylistic/linebreak-style': 'error',
'@stylistic/max-len': ['error', {
code: 120,
ignorePattern: '^// Flags:',
ignoreRegExpLiterals: true,
ignoreTemplateLiterals: true,
ignoreUrls: true,
tabWidth: 2,
}],
'@stylistic/new-parens': 'error',
'@stylistic/no-mixed-spaces-and-tabs': 'error',
'@stylistic/no-multi-spaces': ['error', { ignoreEOLComments: true }],
'@stylistic/no-multiple-empty-lines': ['error', { max: 2, maxBOF: 0, maxEOF: 0 }],
'@stylistic/no-tabs': 'error',
'@stylistic/no-trailing-spaces': 'error',
'@stylistic/no-whitespace-before-property': 'error',
'@stylistic/object-curly-newline': 'error',
'@stylistic/object-curly-spacing': ['error', 'always'],
'@stylistic/one-var-declaration-per-line': 'error',
'@stylistic/operator-linebreak': ['error', 'after'],
'@stylistic/padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: 'function', next: 'function' },
],
'@stylistic/quote-props': ['error', 'consistent'],
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
'@stylistic/rest-spread-spacing': 'error',
'@stylistic/semi': 'error',
'@stylistic/semi-spacing': 'error',
'@stylistic/space-before-blocks': ['error', 'always'],
'@stylistic/space-before-function-paren': ['error', {
anonymous: 'never',
asyncArrow: 'always',
named: 'never',
}],
'@stylistic/space-in-parens': 'error',
'@stylistic/space-infix-ops': 'error',
'@stylistic/space-unary-ops': 'error',
'@stylistic/spaced-comment': ['error', 'always', {
block: { balanced: true },
exceptions: ['-'],
}],
'@stylistic/template-curly-spacing': 'error',
},
},
{
// Library code must not depend on mutable globals. Built-ins are taken
// from ./internal/primordials, like in Node.js core.
files: ['lib/**/*.js'],
ignores: ['lib/internal/primordials.js'],
rules: {
'no-restricted-globals': [
'error',
'Array', 'ArrayBuffer', 'Atomics', 'BigInt', 'Boolean', 'DataView', 'Date',
'Error', 'EvalError', 'Function', 'JSON', 'Map', 'Math', 'Number',
'Int32Array', 'Object', 'Promise', 'Proxy', 'RangeError', 'ReferenceError',
'Reflect', 'RegExp', 'Set', 'SharedArrayBuffer', 'String', 'Symbol', 'SyntaxError',
'TypeError', 'URIError', 'WeakMap', 'WeakRef', 'WeakSet',
],
},
},
];