@freehour/eslint-rules 1.0.0

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 freehour
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,42 @@
1
+ ## ESLINT
2
+
3
+ ESLint rules for TypeScript projects.
4
+
5
+ ### Installation
6
+
7
+ ```bash
8
+ bun install -D eslint @freehour/eslint-rules
9
+ ```
10
+
11
+ ### Usage
12
+
13
+ Create an `eslint.config.ts` file in the root of your project with the following content:
14
+
15
+ ```ts
16
+ import { defineConfig } from 'eslint/config';
17
+ import { createConfig } from '@freehour/eslint-rules';
18
+
19
+ export default defineConfig(
20
+ await createConfig({
21
+ // node: true, // enable when targeting Node.js
22
+ // browser: true, // enable when targeting browsers
23
+ // react: true, // enable when using React
24
+ // stylistic: true, // enable to use stylistic rules
25
+ // imports: true, // enable to use import rules
26
+ }),
27
+ {
28
+ files: ['**/*.{ts,tsx}'],
29
+ },
30
+ );
31
+
32
+
33
+ ### Auto-fixing
34
+
35
+ You may also want to bind a shortcut to `eslint.executeAutofix`. Press F1, type `Preferences: Open Keyboard Shortcuts (JSON)` and add the following:
36
+
37
+ ```jsonc
38
+ {
39
+ "key": "shift+alt+e", // or any other keybinding
40
+ "command": "eslint.executeAutofix"
41
+ }
42
+ ```
@@ -0,0 +1,28 @@
1
+ import { Config } from 'eslint/config';
2
+ export interface ConfigOptions {
3
+ /**
4
+ * Enable when targeting Node.js.
5
+ */
6
+ node?: boolean;
7
+ /**
8
+ * Enable when targeting browsers.
9
+ */
10
+ browser?: boolean;
11
+ /**
12
+ * Enable when using React.
13
+ * Requires `eslint-plugin-react` to be installed.
14
+ */
15
+ react?: boolean;
16
+ /**
17
+ * Enable to use stylistic rules.
18
+ * Requires `@stylistic/eslint-plugin` to be installed.
19
+ */
20
+ stylistic?: boolean;
21
+ /**
22
+ * Enable to use import rules.
23
+ * Requires `eslint-plugin-import-x` and `eslint-import-resolver-typescript` to be installed.
24
+ */
25
+ imports?: boolean;
26
+ }
27
+ export declare function createConfig({ node, browser, react, stylistic, imports, }?: ConfigOptions): Promise<Config>;
28
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../lib/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAU5C,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAsB,YAAY,CAAC,EAC/B,IAAY,EACZ,OAAe,EACf,KAAa,EACb,SAAiB,EACjB,OAAe,GAClB,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAikCtC"}
@@ -0,0 +1,2 @@
1
+ export * from './config';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,790 @@
1
+ import { createTypeScriptImportResolver as e } from "eslint-import-resolver-typescript";
2
+ import t from "globals";
3
+ import n from "typescript-eslint";
4
+ import r from "eslint-plugin-react";
5
+ import i from "eslint-plugin-react-hooks";
6
+ import a from "eslint-plugin-react-refresh";
7
+ import o from "@stylistic/eslint-plugin";
8
+ import s from "eslint-plugin-import-x";
9
+ //#region lib/config.ts
10
+ async function c({ node: c = !1, browser: l = !1, react: u = !1, stylistic: d = !1, imports: f = !1 } = {}) {
11
+ return {
12
+ languageOptions: {
13
+ ecmaVersion: "latest",
14
+ sourceType: "module",
15
+ parserOptions: {
16
+ projectService: !0,
17
+ ...u && { ecmaFeatures: { jsx: !0 } }
18
+ },
19
+ parser: n.parser,
20
+ globals: {
21
+ ...l && t.browser,
22
+ ...c && t.nodeBuiltin
23
+ }
24
+ },
25
+ settings: {
26
+ ...f && { "import-x/resolver-next": [e({ alwaysTryTypes: !0 })] },
27
+ ...u && { react: { version: "detect" } }
28
+ },
29
+ plugins: {
30
+ "@typescript-eslint": n.plugin,
31
+ ...u && {
32
+ react: r,
33
+ "react-hooks": i,
34
+ "react-refresh": a
35
+ },
36
+ ...d && { "@stylistic": o },
37
+ ...f && { "import-x": s }
38
+ },
39
+ rules: {
40
+ "array-callback-return": "error",
41
+ "constructor-super": "error",
42
+ "for-direction": "error",
43
+ "getter-return": "error",
44
+ "no-async-promise-executor": "error",
45
+ "no-await-in-loop": "off",
46
+ "no-class-assign": "error",
47
+ "no-compare-neg-zero": "error",
48
+ "no-cond-assign": "error",
49
+ "no-const-assign": "off",
50
+ "no-constant-binary-expression": "warn",
51
+ "no-constant-condition": "error",
52
+ "no-constructor-return": "error",
53
+ "no-control-regex": "error",
54
+ "no-debugger": "error",
55
+ "no-dupe-args": "error",
56
+ "no-dupe-class-members": "error",
57
+ "no-dupe-else-if": "error",
58
+ "no-dupe-keys": "error",
59
+ "no-duplicate-case": "error",
60
+ "no-duplicate-imports": "off",
61
+ "no-empty-character-class": "error",
62
+ "no-empty-pattern": "error",
63
+ "no-ex-assign": "error",
64
+ "no-fallthrough": "off",
65
+ "no-func-assign": "error",
66
+ "no-import-assign": "error",
67
+ "no-inner-declarations": "error",
68
+ "no-invalid-regexp": "error",
69
+ "no-irregular-whitespace": "error",
70
+ "no-loss-of-precision": "error",
71
+ "no-misleading-character-class": "error",
72
+ "no-new-native-nonconstructor": "error",
73
+ "no-obj-calls": "error",
74
+ "no-promise-executor-return": ["error", { allowVoid: !0 }],
75
+ "no-prototype-builtins": "error",
76
+ "no-self-assign": "error",
77
+ "no-self-compare": "warn",
78
+ "no-setter-return": "error",
79
+ "no-sparse-arrays": "error",
80
+ "no-template-curly-in-string": "warn",
81
+ "no-this-before-super": "error",
82
+ "no-undef": "error",
83
+ "no-unexpected-multiline": "error",
84
+ "no-unmodified-loop-condition": "error",
85
+ "no-unreachable": "error",
86
+ "no-unreachable-loop": "warn",
87
+ "no-unsafe-finally": "error",
88
+ "no-unsafe-negation": "error",
89
+ "no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: !0 }],
90
+ "no-unused-private-class-members": "error",
91
+ "no-unused-vars": ["warn", { args: "none" }],
92
+ "no-use-before-define": ["warn", {
93
+ functions: !1,
94
+ classes: !1,
95
+ variables: !0,
96
+ allowNamedExports: !1
97
+ }],
98
+ "no-useless-backreference": "warn",
99
+ "require-atomic-updates": "warn",
100
+ "use-isnan": "error",
101
+ "valid-typeof": "error",
102
+ "accessor-pairs": "error",
103
+ "arrow-body-style": "warn",
104
+ "block-scoped-var": "error",
105
+ camelcase: "off",
106
+ "capitalized-comments": "off",
107
+ "class-methods-use-this": "off",
108
+ complexity: "off",
109
+ "consistent-return": "off",
110
+ "consistent-this": "off",
111
+ curly: "error",
112
+ "default-case": "off",
113
+ "default-case-last": "error",
114
+ "default-param-last": "error",
115
+ "dot-notation": "error",
116
+ eqeqeq: ["error", "always"],
117
+ "func-name-matching": "off",
118
+ "func-names": "off",
119
+ "func-style": "off",
120
+ "grouped-accessor-pairs": "off",
121
+ "guard-for-in": "error",
122
+ "id-denylist": "off",
123
+ "id-length": "off",
124
+ "id-match": "off",
125
+ "init-declarations": "error",
126
+ "logical-assignment-operators": "off",
127
+ "max-classes-per-file": "off",
128
+ "max-depth": "off",
129
+ "max-lines": "off",
130
+ "max-lines-per-function": "off",
131
+ "max-nested-callbacks": "off",
132
+ "max-params": "off",
133
+ "max-statements": "off",
134
+ "new-cap": "off",
135
+ "no-alert": "error",
136
+ "no-array-constructor": "error",
137
+ "no-bitwise": "off",
138
+ "no-caller": "error",
139
+ "no-case-declarations": "error",
140
+ "no-console": "off",
141
+ "no-continue": "off",
142
+ "no-delete-var": "error",
143
+ "no-div-regex": "off",
144
+ "no-else-return": ["error", { allowElseIf: !1 }],
145
+ "no-empty": "off",
146
+ "no-empty-function": "off",
147
+ "no-empty-static-block": "off",
148
+ "no-eq-null": "off",
149
+ "no-eval": "error",
150
+ "no-extend-native": "off",
151
+ "no-extra-bind": "error",
152
+ "no-extra-boolean-cast": "error",
153
+ "no-extra-label": "error",
154
+ "no-global-assign": "error",
155
+ "no-implicit-coercion": "error",
156
+ "no-implicit-globals": "off",
157
+ "no-implied-eval": "error",
158
+ "no-inline-comments": "off",
159
+ "no-invalid-this": "off",
160
+ "no-iterator": "error",
161
+ "no-label-var": "error",
162
+ "no-labels": "off",
163
+ "no-lone-blocks": "off",
164
+ "no-lonely-if": "warn",
165
+ "no-loop-func": "warn",
166
+ "no-magic-numbers": "off",
167
+ "no-multi-assign": "off",
168
+ "no-multi-str": "error",
169
+ "no-negated-condition": "off",
170
+ "no-nested-ternary": "off",
171
+ "no-new": "error",
172
+ "no-new-func": "error",
173
+ "no-new-wrappers": "error",
174
+ "no-nonoctal-decimal-escape": "error",
175
+ "no-object-constructor": "error",
176
+ "no-octal": "error",
177
+ "no-octal-escape": "error",
178
+ "no-param-reassign": "off",
179
+ "no-plusplus": "off",
180
+ "no-proto": "error",
181
+ "no-redeclare": "off",
182
+ "no-regex-spaces": "warn",
183
+ "no-restricted-exports": "off",
184
+ "no-restricted-globals": "off",
185
+ "no-restricted-imports": "error",
186
+ "no-restricted-properties": "off",
187
+ "no-restricted-syntax": "off",
188
+ "no-return-assign": "off",
189
+ "no-script-url": "error",
190
+ "no-sequences": "off",
191
+ "no-shadow": "off",
192
+ "no-shadow-restricted-names": "error",
193
+ "no-ternary": "off",
194
+ "no-throw-literal": "error",
195
+ "no-undef-init": "off",
196
+ "no-undefined": "off",
197
+ "no-underscore-dangle": "off",
198
+ "no-unneeded-ternary": "warn",
199
+ "no-unused-expressions": "warn",
200
+ "no-unused-labels": "error",
201
+ "no-useless-call": "off",
202
+ "no-useless-catch": "error",
203
+ "no-useless-computed-key": "warn",
204
+ "no-useless-concat": "warn",
205
+ "no-useless-constructor": "warn",
206
+ "no-useless-escape": "warn",
207
+ "no-useless-rename": "error",
208
+ "no-useless-return": "error",
209
+ "no-var": "error",
210
+ "no-void": "off",
211
+ "no-warning-comments": "off",
212
+ "no-with": "error",
213
+ "object-shorthand": "off",
214
+ "one-var": "off",
215
+ "operator-assignment": "off",
216
+ "prefer-arrow-callback": "off",
217
+ "prefer-const": "error",
218
+ "prefer-destructuring": "off",
219
+ "prefer-exponentiation-operator": "off",
220
+ "prefer-named-capture-group": "off",
221
+ "prefer-numeric-literals": "off",
222
+ "prefer-object-has-own": "off",
223
+ "prefer-object-spread": "warn",
224
+ "prefer-promise-reject-errors": "error",
225
+ "prefer-regex-literals": "off",
226
+ "prefer-rest-params": "warn",
227
+ "prefer-spread": "warn",
228
+ "prefer-template": "warn",
229
+ "preserve-caught-error": "error",
230
+ radix: "off",
231
+ "require-await": "error",
232
+ "require-unicode-regexp": "off",
233
+ "require-yield": "error",
234
+ "sort-imports": "off",
235
+ "sort-keys": "off",
236
+ "sort-vars": "off",
237
+ strict: "off",
238
+ "symbol-description": "off",
239
+ "vars-on-top": "off",
240
+ yoda: [
241
+ "warn",
242
+ "never",
243
+ { exceptRange: !0 }
244
+ ],
245
+ "unicode-bom": "error",
246
+ "class-methods-use-this": "off",
247
+ "consistent-return": "off",
248
+ "default-param-last": "off",
249
+ "dot-notation": "off",
250
+ "init-declarations": "off",
251
+ "max-params": "off",
252
+ "no-array-constructor": "off",
253
+ "no-dupe-class-members": "off",
254
+ "no-empty-function": "off",
255
+ "no-implied-eval": "off",
256
+ "no-invalid-this": "off",
257
+ "no-loop-func": "off",
258
+ "no-magic-numbers": "off",
259
+ "no-redeclare": "off",
260
+ "no-restricted-imports": "off",
261
+ "no-shadow": "off",
262
+ "no-undef": "off",
263
+ "no-unused-expressions": "off",
264
+ "no-unused-private-class-members": "off",
265
+ "no-unused-vars": "off",
266
+ "no-use-before-define": "off",
267
+ "no-useless-constructor": "off",
268
+ "no-throw-literal": "off",
269
+ "prefer-destructuring": "off",
270
+ "prefer-promise-reject-errors": "off",
271
+ "require-await": "off",
272
+ "@typescript-eslint/adjacent-overload-signatures": "warn",
273
+ "@typescript-eslint/array-type": "warn",
274
+ "@typescript-eslint/await-thenable": "error",
275
+ "@typescript-eslint/ban-ts-comment": "error",
276
+ "@typescript-eslint/ban-tslint-comment": "error",
277
+ "@typescript-eslint/class-literal-property-style": "warn",
278
+ "@typescript-eslint/class-methods-use-this": "off",
279
+ "@typescript-eslint/consistent-generic-constructors": "warn",
280
+ "@typescript-eslint/consistent-indexed-object-style": "warn",
281
+ "@typescript-eslint/consistent-return": "off",
282
+ "@typescript-eslint/consistent-type-assertions": "warn",
283
+ "@typescript-eslint/consistent-type-definitions": "warn",
284
+ "@typescript-eslint/consistent-type-exports": "warn",
285
+ "@typescript-eslint/consistent-type-imports": "warn",
286
+ "@typescript-eslint/default-param-last": "error",
287
+ "@typescript-eslint/dot-notation": "error",
288
+ "@typescript-eslint/explicit-function-return-type": ["warn", {
289
+ allowExpressions: !0,
290
+ allowConciseArrowFunctionExpressionsStartingWithVoid: !0
291
+ }],
292
+ "@typescript-eslint/explicit-member-accessibility": ["warn", { accessibility: "no-public" }],
293
+ "@typescript-eslint/explicit-module-boundary-types": "error",
294
+ "@typescript-eslint/init-declarations": "error",
295
+ "@typescript-eslint/max-params": "off",
296
+ "@typescript-eslint/member-ordering": "off",
297
+ "@typescript-eslint/method-signature-style": "warn",
298
+ "@typescript-eslint/naming-convention": "off",
299
+ "@typescript-eslint/no-array-constructor": "error",
300
+ "@typescript-eslint/no-array-delete": "error",
301
+ "@typescript-eslint/no-base-to-string": "warn",
302
+ "@typescript-eslint/no-confusing-non-null-assertion": "warn",
303
+ "@typescript-eslint/no-confusing-void-expression": ["warn", { ignoreArrowShorthand: !0 }],
304
+ "@typescript-eslint/no-deprecated": "warn",
305
+ "@typescript-eslint/no-dupe-class-members": "off",
306
+ "@typescript-eslint/no-duplicate-enum-values": "warn",
307
+ "@typescript-eslint/no-duplicate-type-constituents": "warn",
308
+ "@typescript-eslint/no-dynamic-delete": "warn",
309
+ "@typescript-eslint/no-empty-function": "off",
310
+ "@typescript-eslint/no-empty-object-type": ["warn", { allowInterfaces: "always" }],
311
+ "@typescript-eslint/no-explicit-any": "off",
312
+ "@typescript-eslint/no-extra-non-null-assertion": "error",
313
+ "@typescript-eslint/no-extraneous-class": "warn",
314
+ "@typescript-eslint/no-floating-promises": "error",
315
+ "@typescript-eslint/no-for-in-array": "error",
316
+ "@typescript-eslint/no-implied-eval": "error",
317
+ "@typescript-eslint/no-import-type-side-effects": "warn",
318
+ "@typescript-eslint/no-inferrable-types": "warn",
319
+ "@typescript-eslint/no-invalid-this": "off",
320
+ "@typescript-eslint/no-invalid-void-type": "warn",
321
+ "@typescript-eslint/no-loop-func": "warn",
322
+ "@typescript-eslint/no-magic-numbers": "off",
323
+ "@typescript-eslint/no-meaningless-void-operator": "warn",
324
+ "@typescript-eslint/no-misused-new": "error",
325
+ "@typescript-eslint/no-misused-promises": "error",
326
+ "@typescript-eslint/no-misused-spread": "error",
327
+ "@typescript-eslint/no-mixed-enums": "warn",
328
+ "@typescript-eslint/no-namespace": "error",
329
+ "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "warn",
330
+ "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
331
+ "@typescript-eslint/no-non-null-assertion": "error",
332
+ "@typescript-eslint/no-redeclare": "off",
333
+ "@typescript-eslint/no-redundant-type-constituents": "warn",
334
+ "@typescript-eslint/no-require-imports": "warn",
335
+ "@typescript-eslint/no-restricted-imports": "error",
336
+ "@typescript-eslint/no-restricted-types": "off",
337
+ "@typescript-eslint/no-shadow": "off",
338
+ "@typescript-eslint/no-this-alias": "error",
339
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
340
+ "@typescript-eslint/no-unnecessary-condition": ["warn", { allowConstantLoopConditions: !0 }],
341
+ "@typescript-eslint/no-unnecessary-parameter-property-assignment": "error",
342
+ "@typescript-eslint/no-unnecessary-qualifier": "warn",
343
+ "@typescript-eslint/no-unnecessary-template-expression": "warn",
344
+ "@typescript-eslint/no-unnecessary-type-arguments": "warn",
345
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
346
+ "@typescript-eslint/no-unnecessary-type-constraint": "error",
347
+ "@typescript-eslint/no-unnecessary-type-conversion": "error",
348
+ "@typescript-eslint/no-unnecessary-type-parameters": "error",
349
+ "@typescript-eslint/no-unsafe-argument": "off",
350
+ "@typescript-eslint/no-unsafe-assignment": "off",
351
+ "@typescript-eslint/no-unsafe-call": "off",
352
+ "@typescript-eslint/no-unsafe-declaration-merging": "error",
353
+ "@typescript-eslint/no-unsafe-enum-comparison": "off",
354
+ "@typescript-eslint/no-unsafe-function-type": "warn",
355
+ "@typescript-eslint/no-unsafe-member-access": "off",
356
+ "@typescript-eslint/no-unsafe-return": "off",
357
+ "@typescript-eslint/no-unsafe-unary-minus": "error",
358
+ "@typescript-eslint/no-unused-expressions": "warn",
359
+ "@typescript-eslint/no-unused-private-class-members": "warn",
360
+ "@typescript-eslint/no-unused-vars": ["warn", {
361
+ args: "none",
362
+ enableAutofixRemoval: { imports: !0 }
363
+ }],
364
+ "@typescript-eslint/no-use-before-define": ["warn", {
365
+ functions: !1,
366
+ classes: !1,
367
+ variables: !0,
368
+ allowNamedExports: !1
369
+ }],
370
+ "@typescript-eslint/no-useless-constructor": "warn",
371
+ "@typescript-eslint/no-useless-empty-export": "warn",
372
+ "@typescript-eslint/no-wrapper-object-types": "error",
373
+ "@typescript-eslint/non-nullable-type-assertion-style": "warn",
374
+ "@typescript-eslint/only-throw-error": ["error", { allowRethrowing: !0 }],
375
+ "@typescript-eslint/parameter-properties": "warn",
376
+ "@typescript-eslint/prefer-as-const": "error",
377
+ "@typescript-eslint/prefer-destructuring": "off",
378
+ "@typescript-eslint/prefer-enum-initializers": "off",
379
+ "@typescript-eslint/prefer-find": "warn",
380
+ "@typescript-eslint/prefer-for-of": "warn",
381
+ "@typescript-eslint/prefer-function-type": "warn",
382
+ "@typescript-eslint/prefer-includes": "warn",
383
+ "@typescript-eslint/prefer-literal-enum-member": "off",
384
+ "@typescript-eslint/prefer-namespace-keyword": "error",
385
+ "@typescript-eslint/prefer-nullish-coalescing": "error",
386
+ "@typescript-eslint/prefer-optional-chain": "error",
387
+ "@typescript-eslint/prefer-promise-reject-errors": "error",
388
+ "@typescript-eslint/prefer-readonly": "warn",
389
+ "@typescript-eslint/prefer-readonly-parameter-types": "off",
390
+ "@typescript-eslint/prefer-reduce-type-parameter": "warn",
391
+ "@typescript-eslint/prefer-regexp-exec": "warn",
392
+ "@typescript-eslint/prefer-return-this-type": "warn",
393
+ "@typescript-eslint/prefer-string-starts-ends-with": "warn",
394
+ "@typescript-eslint/promise-function-async": "warn",
395
+ "@typescript-eslint/related-getter-setter-pairs": "error",
396
+ "@typescript-eslint/require-array-sort-compare": "warn",
397
+ "@typescript-eslint/require-await": "error",
398
+ "@typescript-eslint/restrict-plus-operands": "off",
399
+ "@typescript-eslint/restrict-template-expressions": "off",
400
+ "@typescript-eslint/return-await": ["error", "in-try-catch"],
401
+ "@typescript-eslint/strict-boolean-expressions": "warn",
402
+ "@typescript-eslint/strict-void-return": "error",
403
+ "@typescript-eslint/switch-exhaustiveness-check": "warn",
404
+ "@typescript-eslint/triple-slash-reference": "error",
405
+ "@typescript-eslint/unbound-method": ["error", { ignoreStatic: !0 }],
406
+ "@typescript-eslint/unified-signatures": "warn",
407
+ "@typescript-eslint/use-unknown-in-catch-callback-variable": "off",
408
+ ...d && {
409
+ "@stylistic/array-bracket-newline": "warn",
410
+ "@stylistic/array-bracket-spacing": "warn",
411
+ "@stylistic/array-element-newline": ["warn", "consistent"],
412
+ "@stylistic/arrow-parens": ["warn", "as-needed"],
413
+ "@stylistic/arrow-spacing": "warn",
414
+ "@stylistic/block-spacing": "warn",
415
+ "@stylistic/brace-style": "warn",
416
+ "@stylistic/comma-dangle": ["warn", {
417
+ arrays: "always-multiline",
418
+ objects: "always-multiline",
419
+ imports: "always-multiline",
420
+ exports: "always-multiline",
421
+ functions: "always-multiline"
422
+ }],
423
+ "@stylistic/comma-spacing": "warn",
424
+ "@stylistic/comma-style": "warn",
425
+ "@stylistic/computed-property-spacing": "warn",
426
+ "@stylistic/dot-location": ["warn", "property"],
427
+ "@stylistic/eol-last": "warn",
428
+ "@stylistic/function-call-argument-newline": ["warn", "consistent"],
429
+ "@stylistic/function-call-spacing": "warn",
430
+ "@stylistic/function-paren-newline": ["warn", "multiline-arguments"],
431
+ "@stylistic/generator-star-spacing": "warn",
432
+ "@stylistic/implicit-arrow-linebreak": "warn",
433
+ "@stylistic/indent": ["warn", 4],
434
+ "@stylistic/indent-binary-ops": ["warn", 4],
435
+ "@stylistic/jsx-child-element-spacing": "warn",
436
+ "@stylistic/jsx-closing-bracket-location": "warn",
437
+ "@stylistic/jsx-closing-tag-location": "warn",
438
+ "@stylistic/jsx-curly-brace-presence": ["warn", {
439
+ props: "never",
440
+ children: "never",
441
+ propElementValues: "always"
442
+ }],
443
+ "@stylistic/jsx-curly-newline": "warn",
444
+ "@stylistic/jsx-curly-spacing": "warn",
445
+ "@stylistic/jsx-equals-spacing": "warn",
446
+ "@stylistic/jsx-first-prop-new-line": ["warn", "multiline"],
447
+ "@stylistic/jsx-function-call-newline": "warn",
448
+ "@stylistic/jsx-indent-props": "warn",
449
+ "@stylistic/jsx-max-props-per-line": ["warn", {
450
+ maximum: 1,
451
+ when: "multiline"
452
+ }],
453
+ "@stylistic/jsx-newline": ["warn", { prevent: !0 }],
454
+ "@stylistic/jsx-one-expression-per-line": ["warn", { allow: "single-child" }],
455
+ "@stylistic/jsx-pascal-case": "warn",
456
+ "@stylistic/exp-jsx-props-style": ["warn", { singleLine: { maxItems: 1 } }],
457
+ "@stylistic/jsx-quotes": "warn",
458
+ "@stylistic/jsx-self-closing-comp": "warn",
459
+ "@stylistic/jsx-tag-spacing": "warn",
460
+ "@stylistic/jsx-wrap-multilines": ["warn", {
461
+ declaration: "parens-new-line",
462
+ assignment: "parens-new-line",
463
+ return: "parens-new-line",
464
+ arrow: "parens-new-line",
465
+ condition: "parens-new-line",
466
+ logical: "parens-new-line",
467
+ prop: "parens-new-line"
468
+ }],
469
+ "@stylistic/key-spacing": "warn",
470
+ "@stylistic/keyword-spacing": "warn",
471
+ "@stylistic/line-comment-position": "off",
472
+ "@stylistic/linebreak-style": "warn",
473
+ "@stylistic/lines-around-comment": ["warn", {
474
+ allowArrayStart: !0,
475
+ allowBlockStart: !0,
476
+ allowClassStart: !0,
477
+ allowObjectStart: !0
478
+ }],
479
+ "@stylistic/lines-between-class-members": [
480
+ "warn",
481
+ "always",
482
+ { exceptAfterSingleLine: !0 }
483
+ ],
484
+ "@stylistic/exp-list-style": "warn",
485
+ "@stylistic/max-len": "off",
486
+ "@stylistic/max-statements-per-line": "warn",
487
+ "@stylistic/member-delimiter-style": "warn",
488
+ "@stylistic/multiline-comment-style": "off",
489
+ "@stylistic/multiline-ternary": ["warn", "always-multiline"],
490
+ "@stylistic/new-parens": "warn",
491
+ "@stylistic/newline-per-chained-call": "warn",
492
+ "@stylistic/no-confusing-arrow": "off",
493
+ "@stylistic/no-extra-parens": [
494
+ "warn",
495
+ "all",
496
+ {
497
+ ignoreJSX: "all",
498
+ nestedBinaryExpressions: !1,
499
+ ignoredNodes: ["ArrowFunctionExpression[body.type=ConditionalExpression]"]
500
+ }
501
+ ],
502
+ "@stylistic/no-extra-semi": "warn",
503
+ "@stylistic/no-floating-decimal": "warn",
504
+ "@stylistic/no-mixed-operators": "warn",
505
+ "@stylistic/no-mixed-spaces-and-tabs": "error",
506
+ "@stylistic/no-multi-spaces": ["warn", { ignoreEOLComments: !0 }],
507
+ "@stylistic/no-multiple-empty-lines": ["warn", {
508
+ max: 2,
509
+ maxEOF: 1
510
+ }],
511
+ "@stylistic/no-tabs": "error",
512
+ "@stylistic/no-trailing-spaces": "warn",
513
+ "@stylistic/no-whitespace-before-property": "warn",
514
+ "@stylistic/nonblock-statement-body-position": "off",
515
+ "@stylistic/object-curly-newline": ["warn", {
516
+ ObjectExpression: {
517
+ multiline: !0,
518
+ consistent: !0
519
+ },
520
+ ObjectPattern: {
521
+ multiline: !0,
522
+ consistent: !0
523
+ },
524
+ ImportDeclaration: {
525
+ multiline: !0,
526
+ consistent: !0
527
+ },
528
+ ExportDeclaration: {
529
+ multiline: !0,
530
+ consistent: !0
531
+ }
532
+ }],
533
+ "@stylistic/object-curly-spacing": ["warn", "always"],
534
+ "@stylistic/object-property-newline": ["warn", { allowAllPropertiesOnSameLine: !0 }],
535
+ "@stylistic/one-var-declaration-per-line": "warn",
536
+ "@stylistic/operator-linebreak": ["warn", "before"],
537
+ "@stylistic/padded-blocks": "off",
538
+ "@stylistic/padding-line-between-statements": ["warn", {
539
+ blankLine: "always",
540
+ prev: ["class", "function"],
541
+ next: "*"
542
+ }],
543
+ "@stylistic/quote-props": ["warn", "consistent-as-needed"],
544
+ "@stylistic/quotes": ["warn", "single"],
545
+ "@stylistic/rest-spread-spacing": "warn",
546
+ "@stylistic/semi": "warn",
547
+ "@stylistic/semi-spacing": "warn",
548
+ "@stylistic/semi-style": "warn",
549
+ "@stylistic/space-before-blocks": "warn",
550
+ "@stylistic/space-before-function-paren": ["warn", {
551
+ anonymous: "never",
552
+ named: "never",
553
+ asyncArrow: "always"
554
+ }],
555
+ "@stylistic/space-in-parens": "warn",
556
+ "@stylistic/space-infix-ops": "warn",
557
+ "@stylistic/space-unary-ops": "warn",
558
+ "@stylistic/spaced-comment": "warn",
559
+ "@stylistic/switch-colon-spacing": "warn",
560
+ "@stylistic/template-curly-spacing": "warn",
561
+ "@stylistic/template-tag-spacing": "warn",
562
+ "@stylistic/type-annotation-spacing": "warn",
563
+ "@stylistic/type-generic-spacing": "warn",
564
+ "@stylistic/type-named-tuple-spacing": "warn",
565
+ "@stylistic/wrap-iife": "warn",
566
+ "@stylistic/wrap-regex": "off",
567
+ "@stylistic/yield-star-spacing": "off"
568
+ },
569
+ ...f && {
570
+ "no-duplicate-imports": "off",
571
+ "import-x/export": "error",
572
+ "import-x/no-deprecated": "warn",
573
+ "import-x/no-empty-named-blocks": "warn",
574
+ "import-x/no-extraneous-dependencies": "warn",
575
+ "import-x/no-mutable-exports": "warn",
576
+ "import-x/no-named-as-default": "warn",
577
+ "import-x/no-named-as-default-member": "off",
578
+ "import-x/no-rename-default": "off",
579
+ "import-x/no-unused-modules": "off",
580
+ "import-x/no-amd": "error",
581
+ "import-x/no-commonjs": "error",
582
+ "import-x/no-import-module-exports": "error",
583
+ "import-x/no-nodejs-modules": l && !c ? "error" : "off",
584
+ "import-x/unambiguous": "error",
585
+ "import-x/default": "error",
586
+ "import-x/named": "off",
587
+ "import-x/namespace": "error",
588
+ "import-x/no-absolute-path": "error",
589
+ "import-x/no-cycle": "error",
590
+ "import-x/no-dynamic-require": "warn",
591
+ "import-x/no-internal-modules": "off",
592
+ "import-x/no-relative-packages": "warn",
593
+ "import-x/no-relative-parent-imports": "off",
594
+ "import-x/no-restricted-paths": "off",
595
+ "import-x/no-self-import": "warn",
596
+ "import-x/no-unresolved": "error",
597
+ "import-x/no-useless-path-segments": "warn",
598
+ "import-x/no-webpack-loader-syntax": "error",
599
+ "import-x/consistent-type-specifier-style": ["warn", "prefer-top-level"],
600
+ "import-x/dynamic-import-chunkname": "off",
601
+ "import-x/exports-last": "off",
602
+ "import-x/extensions": ["warn", {
603
+ json: "always",
604
+ fix: !0
605
+ }],
606
+ "import-x/first": "warn",
607
+ "import-x/group-exports": "off",
608
+ "import-x/max-dependencies": "off",
609
+ "import-x/newline-after-import": ["warn", {
610
+ count: 2,
611
+ considerComments: !1
612
+ }],
613
+ "import-x/no-anonymous-default-export": "off",
614
+ "import-x/no-default-export": "off",
615
+ "import-x/no-duplicates": "warn",
616
+ "import-x/no-named-default": "warn",
617
+ "import-x/no-named-export": "off",
618
+ "import-x/no-namespace": "off",
619
+ "import-x/no-unassigned-import": "off",
620
+ "import-x/order": "off",
621
+ "import-x/prefer-default-export": "off",
622
+ "import-x/prefer-namespace-import": "off"
623
+ },
624
+ ...u && {
625
+ ...d && {
626
+ "@stylistic/jsx-child-element-spacing": "off",
627
+ "@stylistic/jsx-closing-bracket-location": "off",
628
+ "@stylistic/jsx-closing-tag-location": "off",
629
+ "@stylistic/jsx-curly-brace-presence": "off",
630
+ "@stylistic/jsx-curly-newline": "off",
631
+ "@stylistic/jsx-curly-spacing": "off",
632
+ "@stylistic/jsx-equals-spacing": "off",
633
+ "@stylistic/jsx-first-prop-new-line": "off",
634
+ "@stylistic/jsx-indent": "off",
635
+ "@stylistic/jsx-indent-props": "off",
636
+ "@stylistic/jsx-max-props-per-line": "off",
637
+ "@stylistic/jsx-newline": "off",
638
+ "@stylistic/jsx-one-expression-per-line": "off",
639
+ "@stylistic/jsx-pascal-case": "off",
640
+ "@stylistic/jsx-props-no-multi-spaces": "off",
641
+ "@stylistic/jsx-sort-props": "off",
642
+ "@stylistic/jsx-tag-spacing": "off"
643
+ },
644
+ "react/boolean-prop-naming": "off",
645
+ "react/button-has-type": "warn",
646
+ "react/checked-requires-onchange-or-readonly": "warn",
647
+ "react/default-props-match-prop-types": "off",
648
+ "react/destructuring-assignment": "off",
649
+ "react/display-name": "warn",
650
+ "react/forbid-component-props": "off",
651
+ "react/forbid-dom-props": "off",
652
+ "react/forbid-elements": "off",
653
+ "react/forbid-foreign-prop-types": "off",
654
+ "react/forbid-prop-types": "off",
655
+ "react/forward-ref-uses-ref": "warn",
656
+ "react/function-component-definition": ["warn", { namedComponents: "arrow-function" }],
657
+ "react/hook-use-state": "warn",
658
+ "react/iframe-missing-sandbox": "warn",
659
+ "react/jsx-boolean-value": "warn",
660
+ "react/jsx-child-element-spacing": "warn",
661
+ "react/jsx-closing-bracket-location": "warn",
662
+ "react/jsx-closing-tag-location": "warn",
663
+ "react/jsx-curly-brace-presence": ["warn", {
664
+ props: "never",
665
+ children: "never",
666
+ propElementValues: "always"
667
+ }],
668
+ "react/jsx-curly-newline": "warn",
669
+ "react/jsx-curly-spacing": "warn",
670
+ "react/jsx-equals-spacing": "warn",
671
+ "react/jsx-filename-extension": ["warn", { extensions: [".tsx"] }],
672
+ "react/jsx-first-prop-new-line": ["warn", "multiline"],
673
+ "react/jsx-fragments": "warn",
674
+ "react/jsx-handler-names": "off",
675
+ "react/jsx-indent": [
676
+ "warn",
677
+ 4,
678
+ { indentLogicalExpressions: !0 }
679
+ ],
680
+ "react/jsx-indent-props": "warn",
681
+ "react/jsx-key": "warn",
682
+ "react/jsx-max-depth": "off",
683
+ "react/jsx-max-props-per-line": ["warn", {
684
+ maximum: 1,
685
+ when: "multiline"
686
+ }],
687
+ "react/jsx-newline": ["warn", { prevent: !0 }],
688
+ "react/jsx-no-bind": ["warn", {
689
+ ignoreDOMComponents: !0,
690
+ ignoreRefs: !0
691
+ }],
692
+ "react/jsx-no-comment-textnodes": "warn",
693
+ "react/jsx-no-constructed-context-values": "warn",
694
+ "react/jsx-no-duplicate-props": "warn",
695
+ "react/jsx-no-leaked-render": "off",
696
+ "react/jsx-no-literals": "off",
697
+ "react/jsx-no-script-url": "warn",
698
+ "react/jsx-no-target-blank": "error",
699
+ "react/jsx-no-undef": "off",
700
+ "react/jsx-no-useless-fragment": "warn",
701
+ "react/jsx-one-expression-per-line": ["warn", { allow: "single-child" }],
702
+ "react/jsx-pascal-case": "off",
703
+ "react/jsx-props-no-multi-spaces": "warn",
704
+ "react/jsx-props-no-spread-multi": "warn",
705
+ "react/jsx-props-no-spreading": "off",
706
+ "react/jsx-sort-props": "off",
707
+ "react/jsx-tag-spacing": "warn",
708
+ "react/jsx-uses-vars": "warn",
709
+ "react/jsx-wrap-multilines": ["warn", {
710
+ declaration: "parens-new-line",
711
+ assignment: "parens-new-line",
712
+ return: "parens-new-line",
713
+ arrow: "parens-new-line",
714
+ condition: "parens-new-line",
715
+ logical: "parens-new-line",
716
+ prop: "parens-new-line"
717
+ }],
718
+ "react/no-access-state-in-setstate": "off",
719
+ "react/no-adjacent-inline-elements": "off",
720
+ "react/no-array-index-key": "off",
721
+ "react/no-arrow-function-lifecycle": "off",
722
+ "react/no-children-prop": "warn",
723
+ "react/no-danger": "off",
724
+ "react/no-danger-with-children": "warn",
725
+ "react/no-deprecated": "warn",
726
+ "react/no-did-mount-set-state": "off",
727
+ "react/no-did-update-set-state": "off",
728
+ "react/no-direct-mutation-state": "error",
729
+ "react/no-find-dom-node": "warn",
730
+ "react/no-invalid-html-attribute": "warn",
731
+ "react/no-is-mounted": "off",
732
+ "react/no-multi-comp": "off",
733
+ "react/no-namespace": "warn",
734
+ "react/no-object-type-as-default-prop": "off",
735
+ "react/no-redundant-should-component-update": "off",
736
+ "react/no-render-return-value": "warn",
737
+ "react/no-set-state": "off",
738
+ "react/no-string-refs": "warn",
739
+ "react/no-this-in-sfc": "warn",
740
+ "react/no-typos": "off",
741
+ "react/no-unescaped-entities": "warn",
742
+ "react/no-unknown-property": "warn",
743
+ "react/no-unsafe": "off",
744
+ "react/no-unstable-nested-components": "warn",
745
+ "react/no-unused-class-component-methods": "off",
746
+ "react/no-unused-prop-types": "off",
747
+ "react/no-unused-state": "off",
748
+ "react/no-will-update-set-state": "off",
749
+ "react/prefer-es6-class": "off",
750
+ "react/prefer-exact-props": "off",
751
+ "react/prefer-read-only-props": "off",
752
+ "react/prefer-stateless-function": "error",
753
+ "react/prop-types": "warn",
754
+ "react/require-default-props": "off",
755
+ "react/require-optimization": "off",
756
+ "react/require-render-return": "off",
757
+ "react/self-closing-comp": "warn",
758
+ "react/sort-comp": "off",
759
+ "react/sort-default-props": "off",
760
+ "react/sort-prop-types": "off",
761
+ "react/state-in-constructor": "off",
762
+ "react/static-property-placement": "off",
763
+ "react/style-prop-object": "warn",
764
+ "react/void-dom-elements-no-children": "warn",
765
+ "react/react-in-jsx-scope": "off",
766
+ "react/jsx-uses-react": "off",
767
+ "react-hooks/rules-of-hooks": "error",
768
+ "react-hooks/exhaustive-deps": "warn",
769
+ "react-hooks/config": "error",
770
+ "react-hooks/error-boundaries": "error",
771
+ "react-hooks/component-hook-factories": "error",
772
+ "react-hooks/gating": "error",
773
+ "react-hooks/globals": "error",
774
+ "react-hooks/immutability": "error",
775
+ "react-hooks/preserve-manual-memoization": "error",
776
+ "react-hooks/purity": "error",
777
+ "react-hooks/refs": "error",
778
+ "react-hooks/set-state-in-effect": "error",
779
+ "react-hooks/set-state-in-render": "error",
780
+ "react-hooks/static-components": "error",
781
+ "react-hooks/unsupported-syntax": "warn",
782
+ "react-hooks/use-memo": "error",
783
+ "react-hooks/incompatible-library": "warn",
784
+ "react-refresh/only-export-components": ["warn", { allowConstantExport: !0 }]
785
+ }
786
+ }
787
+ };
788
+ }
789
+ //#endregion
790
+ export { c as createConfig };
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@freehour/eslint-rules",
3
+ "private": false,
4
+ "displayName": "eslint-rules",
5
+ "description": "ESLint rules for TypeScript projects.",
6
+ "version": "1.0.0",
7
+ "type": "module",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/freehour/eslint-rules.git"
11
+ },
12
+ "scripts": {
13
+ "build": "tsc && vite build"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js"
22
+ }
23
+ },
24
+ "dependencies": {
25
+ "@stylistic/eslint-plugin": "5.10.0",
26
+ "eslint-import-resolver-typescript": "^4.4.4",
27
+ "eslint-plugin-import-x": "4.16.2",
28
+ "eslint-plugin-react": "7.37.5",
29
+ "eslint-plugin-react-hooks": "7.0.1",
30
+ "eslint-plugin-react-refresh": "0.5.2",
31
+ "typescript-eslint": "8.57.2"
32
+ },
33
+ "peerDependencies": {
34
+ "eslint": "9.39.4",
35
+ "typescript": "^6.0.0"
36
+ },
37
+ "devDependencies": {
38
+ "eslint": "9.39.4",
39
+ "ajv": "^8.18.0",
40
+ "bun-types": "^1.3.11",
41
+ "vite": "^8.0.3",
42
+ "vite-plugin-dts": "^4.5.4",
43
+ "typescript": "^6.0.0"
44
+ },
45
+ "trustedDependencies": [
46
+ "unrs-resolver"
47
+ ]
48
+ }