-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js.mjs
153 lines (114 loc) · 4.3 KB
/
eslint.config.js.mjs
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
* Copyright (C) 2024 brittni and the polar bear LLC.
*
* This file is a part of brittni and the polar bear's @batpb/genart algorithmic art library,
* which is released under the GNU Affero General Public License, Version 3.0.
* You may not use this file except in compliance with the license.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. See LICENSE or go to
* https://www.gnu.org/licenses/agpl-3.0.en.html for full license details.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*/
/* This configuration is designed to lint all JavaScript configuration files */
import eslint from '@eslint/js';
import es_x from 'eslint-plugin-es-x';
import node from 'eslint-plugin-n';
import security from 'eslint-plugin-security';
import stylistic from '@stylistic/eslint-plugin';
export default [
eslint.configs.recommended,
es_x.configs['flat/restrict-to-es2022'],
node.configs['flat/recommended'],
security.configs.recommended,
stylistic.configs['recommended-flat'],
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module'
},
rules: {
/* @eslint/js */
'array-callback-return': ['error', {
checkForEach: true
}],
'no-await-in-loop': 'error',
'no-cond-assign': ['error', 'always'],
'no-constant-condition': ['error', {
checkLoops: 'all'
}],
'no-constructor-return': 'error',
'no-duplicate-imports': ['error', {
includeExports: true
}],
'no-inner-declarations': ['error', 'both'],
'no-promise-executor-return': 'error',
'no-self-compare': 'error',
'no-template-curly-in-string': 'error',
'no-unmodified-loop-condition': 'error',
'no-unreachable-loop': 'error',
'no-unsafe-negation': ['error', {
enforceForOrderingRelations: true
}],
'no-unsafe-optional-chaining': ['error', {
disallowArithmeticOperators: true
}],
'no-useless-assignment': 'error',
'require-atomic-updates': 'error',
'use-isnan': ['error', {
enforceForSwitchCase: true,
enforceForIndexOf: true
}],
'valid-typeof': ['error', {
requireStringLiterals: true
}],
'one-var': ['error', 'never'],
/* @stylistic/eslint-plugin */
'@stylistic/brace-style': ['error', '1tbs'],
'@stylistic/no-extra-semi': 'error',
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
'@stylistic/function-call-spacing': ['error', 'never'],
'@stylistic/comma-dangle': ['error', 'never'],
'@stylistic/indent': ['error',
4,
{
SwitchCase: 1,
FunctionDeclaration: {
parameters: 'first'
},
FunctionExpression: {
parameters: 'first'
}
}
],
'@stylistic/indent-binary-ops': 'off',
'@stylistic/member-delimiter-style': ['error', {
multiline: {
delimiter: 'semi',
requireLast: true
},
singleline: {
delimiter: 'semi',
requireLast: true
}
}],
'@stylistic/operator-linebreak': ['error', 'after'],
'@stylistic/quotes': ['error',
'single',
{
avoidEscape: true,
allowTemplateLiterals: true
}
],
'@stylistic/semi': ['error', 'always'],
/* eslint-plugin-security */
'security/detect-object-injection': 'off',
/* eslint-plugin-n */
'n/no-missing-import': 'off'
}
}
];