@seanblonien/eslint-config-base 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +63 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +466 -0
- package/dist/index.js.map +1 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Sean Blonien
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# @seanblonien/eslint-config-base
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
Base ESLint flat config for modern JavaScript/TypeScript projects.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- ✅ ESLint recommended rules
|
|
11
|
+
- 🎯 TypeScript support (no project-aware rules for speed)
|
|
12
|
+
- 📦 Import plugin with automatic sorting and organization
|
|
13
|
+
- 🚫 Unused variable detection with `_` prefix ignore pattern
|
|
14
|
+
- ⚡ Fast - optimized for performance
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# pnpm
|
|
20
|
+
pnpm add -D eslint @seanblonien/eslint-config-base
|
|
21
|
+
|
|
22
|
+
# npm
|
|
23
|
+
npm install -D eslint @seanblonien/eslint-config-base
|
|
24
|
+
|
|
25
|
+
# yarn
|
|
26
|
+
yarn add -D eslint @seanblonien/eslint-config-base
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Peer Dependencies
|
|
30
|
+
|
|
31
|
+
This config requires the following peer dependencies (automatically installed):
|
|
32
|
+
|
|
33
|
+
- `eslint` >= 9.0.0
|
|
34
|
+
- `@eslint/js` >= 9.0.0
|
|
35
|
+
- `typescript-eslint` >= 8.0.0
|
|
36
|
+
- `eslint-plugin-import` >= 2.31.0
|
|
37
|
+
- `typescript` >= 5.0.0
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
// eslint.config.ts
|
|
43
|
+
import baseConfig from '@seanblonien/eslint-config-base';
|
|
44
|
+
|
|
45
|
+
export default [
|
|
46
|
+
...baseConfig,
|
|
47
|
+
{
|
|
48
|
+
rules: {
|
|
49
|
+
// Rule overrides
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Requirements
|
|
56
|
+
|
|
57
|
+
- Node.js >= 20
|
|
58
|
+
- ESLint >= 9.0.0
|
|
59
|
+
- TypeScript >= 5.0.0
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT © Sean Blonien
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import eslint from "@eslint/js";
|
|
3
|
+
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
4
|
+
import stylistic from "@stylistic/eslint-plugin";
|
|
5
|
+
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
|
6
|
+
import importXPlugin from "eslint-plugin-import-x";
|
|
7
|
+
import sonarjsPlugin from "eslint-plugin-sonarjs";
|
|
8
|
+
import sortPlugin from "eslint-plugin-sort";
|
|
9
|
+
import testingLibraryPlugin from "eslint-plugin-testing-library";
|
|
10
|
+
import unicornPlugin from "eslint-plugin-unicorn";
|
|
11
|
+
import unusedImports from "eslint-plugin-unused-imports";
|
|
12
|
+
import globals from "globals";
|
|
13
|
+
import tseslint from "typescript-eslint";
|
|
14
|
+
import noLoopsPlugin from "eslint-plugin-no-loops";
|
|
15
|
+
import banPlugin from "eslint-plugin-ban";
|
|
16
|
+
|
|
17
|
+
// src/boolean-naming.ts
|
|
18
|
+
var concatElementsByRegexUnion = (elements) => elements.reduce((element, accum, index) => `${accum}${index === 0 ? "" : "|"}${element}`, "");
|
|
19
|
+
var booleanNamePrefixes = [
|
|
20
|
+
"is",
|
|
21
|
+
"are",
|
|
22
|
+
"should",
|
|
23
|
+
"has",
|
|
24
|
+
"can",
|
|
25
|
+
"did",
|
|
26
|
+
"will",
|
|
27
|
+
"use",
|
|
28
|
+
"does",
|
|
29
|
+
"show",
|
|
30
|
+
"allow",
|
|
31
|
+
"enabled",
|
|
32
|
+
"enable",
|
|
33
|
+
"disable",
|
|
34
|
+
"editable",
|
|
35
|
+
"refetch",
|
|
36
|
+
"destructive",
|
|
37
|
+
"hide",
|
|
38
|
+
"error",
|
|
39
|
+
"override"
|
|
40
|
+
];
|
|
41
|
+
var booleanNameSuffixes = "[A-Z]([A-Za-z]?)+";
|
|
42
|
+
var booleanNameExceptionsList = [
|
|
43
|
+
"^_",
|
|
44
|
+
"_$",
|
|
45
|
+
"[- /?:{}@%]",
|
|
46
|
+
"^[A-Z][a-z]*([A-Z][a-z]*)",
|
|
47
|
+
"^item$",
|
|
48
|
+
"^value$",
|
|
49
|
+
"^condition$",
|
|
50
|
+
"^container$",
|
|
51
|
+
"^included",
|
|
52
|
+
"^center$",
|
|
53
|
+
"^debug$",
|
|
54
|
+
"^concurrent",
|
|
55
|
+
"^animated$",
|
|
56
|
+
"^allow",
|
|
57
|
+
"^visible",
|
|
58
|
+
"^merge$",
|
|
59
|
+
"^multiSelect$",
|
|
60
|
+
"Shown$",
|
|
61
|
+
"^enumerable$",
|
|
62
|
+
"^configurable$"
|
|
63
|
+
];
|
|
64
|
+
var booleanNameExceptions = concatElementsByRegexUnion(booleanNameExceptionsList);
|
|
65
|
+
var booleanNameConvention = new RegExp(
|
|
66
|
+
`${concatElementsByRegexUnion(
|
|
67
|
+
booleanNamePrefixes
|
|
68
|
+
)}|${booleanNameSuffixes}|${booleanNameExceptions}`
|
|
69
|
+
).toString();
|
|
70
|
+
|
|
71
|
+
// src/index.ts
|
|
72
|
+
var config = [
|
|
73
|
+
// Base recommended rules from ESLint
|
|
74
|
+
eslint.configs.recommended,
|
|
75
|
+
// TypeScript recommended configs
|
|
76
|
+
...tseslint.configs.recommendedTypeChecked,
|
|
77
|
+
...tseslint.configs.stylisticTypeChecked,
|
|
78
|
+
...tseslint.configs.strict,
|
|
79
|
+
// Apply stylistic rules with customized settings
|
|
80
|
+
stylistic.configs.customize({
|
|
81
|
+
arrowParens: true,
|
|
82
|
+
// jsx: true,
|
|
83
|
+
braceStyle: "1tbs",
|
|
84
|
+
commaDangle: "always-multiline",
|
|
85
|
+
indent: 2,
|
|
86
|
+
quoteProps: "consistent-as-needed",
|
|
87
|
+
quotes: "single",
|
|
88
|
+
semi: true
|
|
89
|
+
}),
|
|
90
|
+
// Import plugin configuration
|
|
91
|
+
importXPlugin.flatConfigs.recommended,
|
|
92
|
+
importXPlugin.flatConfigs.typescript,
|
|
93
|
+
sortPlugin.configs["flat/recommended"],
|
|
94
|
+
// Code quality plugins
|
|
95
|
+
unicornPlugin.configs.recommended,
|
|
96
|
+
comments.recommended,
|
|
97
|
+
sonarjsPlugin.configs.recommended,
|
|
98
|
+
// General JavaScript/TypeScript configuration
|
|
99
|
+
{
|
|
100
|
+
files: ["**/*.{js,mjs,cjs,ts,tsx}"],
|
|
101
|
+
languageOptions: {
|
|
102
|
+
ecmaVersion: "latest",
|
|
103
|
+
globals: {
|
|
104
|
+
...globals.browser,
|
|
105
|
+
...globals.node,
|
|
106
|
+
...globals.es2025,
|
|
107
|
+
...globals.vitest
|
|
108
|
+
},
|
|
109
|
+
parserOptions: {
|
|
110
|
+
projectService: true,
|
|
111
|
+
warnOnUnsupportedTypeScriptVersion: true
|
|
112
|
+
},
|
|
113
|
+
sourceType: "module"
|
|
114
|
+
},
|
|
115
|
+
linterOptions: {
|
|
116
|
+
reportUnusedDisableDirectives: true
|
|
117
|
+
},
|
|
118
|
+
plugins: {
|
|
119
|
+
"no-loops": noLoopsPlugin,
|
|
120
|
+
"ban": banPlugin,
|
|
121
|
+
"testing-library": testingLibraryPlugin,
|
|
122
|
+
"unused-imports": unusedImports
|
|
123
|
+
},
|
|
124
|
+
rules: {
|
|
125
|
+
// --- Stylistic Rules ---
|
|
126
|
+
// Core rules turned off in favor of stylistic rules
|
|
127
|
+
"quotes": "off",
|
|
128
|
+
"jsx-quotes": "off",
|
|
129
|
+
"func-call-spacing": "off",
|
|
130
|
+
"dot-notation": "off",
|
|
131
|
+
"no-unused-expressions": "off",
|
|
132
|
+
"no-use-before-define": "off",
|
|
133
|
+
"default-param-last": "off",
|
|
134
|
+
"no-redeclare": "off",
|
|
135
|
+
"no-shadow": "off",
|
|
136
|
+
// Stylistic (overrides vs stylistic recommended)
|
|
137
|
+
"quote-props": ["warn", "consistent-as-needed"],
|
|
138
|
+
"@stylistic/quotes": ["warn", "single", { avoidEscape: true }],
|
|
139
|
+
"@stylistic/jsx-quotes": ["warn", "prefer-single"],
|
|
140
|
+
"@stylistic/jsx-one-expression-per-line": "off",
|
|
141
|
+
"@stylistic/block-spacing": ["warn", "never"],
|
|
142
|
+
"@stylistic/object-curly-newline": [
|
|
143
|
+
"warn",
|
|
144
|
+
{ ObjectPattern: { multiline: true, consistent: true } }
|
|
145
|
+
],
|
|
146
|
+
"object-property-newline": [
|
|
147
|
+
"warn",
|
|
148
|
+
{ allowAllPropertiesOnSameLine: true }
|
|
149
|
+
],
|
|
150
|
+
"function-call-argument-newline": ["warn", "consistent"],
|
|
151
|
+
"no-multiple-empty-lines": ["warn", { max: 1, maxEOF: 1 }],
|
|
152
|
+
"no-multi-spaces": "warn",
|
|
153
|
+
"arrow-spacing": "warn",
|
|
154
|
+
"space-infix-ops": "warn",
|
|
155
|
+
"@stylistic/operator-linebreak": [
|
|
156
|
+
"warn",
|
|
157
|
+
"after",
|
|
158
|
+
{ overrides: { "?": "before", ":": "before" } }
|
|
159
|
+
],
|
|
160
|
+
"comma-style": ["warn", "last"],
|
|
161
|
+
"complexity": ["warn", { max: 20 }],
|
|
162
|
+
"@stylistic/max-len": [
|
|
163
|
+
"warn",
|
|
164
|
+
{
|
|
165
|
+
code: 100,
|
|
166
|
+
comments: 120,
|
|
167
|
+
ignoreUrls: true,
|
|
168
|
+
ignoreTrailingComments: true,
|
|
169
|
+
ignorePattern: String.raw`^.*eslint-(disable|enable).+|it\(|ErrorCodes|@param|@return|^\s*\[[^\]]+\]:\s*.+?;$`,
|
|
170
|
+
ignoreTemplateLiterals: true,
|
|
171
|
+
ignoreStrings: true,
|
|
172
|
+
ignoreRegExpLiterals: true
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
"max-lines-per-function": ["error", 120],
|
|
176
|
+
"max-lines": ["error", { max: 900, skipBlankLines: true }],
|
|
177
|
+
"func-style": ["warn", "expression"],
|
|
178
|
+
"padding-line-between-statements": [
|
|
179
|
+
"error",
|
|
180
|
+
{ blankLine: "never", prev: "*", next: "import" }
|
|
181
|
+
],
|
|
182
|
+
"object-shorthand": ["warn", "always"],
|
|
183
|
+
"arrow-body-style": ["warn", "as-needed"],
|
|
184
|
+
"prefer-destructuring": "warn",
|
|
185
|
+
"prefer-arrow-callback": "error",
|
|
186
|
+
"prefer-template": "warn",
|
|
187
|
+
"one-var": ["error", "never"],
|
|
188
|
+
"no-bitwise": "error",
|
|
189
|
+
// TypeScript equivalents and customizations
|
|
190
|
+
"@typescript-eslint/no-redeclare": "error",
|
|
191
|
+
"@typescript-eslint/default-param-last": "error",
|
|
192
|
+
"@typescript-eslint/require-await": "off",
|
|
193
|
+
"no-return-await": "warn",
|
|
194
|
+
"no-nested-ternary": "warn",
|
|
195
|
+
"no-unneeded-ternary": "warn",
|
|
196
|
+
"no-else-return": "warn",
|
|
197
|
+
"no-constant-condition": "off",
|
|
198
|
+
"@typescript-eslint/dot-notation": "error",
|
|
199
|
+
"@typescript-eslint/no-unused-expressions": [
|
|
200
|
+
"error",
|
|
201
|
+
{
|
|
202
|
+
allowShortCircuit: true,
|
|
203
|
+
allowTernary: true,
|
|
204
|
+
allowTaggedTemplates: true
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
"@typescript-eslint/no-use-before-define": [
|
|
208
|
+
"error",
|
|
209
|
+
{ variables: true, functions: false }
|
|
210
|
+
],
|
|
211
|
+
"no-console": "warn",
|
|
212
|
+
"no-useless-concat": "warn",
|
|
213
|
+
"no-new": "error",
|
|
214
|
+
"no-implicit-coercion": ["warn", { allow: ["!!"] }],
|
|
215
|
+
"no-extra-boolean-cast": "warn",
|
|
216
|
+
// Magic numbers
|
|
217
|
+
"no-magic-numbers": "off",
|
|
218
|
+
"@typescript-eslint/no-magic-numbers": [
|
|
219
|
+
"error",
|
|
220
|
+
{
|
|
221
|
+
ignoreEnums: true,
|
|
222
|
+
ignoreArrayIndexes: true,
|
|
223
|
+
ignoreDefaultValues: true,
|
|
224
|
+
ignoreTypeIndexes: true,
|
|
225
|
+
ignore: [0, 1, -1, 2]
|
|
226
|
+
}
|
|
227
|
+
],
|
|
228
|
+
// More stylistic specifics
|
|
229
|
+
"@stylistic/brace-style": ["warn", "1tbs", { allowSingleLine: true }],
|
|
230
|
+
"@stylistic/comma-dangle": ["warn", "always-multiline"],
|
|
231
|
+
"@stylistic/comma-spacing": "warn",
|
|
232
|
+
"@stylistic/function-call-spacing": ["error"],
|
|
233
|
+
// Naming
|
|
234
|
+
"camelcase": ["warn", { allow: ["^_", "content_type", "reply_to"] }],
|
|
235
|
+
"@typescript-eslint/naming-convention": [
|
|
236
|
+
"warn",
|
|
237
|
+
{
|
|
238
|
+
selector: "property",
|
|
239
|
+
format: ["camelCase", "UPPER_CASE"],
|
|
240
|
+
leadingUnderscore: "allow",
|
|
241
|
+
filter: {
|
|
242
|
+
regex: String.raw`^_|[- /?:{}@%]|Provider|Mui|Comp|^item$|^condition$|^container$|^Container$|^\d+$`,
|
|
243
|
+
match: false
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
selector: "variableLike",
|
|
248
|
+
format: ["camelCase", "UPPER_CASE"],
|
|
249
|
+
trailingUnderscore: "allow",
|
|
250
|
+
filter: { regex: "^_|Comp|Container|Provider|Stack|Root", match: false }
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
selector: "variable",
|
|
254
|
+
format: ["camelCase", "PascalCase"],
|
|
255
|
+
types: ["function"],
|
|
256
|
+
filter: { regex: "^_|Comp|Provider|Stack", match: false }
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
selector: "typeLike",
|
|
260
|
+
format: ["PascalCase"],
|
|
261
|
+
filter: { regex: "^_|_$", match: false }
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
selector: ["variable", "property", "parameter", "typeProperty"],
|
|
265
|
+
types: ["boolean"],
|
|
266
|
+
format: ["UPPER_CASE", "PascalCase"],
|
|
267
|
+
prefix: booleanNamePrefixes,
|
|
268
|
+
filter: { regex: booleanNameExceptions, match: false }
|
|
269
|
+
}
|
|
270
|
+
],
|
|
271
|
+
// TS type safety and preferences
|
|
272
|
+
"@typescript-eslint/no-explicit-any": ["warn", { fixToUnknown: true }],
|
|
273
|
+
"@typescript-eslint/no-inferrable-types": ["warn", { ignoreParameters: true }],
|
|
274
|
+
"@typescript-eslint/no-shadow": "error",
|
|
275
|
+
"@typescript-eslint/no-unsafe-enum-comparison": "off",
|
|
276
|
+
"@typescript-eslint/no-base-to-string": "off",
|
|
277
|
+
"@typescript-eslint/prefer-nullish-coalescing": [
|
|
278
|
+
"warn",
|
|
279
|
+
{ ignorePrimitives: { string: true } }
|
|
280
|
+
],
|
|
281
|
+
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
|
|
282
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
283
|
+
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
284
|
+
"@typescript-eslint/no-confusing-non-null-assertion": "error",
|
|
285
|
+
"@typescript-eslint/ban-ts-comment": [
|
|
286
|
+
"error",
|
|
287
|
+
{ "ts-expect-error": "allow-with-description", "ts-ignore": "allow-with-description" }
|
|
288
|
+
],
|
|
289
|
+
"@typescript-eslint/no-empty-object-type": "warn",
|
|
290
|
+
"@typescript-eslint/no-unsafe-function-type": "warn",
|
|
291
|
+
"@typescript-eslint/no-wrapper-object-types": "warn",
|
|
292
|
+
"@typescript-eslint/array-type": ["warn", { default: "array" }],
|
|
293
|
+
"@stylistic/array-element-newline": ["warn", { multiline: true, consistent: true }],
|
|
294
|
+
"@stylistic/array-bracket-newline": ["warn", "consistent"],
|
|
295
|
+
"@stylistic/no-mixed-operators": ["warn", { allowSamePrecedence: true }],
|
|
296
|
+
"@stylistic/rest-spread-spacing": ["warn", "never"],
|
|
297
|
+
"@typescript-eslint/no-unnecessary-condition": "warn",
|
|
298
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
|
|
299
|
+
// TS consistency
|
|
300
|
+
"@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
|
|
301
|
+
"@typescript-eslint/consistent-type-assertions": [
|
|
302
|
+
"error",
|
|
303
|
+
{ assertionStyle: "as" }
|
|
304
|
+
],
|
|
305
|
+
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
306
|
+
"@typescript-eslint/consistent-type-exports": "error",
|
|
307
|
+
"@typescript-eslint/method-signature-style": "error",
|
|
308
|
+
// Expressions and async
|
|
309
|
+
"@typescript-eslint/no-confusing-void-expression": [
|
|
310
|
+
"error",
|
|
311
|
+
{ ignoreArrowShorthand: true }
|
|
312
|
+
],
|
|
313
|
+
"@typescript-eslint/no-invalid-void-type": "off",
|
|
314
|
+
"@typescript-eslint/no-meaningless-void-operator": "error",
|
|
315
|
+
"@typescript-eslint/no-misused-promises": "off",
|
|
316
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
317
|
+
// TS modern prefs
|
|
318
|
+
"@typescript-eslint/prefer-includes": "error",
|
|
319
|
+
"@typescript-eslint/prefer-optional-chain": "error",
|
|
320
|
+
"@typescript-eslint/prefer-reduce-type-parameter": "error",
|
|
321
|
+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
322
|
+
// --- Comment Formatting Rules ---
|
|
323
|
+
"spaced-comment": "off",
|
|
324
|
+
"@stylistic/spaced-comment": ["warn", "always", { line: { markers: ["!", "?", "-", "**"] } }],
|
|
325
|
+
// --- Unused Variables & Imports Rules ---
|
|
326
|
+
"no-unused-vars": "off",
|
|
327
|
+
"@stylistic/no-unused-vars": "off",
|
|
328
|
+
"sonarjs/no-unused-vars": "off",
|
|
329
|
+
"unused-imports/no-unused-imports": "error",
|
|
330
|
+
"unused-imports/no-unused-vars": [
|
|
331
|
+
"warn",
|
|
332
|
+
{
|
|
333
|
+
vars: "all",
|
|
334
|
+
varsIgnorePattern: "^_",
|
|
335
|
+
args: "after-used",
|
|
336
|
+
argsIgnorePattern: "^_"
|
|
337
|
+
}
|
|
338
|
+
],
|
|
339
|
+
// --- Banned API Rules ---
|
|
340
|
+
"ban/ban": [
|
|
341
|
+
"warn",
|
|
342
|
+
{
|
|
343
|
+
name: ["*", "concat"],
|
|
344
|
+
message: "Imperative operation: prefer use ES6 spread, i.e. [...items, newItem]"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: ["Object", "assign"],
|
|
348
|
+
message: "Use the spread operator `{...obj}` instead"
|
|
349
|
+
}
|
|
350
|
+
],
|
|
351
|
+
// --- Code Structure Restrictions ---
|
|
352
|
+
// No loops rule
|
|
353
|
+
"no-loops/no-loops": "error",
|
|
354
|
+
// Syntax restrictions
|
|
355
|
+
"no-restricted-syntax": [
|
|
356
|
+
"error",
|
|
357
|
+
{
|
|
358
|
+
selector: "SwitchStatement",
|
|
359
|
+
message: "Switch statements are banned. Use `ts-pattern` instead."
|
|
360
|
+
}
|
|
361
|
+
],
|
|
362
|
+
// --- ESLint Comments Rules ---
|
|
363
|
+
"@eslint-community/eslint-comments/require-description": ["error", { ignore: ["eslint-enable"] }],
|
|
364
|
+
// --- Testing Library Rules ---
|
|
365
|
+
"testing-library/no-render-in-lifecycle": ["error", { allowTestingFrameworkSetupHook: "beforeEach" }],
|
|
366
|
+
"testing-library/no-unnecessary-act": "off",
|
|
367
|
+
// --- Import Rules ---
|
|
368
|
+
// Commented out rules kept for reference
|
|
369
|
+
// 'import/no-default-export': 'warn',
|
|
370
|
+
// 'import/no-restricted-paths': ['warn', { zones: restrictedPaths }], // Define restrictedPaths
|
|
371
|
+
"import-x/no-named-as-default-member": "off",
|
|
372
|
+
"import-x/no-absolute-path": "warn",
|
|
373
|
+
"import-x/newline-after-import": "warn",
|
|
374
|
+
"import-x/no-cycle": ["error", { maxDepth: 1, ignoreExternal: true }],
|
|
375
|
+
"import-x/order": [
|
|
376
|
+
"warn",
|
|
377
|
+
{
|
|
378
|
+
groups: [
|
|
379
|
+
"builtin",
|
|
380
|
+
// Node.js built-in modules
|
|
381
|
+
"external",
|
|
382
|
+
// Packages from node_modules
|
|
383
|
+
["type", "internal"],
|
|
384
|
+
// Type imports, Absolute imports (often aliased like 'src/components')
|
|
385
|
+
"parent",
|
|
386
|
+
// Relative imports from parent directories (../)
|
|
387
|
+
"sibling",
|
|
388
|
+
// Relative imports from sibling directories (./)
|
|
389
|
+
"index",
|
|
390
|
+
// Index file imports (./index.js)
|
|
391
|
+
"object"
|
|
392
|
+
// Imports from object notation
|
|
393
|
+
]
|
|
394
|
+
}
|
|
395
|
+
],
|
|
396
|
+
// --- Sort Rules ---
|
|
397
|
+
"sort/imports": "off",
|
|
398
|
+
// use 'import-x/order' rule instead
|
|
399
|
+
"sort/object-properties": "off",
|
|
400
|
+
"sort/type-properties": "warn",
|
|
401
|
+
"sort/string-unions": "off",
|
|
402
|
+
// --- Unicorn Rules ---
|
|
403
|
+
"unicorn/prefer-global-this": "off",
|
|
404
|
+
"unicorn/prevent-abbreviations": "off",
|
|
405
|
+
"unicorn/no-array-reduce": "off",
|
|
406
|
+
"unicorn/no-array-for-each": "off",
|
|
407
|
+
"unicorn/prefer-top-level-await": "off",
|
|
408
|
+
"unicorn/no-array-callback-reference": "off",
|
|
409
|
+
"unicorn/prefer-switch": "off",
|
|
410
|
+
"unicorn/no-abusive-eslint-disable": "off",
|
|
411
|
+
"unicorn/prefer-object-from-entries": "off",
|
|
412
|
+
"unicorn/no-null": "off",
|
|
413
|
+
"unicorn/filename-case": [
|
|
414
|
+
"warn",
|
|
415
|
+
{
|
|
416
|
+
cases: { camelCase: true, kebabCase: true },
|
|
417
|
+
ignore: [/\.(js|cjs)$/]
|
|
418
|
+
// Keep ignoring JS/CJS if needed
|
|
419
|
+
}
|
|
420
|
+
],
|
|
421
|
+
"unicorn/no-unused-properties": "warn",
|
|
422
|
+
"unicorn/consistent-destructuring": "warn",
|
|
423
|
+
"unicorn/no-useless-undefined": ["warn", { checkArguments: false }],
|
|
424
|
+
// --- SonarJS Rules ---
|
|
425
|
+
"sonarjs/no-duplicated-branches": "warn",
|
|
426
|
+
"sonarjs/no-duplicate-string": "off",
|
|
427
|
+
"sonarjs/deprecation": "off",
|
|
428
|
+
"sonarjs/cognitive-complexity": "off",
|
|
429
|
+
// use 'complexity' rule instead
|
|
430
|
+
"sonarjs/no-nested-functions": "off",
|
|
431
|
+
// use 'complexity' rule instead
|
|
432
|
+
"sonarjs/function-return-type": "off",
|
|
433
|
+
// use '@typescript-eslint/explicit-module-boundary-types' rule instead
|
|
434
|
+
"sonarjs/no-redundant-optional": "off",
|
|
435
|
+
// use '@typescript-eslint/no-redundant-optional' rule instead
|
|
436
|
+
"sonarjs/no-commented-code": "off",
|
|
437
|
+
// slow rule
|
|
438
|
+
"sonarjs/todo-tag": "off",
|
|
439
|
+
// eventually re-enable
|
|
440
|
+
"sonarjs/pseudo-random": "off",
|
|
441
|
+
"sonarjs/different-types-comparison": "off",
|
|
442
|
+
// too many false positives
|
|
443
|
+
"sonarjs/redundant-type-aliases": "off",
|
|
444
|
+
"sonarjs/void-use": "off",
|
|
445
|
+
// allow to annotate async functions not explicitly awaited
|
|
446
|
+
"sonarjs/no-nested-conditional": "off",
|
|
447
|
+
// use 'no-nested-ternary' rule instead
|
|
448
|
+
"sonarjs/no-hardcoded-passwords": "off"
|
|
449
|
+
},
|
|
450
|
+
settings: {
|
|
451
|
+
"import-x/extensions": [".js", ".cjs", ".mjs"],
|
|
452
|
+
"import-x/parsers": { "typescript-eslint": [".ts", ".tsx"] },
|
|
453
|
+
"import-x/resolver-next": [
|
|
454
|
+
createTypeScriptImportResolver({
|
|
455
|
+
alwaysTryTypes: true,
|
|
456
|
+
bun: true
|
|
457
|
+
})
|
|
458
|
+
]
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
];
|
|
462
|
+
var index_default = config;
|
|
463
|
+
export {
|
|
464
|
+
index_default as default
|
|
465
|
+
};
|
|
466
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/boolean-naming.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-magic-numbers -- config file */\n/* eslint-disable @typescript-eslint/naming-convention -- config file */\nimport eslint from '@eslint/js';\n// @ts-expect-error - no types available\nimport comments from '@eslint-community/eslint-plugin-eslint-comments/configs';\nimport stylistic from '@stylistic/eslint-plugin';\nimport { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';\nimport importXPlugin from 'eslint-plugin-import-x';\nimport sonarjsPlugin from 'eslint-plugin-sonarjs';\nimport sortPlugin from 'eslint-plugin-sort';\nimport testingLibraryPlugin from 'eslint-plugin-testing-library';\nimport unicornPlugin from 'eslint-plugin-unicorn';\nimport unusedImports from 'eslint-plugin-unused-imports';\nimport globals from 'globals';\nimport tseslint from 'typescript-eslint';\n// @ts-expect-error - no types available\nimport noLoopsPlugin from 'eslint-plugin-no-loops';\n// @ts-expect-error - no types available\nimport banPlugin from 'eslint-plugin-ban';\nimport type { Linter } from 'eslint';\nimport { booleanNameExceptions, booleanNamePrefixes } from './boolean-naming';\n\ntype Plugin = typeof testingLibraryPlugin;\n\nconst config: Linter.Config[] = [\n // Base recommended rules from ESLint\n eslint.configs.recommended,\n\n // TypeScript recommended configs\n ...tseslint.configs.recommendedTypeChecked,\n ...tseslint.configs.stylisticTypeChecked,\n ...tseslint.configs.strict,\n\n // Apply stylistic rules with customized settings\n stylistic.configs.customize({\n arrowParens: true,\n // jsx: true,\n braceStyle: '1tbs',\n commaDangle: 'always-multiline',\n indent: 2,\n quoteProps: 'consistent-as-needed',\n quotes: 'single',\n semi: true,\n }),\n\n // Import plugin configuration\n importXPlugin.flatConfigs.recommended,\n importXPlugin.flatConfigs.typescript,\n sortPlugin.configs['flat/recommended'],\n\n // Code quality plugins\n unicornPlugin.configs.recommended,\n (comments as { recommended: Linter.Config }).recommended,\n sonarjsPlugin.configs.recommended,\n\n // General JavaScript/TypeScript configuration\n {\n files: ['**/*.{js,mjs,cjs,ts,tsx}'],\n languageOptions: {\n ecmaVersion: 'latest',\n globals: {\n ...globals.browser,\n ...globals.node,\n ...globals.es2025,\n ...globals.vitest,\n },\n parserOptions: {\n projectService: true,\n warnOnUnsupportedTypeScriptVersion: true,\n },\n sourceType: 'module',\n },\n linterOptions: {\n reportUnusedDisableDirectives: true,\n },\n plugins: {\n 'no-loops': noLoopsPlugin as Plugin,\n 'ban': banPlugin as Plugin,\n 'testing-library': testingLibraryPlugin,\n 'unused-imports': unusedImports,\n },\n rules: {\n // --- Stylistic Rules ---\n // Core rules turned off in favor of stylistic rules\n 'quotes': 'off',\n 'jsx-quotes': 'off',\n 'func-call-spacing': 'off',\n 'dot-notation': 'off',\n 'no-unused-expressions': 'off',\n 'no-use-before-define': 'off',\n 'default-param-last': 'off',\n 'no-redeclare': 'off',\n 'no-shadow': 'off',\n\n // Stylistic (overrides vs stylistic recommended)\n 'quote-props': ['warn', 'consistent-as-needed'],\n '@stylistic/quotes': ['warn', 'single', { avoidEscape: true }],\n '@stylistic/jsx-quotes': ['warn', 'prefer-single'],\n '@stylistic/jsx-one-expression-per-line': 'off',\n '@stylistic/block-spacing': ['warn', 'never'],\n '@stylistic/object-curly-newline': [\n 'warn',\n { ObjectPattern: { multiline: true, consistent: true } },\n ],\n 'object-property-newline': [\n 'warn',\n { allowAllPropertiesOnSameLine: true },\n ],\n 'function-call-argument-newline': ['warn', 'consistent'],\n 'no-multiple-empty-lines': ['warn', { max: 1, maxEOF: 1 }],\n 'no-multi-spaces': 'warn',\n 'arrow-spacing': 'warn',\n 'space-infix-ops': 'warn',\n '@stylistic/operator-linebreak': [\n 'warn',\n 'after',\n { overrides: { '?': 'before', ':': 'before' } },\n ],\n 'comma-style': ['warn', 'last'],\n 'complexity': ['warn', { max: 20 }],\n '@stylistic/max-len': [\n 'warn',\n {\n code: 100,\n comments: 120,\n ignoreUrls: true,\n ignoreTrailingComments: true,\n ignorePattern:\n String.raw`^.*eslint-(disable|enable).+|it\\(|ErrorCodes|@param|@return|^\\s*\\[[^\\]]+\\]:\\s*.+?;$`,\n ignoreTemplateLiterals: true,\n ignoreStrings: true,\n ignoreRegExpLiterals: true,\n },\n ],\n 'max-lines-per-function': ['error', 120],\n 'max-lines': ['error', { max: 900, skipBlankLines: true }],\n 'func-style': ['warn', 'expression'],\n 'padding-line-between-statements': [\n 'error',\n { blankLine: 'never', prev: '*', next: 'import' },\n ],\n 'object-shorthand': ['warn', 'always'],\n 'arrow-body-style': ['warn', 'as-needed'],\n 'prefer-destructuring': 'warn',\n 'prefer-arrow-callback': 'error',\n 'prefer-template': 'warn',\n 'one-var': ['error', 'never'],\n 'no-bitwise': 'error',\n\n // TypeScript equivalents and customizations\n '@typescript-eslint/no-redeclare': 'error',\n '@typescript-eslint/default-param-last': 'error',\n '@typescript-eslint/require-await': 'off',\n 'no-return-await': 'warn',\n 'no-nested-ternary': 'warn',\n 'no-unneeded-ternary': 'warn',\n 'no-else-return': 'warn',\n 'no-constant-condition': 'off',\n '@typescript-eslint/dot-notation': 'error',\n '@typescript-eslint/no-unused-expressions': [\n 'error',\n {\n allowShortCircuit: true,\n allowTernary: true,\n allowTaggedTemplates: true,\n },\n ],\n '@typescript-eslint/no-use-before-define': [\n 'error',\n { variables: true, functions: false },\n ],\n 'no-console': 'warn',\n 'no-useless-concat': 'warn',\n 'no-new': 'error',\n 'no-implicit-coercion': ['warn', { allow: ['!!'] }],\n 'no-extra-boolean-cast': 'warn',\n\n // Magic numbers\n 'no-magic-numbers': 'off',\n '@typescript-eslint/no-magic-numbers': [\n 'error',\n {\n ignoreEnums: true,\n ignoreArrayIndexes: true,\n ignoreDefaultValues: true,\n ignoreTypeIndexes: true,\n ignore: [0, 1, -1, 2],\n },\n ],\n\n // More stylistic specifics\n '@stylistic/brace-style': ['warn', '1tbs', { allowSingleLine: true }],\n '@stylistic/comma-dangle': ['warn', 'always-multiline'],\n '@stylistic/comma-spacing': 'warn',\n '@stylistic/function-call-spacing': ['error'],\n\n // Naming\n 'camelcase': ['warn', { allow: ['^_', 'content_type', 'reply_to'] }],\n '@typescript-eslint/naming-convention': [\n 'warn',\n {\n selector: 'property',\n format: ['camelCase', 'UPPER_CASE'],\n leadingUnderscore: 'allow',\n filter: {\n regex:\n String.raw`^_|[- /?:{}@%]|Provider|Mui|Comp|^item$|^condition$|^container$|^Container$|^\\d+$`,\n match: false,\n },\n },\n {\n selector: 'variableLike',\n format: ['camelCase', 'UPPER_CASE'],\n trailingUnderscore: 'allow',\n filter: { regex: '^_|Comp|Container|Provider|Stack|Root', match: false },\n },\n {\n selector: 'variable',\n format: ['camelCase', 'PascalCase'],\n types: ['function'],\n filter: { regex: '^_|Comp|Provider|Stack', match: false },\n },\n {\n selector: 'typeLike',\n format: ['PascalCase'],\n filter: { regex: '^_|_$', match: false },\n },\n {\n selector: ['variable', 'property', 'parameter', 'typeProperty'],\n types: ['boolean'],\n format: ['UPPER_CASE', 'PascalCase'],\n prefix: booleanNamePrefixes,\n filter: { regex: booleanNameExceptions, match: false },\n },\n ],\n\n // TS type safety and preferences\n '@typescript-eslint/no-explicit-any': ['warn', { fixToUnknown: true }],\n '@typescript-eslint/no-inferrable-types': ['warn', { ignoreParameters: true }],\n '@typescript-eslint/no-shadow': 'error',\n '@typescript-eslint/no-unsafe-enum-comparison': 'off',\n '@typescript-eslint/no-base-to-string': 'off',\n '@typescript-eslint/prefer-nullish-coalescing': [\n 'warn',\n { ignorePrimitives: { string: true } },\n ],\n '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',\n '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',\n '@typescript-eslint/no-extra-non-null-assertion': 'error',\n '@typescript-eslint/no-confusing-non-null-assertion': 'error',\n '@typescript-eslint/ban-ts-comment': [\n 'error',\n { 'ts-expect-error': 'allow-with-description', 'ts-ignore': 'allow-with-description' },\n ],\n '@typescript-eslint/no-empty-object-type': 'warn',\n '@typescript-eslint/no-unsafe-function-type': 'warn',\n '@typescript-eslint/no-wrapper-object-types': 'warn',\n '@typescript-eslint/array-type': ['warn', { default: 'array' }],\n '@stylistic/array-element-newline': ['warn', { multiline: true, consistent: true }],\n '@stylistic/array-bracket-newline': ['warn', 'consistent'],\n '@stylistic/no-mixed-operators': ['warn', { allowSamePrecedence: true }],\n '@stylistic/rest-spread-spacing': ['warn', 'never'],\n '@typescript-eslint/no-unnecessary-condition': 'warn',\n '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn',\n\n // TS consistency\n '@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],\n '@typescript-eslint/consistent-type-assertions': [\n 'error',\n { assertionStyle: 'as' },\n ],\n '@typescript-eslint/consistent-type-definitions': ['error', 'type'],\n '@typescript-eslint/consistent-type-exports': 'error',\n '@typescript-eslint/method-signature-style': 'error',\n\n // Expressions and async\n '@typescript-eslint/no-confusing-void-expression': [\n 'error',\n { ignoreArrowShorthand: true },\n ],\n '@typescript-eslint/no-invalid-void-type': 'off',\n '@typescript-eslint/no-meaningless-void-operator': 'error',\n '@typescript-eslint/no-misused-promises': 'off',\n '@typescript-eslint/no-var-requires': 'off',\n\n // TS modern prefs\n '@typescript-eslint/prefer-includes': 'error',\n '@typescript-eslint/prefer-optional-chain': 'error',\n '@typescript-eslint/prefer-reduce-type-parameter': 'error',\n '@typescript-eslint/prefer-string-starts-ends-with': 'error',\n\n // --- Comment Formatting Rules ---\n 'spaced-comment': 'off',\n '@stylistic/spaced-comment': ['warn', 'always', { line: { markers: ['!', '?', '-', '**'] } }],\n\n // --- Unused Variables & Imports Rules ---\n 'no-unused-vars': 'off',\n '@stylistic/no-unused-vars': 'off',\n 'sonarjs/no-unused-vars': 'off',\n 'unused-imports/no-unused-imports': 'error',\n 'unused-imports/no-unused-vars': [\n 'warn',\n {\n vars: 'all',\n varsIgnorePattern: '^_',\n args: 'after-used',\n argsIgnorePattern: '^_',\n },\n ],\n\n // --- Banned API Rules ---\n 'ban/ban': [\n 'warn',\n {\n name: ['*', 'concat'],\n message:\n 'Imperative operation: prefer use ES6 spread, i.e. [...items, newItem]',\n },\n {\n name: ['Object', 'assign'],\n message: 'Use the spread operator `{...obj}` instead',\n },\n ],\n\n // --- Code Structure Restrictions ---\n // No loops rule\n 'no-loops/no-loops': 'error',\n\n // Syntax restrictions\n 'no-restricted-syntax': [\n 'error',\n {\n selector: 'SwitchStatement',\n message:\n 'Switch statements are banned. Use `ts-pattern` instead.',\n },\n ],\n\n // --- ESLint Comments Rules ---\n '@eslint-community/eslint-comments/require-description': ['error', { ignore: ['eslint-enable'] }],\n\n // --- Testing Library Rules ---\n 'testing-library/no-render-in-lifecycle': ['error', { allowTestingFrameworkSetupHook: 'beforeEach' }],\n 'testing-library/no-unnecessary-act': 'off',\n\n // --- Import Rules ---\n // Commented out rules kept for reference\n // 'import/no-default-export': 'warn',\n // 'import/no-restricted-paths': ['warn', { zones: restrictedPaths }], // Define restrictedPaths\n 'import-x/no-named-as-default-member': 'off',\n 'import-x/no-absolute-path': 'warn',\n 'import-x/newline-after-import': 'warn',\n 'import-x/no-cycle': ['error', { maxDepth: 1, ignoreExternal: true }],\n 'import-x/order': ['warn',\n {\n groups: [\n 'builtin', // Node.js built-in modules\n 'external', // Packages from node_modules\n ['type', 'internal'], // Type imports, Absolute imports (often aliased like 'src/components')\n 'parent', // Relative imports from parent directories (../)\n 'sibling', // Relative imports from sibling directories (./)\n 'index', // Index file imports (./index.js)\n 'object', // Imports from object notation\n ],\n }],\n\n // --- Sort Rules ---\n 'sort/imports': 'off', // use 'import-x/order' rule instead\n 'sort/object-properties': 'off',\n 'sort/type-properties': 'warn',\n 'sort/string-unions': 'off',\n\n // --- Unicorn Rules ---\n 'unicorn/prefer-global-this': 'off',\n 'unicorn/prevent-abbreviations': 'off',\n 'unicorn/no-array-reduce': 'off',\n 'unicorn/no-array-for-each': 'off',\n 'unicorn/prefer-top-level-await': 'off',\n 'unicorn/no-array-callback-reference': 'off',\n 'unicorn/prefer-switch': 'off',\n 'unicorn/no-abusive-eslint-disable': 'off',\n 'unicorn/prefer-object-from-entries': 'off',\n 'unicorn/no-null': 'off',\n 'unicorn/filename-case': [\n 'warn',\n {\n cases: { camelCase: true, kebabCase: true },\n ignore: [/\\.(js|cjs)$/], // Keep ignoring JS/CJS if needed\n },\n ],\n 'unicorn/no-unused-properties': 'warn',\n 'unicorn/consistent-destructuring': 'warn',\n 'unicorn/no-useless-undefined': ['warn', { checkArguments: false }],\n\n // --- SonarJS Rules ---\n 'sonarjs/no-duplicated-branches': 'warn',\n 'sonarjs/no-duplicate-string': 'off',\n 'sonarjs/deprecation': 'off',\n 'sonarjs/cognitive-complexity': 'off', // use 'complexity' rule instead\n 'sonarjs/no-nested-functions': 'off', // use 'complexity' rule instead\n 'sonarjs/function-return-type': 'off', // use '@typescript-eslint/explicit-module-boundary-types' rule instead\n 'sonarjs/no-redundant-optional': 'off', // use '@typescript-eslint/no-redundant-optional' rule instead\n 'sonarjs/no-commented-code': 'off', // slow rule\n 'sonarjs/todo-tag': 'off', // eventually re-enable\n 'sonarjs/pseudo-random': 'off',\n 'sonarjs/different-types-comparison': 'off', // too many false positives\n 'sonarjs/redundant-type-aliases': 'off',\n 'sonarjs/void-use': 'off', // allow to annotate async functions not explicitly awaited\n 'sonarjs/no-nested-conditional': 'off', // use 'no-nested-ternary' rule instead\n 'sonarjs/no-hardcoded-passwords': 'off',\n },\n settings: {\n 'import-x/extensions': ['.js', '.cjs', '.mjs'],\n 'import-x/parsers': { 'typescript-eslint': ['.ts', '.tsx'] },\n 'import-x/resolver-next': [\n createTypeScriptImportResolver({\n alwaysTryTypes: true,\n bun: true,\n }),\n ],\n },\n },\n];\n\nexport default config;\n\n/* eslint-enable @typescript-eslint/no-magic-numbers */\n/* eslint-enable @typescript-eslint/naming-convention */\n","/**\n * Combines an array of regex expressions into a single regex expression via the union operator.\n */\nconst concatElementsByRegexUnion = (elements: string[]) =>\n elements.reduce((element, accum, index) => `${accum}${index === 0 ? '' : '|'}${element}`, '');\n\n// Prefixes allowed at the start of a boolean variable/parameter name\nexport const booleanNamePrefixes = [\n 'is',\n 'are',\n 'should',\n 'has',\n 'can',\n 'did',\n 'will',\n 'use',\n 'does',\n 'show',\n 'allow',\n 'enabled',\n 'enable',\n 'disable',\n 'editable',\n 'refetch',\n 'destructive',\n 'hide',\n 'error',\n 'override',\n];\n// Regex for the rest of a boolean variable/parameter name (the part after the prefix)\nconst booleanNameSuffixes = '[A-Z]([A-Za-z]?)+';\n// Exceptions to the rule for allowable boolean variable/parameter names\nconst booleanNameExceptionsList = [\n '^_',\n '_$',\n '[- /?:{}@%]',\n '^[A-Z][a-z]*([A-Z][a-z]*)',\n '^item$',\n '^value$',\n '^condition$',\n '^container$',\n '^included',\n '^center$',\n '^debug$',\n '^concurrent',\n '^animated$',\n '^allow',\n '^visible',\n '^merge$',\n '^multiSelect$',\n 'Shown$',\n '^enumerable$',\n '^configurable$',\n];\n// A singular regex string for the boolean name exceptions (instead of array of expressions)\nexport const booleanNameExceptions = concatElementsByRegexUnion(booleanNameExceptionsList);\n// The full boolean naming convetions regex\n\nexport const booleanNameConvention = new RegExp(\n `${concatElementsByRegexUnion(\n booleanNamePrefixes,\n )}|${booleanNameSuffixes}|${booleanNameExceptions}`,\n).toString();\n"],"mappings":";AAEA,OAAO,YAAY;AAEnB,OAAO,cAAc;AACrB,OAAO,eAAe;AACtB,SAAS,sCAAsC;AAC/C,OAAO,mBAAmB;AAC1B,OAAO,mBAAmB;AAC1B,OAAO,gBAAgB;AACvB,OAAO,0BAA0B;AACjC,OAAO,mBAAmB;AAC1B,OAAO,mBAAmB;AAC1B,OAAO,aAAa;AACpB,OAAO,cAAc;AAErB,OAAO,mBAAmB;AAE1B,OAAO,eAAe;;;ACftB,IAAM,6BAA6B,CAAC,aAClC,SAAS,OAAO,CAAC,SAAS,OAAO,UAAU,GAAG,KAAK,GAAG,UAAU,IAAI,KAAK,GAAG,GAAG,OAAO,IAAI,EAAE;AAGvF,IAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AA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Q,MAAM;AAAA,MAC7C,oBAAoB,EAAE,qBAAqB,CAAC,OAAO,MAAM,EAAE;AAAA,MAC3D,0BAA0B;AAAA,QACxB,+BAA+B;AAAA,UAC7B,gBAAgB;AAAA,UAChB,KAAK;AAAA,QACP,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@seanblonien/eslint-config-base",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Base ESLint flat config for JavaScript and TypeScript projects",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"keywords": [
|
|
18
|
+
"eslint",
|
|
19
|
+
"eslint-config",
|
|
20
|
+
"flat-config",
|
|
21
|
+
"javascript",
|
|
22
|
+
"typescript"
|
|
23
|
+
],
|
|
24
|
+
"author": "Sean Blonien",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"eslint": "^9.0.0",
|
|
28
|
+
"eslint-plugin-import": "^2.31.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
32
|
+
"@eslint/js": "^9.39.1",
|
|
33
|
+
"@stylistic/eslint-plugin": "^5.5.0",
|
|
34
|
+
"@types/node": "^24.10.1",
|
|
35
|
+
"eslint": "^9.39.1",
|
|
36
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
37
|
+
"eslint-plugin-ban": "^2.0.0",
|
|
38
|
+
"eslint-plugin-import-x": "^4.16.1",
|
|
39
|
+
"eslint-plugin-no-loops": "^0.4.0",
|
|
40
|
+
"eslint-plugin-sonarjs": "^3.0.5",
|
|
41
|
+
"eslint-plugin-sort": "^4.0.0",
|
|
42
|
+
"eslint-plugin-testing-library": "^7.13.4",
|
|
43
|
+
"eslint-plugin-unicorn": "^62.0.0",
|
|
44
|
+
"eslint-plugin-unused-imports": "^4.3.0",
|
|
45
|
+
"globals": "^16.5.0",
|
|
46
|
+
"jiti": "^2.6.1",
|
|
47
|
+
"tsup": "^8.5.1",
|
|
48
|
+
"typescript": "^5.9.3",
|
|
49
|
+
"typescript-eslint": "^8.46.4",
|
|
50
|
+
"vitest": "^4.0.9"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsup",
|
|
57
|
+
"clean": "rm -rf dist",
|
|
58
|
+
"lint": "eslint . --fix",
|
|
59
|
+
"test": "vitest run"
|
|
60
|
+
}
|
|
61
|
+
}
|