-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.js
130 lines (125 loc) · 3.19 KB
/
index.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
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
128
129
130
'use strict';
const globals = require('globals');
const js = require('@eslint/js'); // eslint-disable-line n/no-extraneous-require
const nPlugin = require('eslint-plugin-n');
const regexpPlugin = require('eslint-plugin-regexp');
const stylisticPlugin = require('@stylistic/eslint-plugin');
module.exports = [
js.configs.recommended,
nPlugin.configs['flat/recommended-script'],
regexpPlugin.configs['flat/recommended'],
{
plugins: {
'@stylistic': stylisticPlugin,
},
languageOptions: {
ecmaVersion: 2023,
sourceType: 'module',
globals: {
...globals.node,
},
},
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
rules: {
'array-callback-return': 'error',
'dot-notation': 'error',
eqeqeq: ['error', 'smart'],
'func-name-matching': 'error',
'func-names': ['error', 'as-needed'],
'guard-for-in': 'error',
'no-console': [
'error',
{
allow: ['warn', 'error'],
},
],
'no-else-return': [
'error',
{
allowElseIf: false,
},
],
'no-implicit-coercion': 'error',
'no-lonely-if': 'error',
'no-shadow': 'error',
'no-unneeded-ternary': 'error',
'no-unused-vars': [
'error',
{
ignoreRestSiblings: true,
},
],
'no-use-before-define': ['error', 'nofunc'],
'no-useless-return': 'error',
'no-var': 'error',
'object-shorthand': 'error',
'one-var': ['error', 'never'],
'operator-assignment': 'error',
'prefer-arrow-callback': 'error',
'prefer-object-spread': 'error',
'prefer-regex-literals': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'error',
'sort-imports': ['error', { allowSeparatedGroups: true }],
// Migrated from the deprecated built-in 'padding-line-between-statements'
'@stylistic/padding-line-between-statements': [
'error',
// Require blank lines after all directive prologues (e. g. 'use strict')
{
blankLine: 'always',
prev: 'directive',
next: '*',
},
// Disallow blank lines between all directive prologues (e. g. 'use strict')
{
blankLine: 'never',
prev: 'directive',
next: 'directive',
},
// Require blank lines after every sequence of variable declarations
{
blankLine: 'always',
prev: ['const', 'let', 'var'],
next: '*',
},
// Blank lines could be between variable declarations
{
blankLine: 'any',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var'],
},
// Require blank lines before all return statements
{
blankLine: 'always',
prev: '*',
next: 'return',
},
// Require blank lines before and after all following statements
{
blankLine: 'always',
prev: '*',
next: ['for', 'function', 'if', 'switch', 'try'],
},
{
blankLine: 'always',
prev: ['for', 'function', 'if', 'switch', 'try'],
next: '*',
},
],
// Avoid a global variable unique to Node.js.
'n/prefer-global/process': ['error', 'never'],
// Prefer code readability, e.g. `[0-9A-Za-z]`.
'regexp/prefer-d': 'off',
},
},
{
files: ['*.mjs'],
rules: {
'no-restricted-globals': ['error', 'module', 'require'],
strict: ['error', 'never'],
},
},
];