@fullstacksjs/eslint-config 15.0.0 → 15.1.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/dist/index.mjs +129 -2
- package/package.json +22 -19
- package/src/modules/react.mjs +6 -1
- package/src/modules/typescript.mjs +1 -0
- package/src/utils/getGitignorePatterns.mjs +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,6 @@ import { isPackageExists } from "local-pkg";
|
|
|
4
4
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
5
5
|
import globals from "globals";
|
|
6
6
|
import plugin from "eslint-plugin-cypress";
|
|
7
|
-
import { includeIgnoreFile } from "@eslint/compat";
|
|
8
7
|
import fs from "node:fs";
|
|
9
8
|
import path from "node:path";
|
|
10
9
|
import plugin$1 from "eslint-plugin-import-x";
|
|
@@ -356,6 +355,128 @@ function cypress(options = {}) {
|
|
|
356
355
|
return mergeConfigs(cypressConfig, overrides);
|
|
357
356
|
}
|
|
358
357
|
//#endregion
|
|
358
|
+
//#region node_modules/@eslint/config-helpers/dist/esm/index.js
|
|
359
|
+
/**
|
|
360
|
+
* @fileoverview Ignore file utilities for the config-helpers package.
|
|
361
|
+
* This file was forked from the source code for the compat package.
|
|
362
|
+
*
|
|
363
|
+
* @author Nicholas C. Zakas
|
|
364
|
+
* @author Kirk Waiblinger
|
|
365
|
+
*/
|
|
366
|
+
/**
|
|
367
|
+
* @typedef {object} IncludeIgnoreFileOptionsObject
|
|
368
|
+
* @property {boolean} [gitignoreResolution] Whether to interpret the contents of an ignore file relative to the config file or the ignore file.
|
|
369
|
+
* - gitignoreResolution: false (default): Interprets ignore patterns relative to the config file
|
|
370
|
+
* - gitignoreResolution: true: Interprets the ignore patterns in a file relative to the ignore file
|
|
371
|
+
* @property {string} [name] The name to give the output config object(s).
|
|
372
|
+
*/
|
|
373
|
+
/**
|
|
374
|
+
* Options for `includeIgnoreFile()`. May be provided as an object or, for
|
|
375
|
+
* legacy compatibility with `@eslint/compat`, as a string which is treated as
|
|
376
|
+
* the `name` option.
|
|
377
|
+
* @typedef {IncludeIgnoreFileOptionsObject | string} IncludeIgnoreFileOptions
|
|
378
|
+
*/
|
|
379
|
+
/**
|
|
380
|
+
* Converts an ESLint ignore pattern to a minimatch pattern.
|
|
381
|
+
* @param {string} pattern The .eslintignore or .gitignore pattern to convert.
|
|
382
|
+
* @returns {string} The converted pattern.
|
|
383
|
+
*/
|
|
384
|
+
function convertIgnorePatternToMinimatch(pattern) {
|
|
385
|
+
const isNegated = pattern.startsWith("!");
|
|
386
|
+
const negatedPrefix = isNegated ? "!" : "";
|
|
387
|
+
const patternToTest = (isNegated ? pattern.slice(1) : pattern).trimEnd();
|
|
388
|
+
if ([
|
|
389
|
+
"",
|
|
390
|
+
"**",
|
|
391
|
+
"/**",
|
|
392
|
+
"**/"
|
|
393
|
+
].includes(patternToTest)) return `${negatedPrefix}${patternToTest}`;
|
|
394
|
+
const firstIndexOfSlash = patternToTest.indexOf("/");
|
|
395
|
+
return `${negatedPrefix}${firstIndexOfSlash < 0 || firstIndexOfSlash === patternToTest.length - 1 ? "**/" : ""}${(firstIndexOfSlash === 0 ? patternToTest.slice(1) : patternToTest).replaceAll(/(?=((?:\\.|[^{(])*))\1([{(])/guy, "$1\\$2")}${patternToTest.endsWith("/**") ? "/*" : ""}`;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* @param {string} ignoreFilePath
|
|
399
|
+
* @returns {string[]}
|
|
400
|
+
*/
|
|
401
|
+
function ignoreFilePathToPatterns(ignoreFilePath) {
|
|
402
|
+
return fs.readFileSync(ignoreFilePath, "utf8").split(/\r?\n/u).map((line) => line.trim()).filter((line) => line && !line.startsWith("#")).map(convertIgnorePatternToMinimatch);
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Helper to parse and validate the options to `includeIgnoreFile()`
|
|
406
|
+
*
|
|
407
|
+
* @param {string | { gitignoreResolution?: unknown, name?: unknown } | undefined} options
|
|
408
|
+
* @returns {{ gitignoreResolution: boolean, name: string }}
|
|
409
|
+
*/
|
|
410
|
+
function parseOptions(options) {
|
|
411
|
+
if (typeof options === "string") return {
|
|
412
|
+
gitignoreResolution: false,
|
|
413
|
+
name: options
|
|
414
|
+
};
|
|
415
|
+
const optionsObject = options ?? {};
|
|
416
|
+
if (typeof optionsObject !== "object" || Array.isArray(optionsObject)) throw new TypeError("The options argument to `includeIgnoreFile()` should be an object or a string.");
|
|
417
|
+
const gitignoreResolution = optionsObject.gitignoreResolution ?? false;
|
|
418
|
+
if (typeof gitignoreResolution !== "boolean") throw new TypeError("The `gitignoreResolution` option must be specified a boolean or omitted");
|
|
419
|
+
const name = optionsObject.name ?? `Imported .gitignore patterns`;
|
|
420
|
+
if (typeof name !== "string") throw new TypeError("The `name` option must be specified as a string or omitted.");
|
|
421
|
+
return {
|
|
422
|
+
gitignoreResolution,
|
|
423
|
+
name
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* @overload
|
|
428
|
+
*
|
|
429
|
+
* Reads ignore files and returns objects with the ignore patterns.
|
|
430
|
+
*
|
|
431
|
+
* @param {string[]} ignoreFilePathArg The paths of ignore files to include.
|
|
432
|
+
* @param {IncludeIgnoreFileOptions} [options]
|
|
433
|
+
* @returns {ConfigObject[]}
|
|
434
|
+
*/
|
|
435
|
+
/**
|
|
436
|
+
* @overload
|
|
437
|
+
*
|
|
438
|
+
* Reads an ignore file and returns an object with the ignore patterns.
|
|
439
|
+
*
|
|
440
|
+
* @param {string} ignoreFilePathArg The path of the ignore file to include.
|
|
441
|
+
* @param {IncludeIgnoreFileOptions} [options]
|
|
442
|
+
* @returns {ConfigObject}
|
|
443
|
+
*/
|
|
444
|
+
/**
|
|
445
|
+
* @overload
|
|
446
|
+
*
|
|
447
|
+
* Reads an ignore file(s) and returns an object(s) with the ignore patterns.
|
|
448
|
+
*
|
|
449
|
+
* @param {string[] | string} ignoreFilePathArg The path(s) of the ignore file(s) to include.
|
|
450
|
+
* @param {IncludeIgnoreFileOptions} [options]
|
|
451
|
+
* @returns {ConfigObject[] | ConfigObject}
|
|
452
|
+
*/
|
|
453
|
+
/**
|
|
454
|
+
* Reads an ignore file(s) and returns an object(s) with the ignore patterns.
|
|
455
|
+
*
|
|
456
|
+
* @param {string[] | string} ignoreFilePathArg The path(s) of the ignore file(s) to include.
|
|
457
|
+
* @param {IncludeIgnoreFileOptions} [options]
|
|
458
|
+
* @returns {ConfigObject[] | ConfigObject}
|
|
459
|
+
*/
|
|
460
|
+
function includeIgnoreFile(ignoreFilePathArg, options) {
|
|
461
|
+
const returnSingleObject = !Array.isArray(ignoreFilePathArg);
|
|
462
|
+
const ignoreFilePaths = Array.isArray(ignoreFilePathArg) ? ignoreFilePathArg : [ignoreFilePathArg];
|
|
463
|
+
for (const ignorePath of ignoreFilePaths) {
|
|
464
|
+
if (typeof ignorePath !== "string") throw new TypeError("The first argument to `includeIgnoreFile()` should be a string or array of strings");
|
|
465
|
+
if (!path.isAbsolute(ignorePath)) throw new Error(`The ignore file location must be an absolute path. Received ${ignorePath}`);
|
|
466
|
+
}
|
|
467
|
+
const { gitignoreResolution, name } = parseOptions(options);
|
|
468
|
+
if (returnSingleObject) return {
|
|
469
|
+
name,
|
|
470
|
+
ignores: ignoreFilePathToPatterns(ignoreFilePathArg),
|
|
471
|
+
...gitignoreResolution ? { basePath: path.dirname(ignoreFilePathArg) } : {}
|
|
472
|
+
};
|
|
473
|
+
return ignoreFilePaths.map((ignoreFilePath, i) => ({
|
|
474
|
+
name: `${name} (${i})`,
|
|
475
|
+
ignores: ignoreFilePathToPatterns(ignoreFilePath),
|
|
476
|
+
...gitignoreResolution ? { basePath: path.dirname(ignoreFilePath) } : {}
|
|
477
|
+
}));
|
|
478
|
+
}
|
|
479
|
+
//#endregion
|
|
359
480
|
//#region src/utils/getGitignorePatterns.mjs
|
|
360
481
|
const warningMessage = "\x1B[38;2;229;229;14mWarning:\x1B[0m";
|
|
361
482
|
const fallbackMessage = "Falling back to default ignore patterns. You can suppress this warning by setting \x1B[48;5;234m`gitignore: false`\x1B[0m in the config.";
|
|
@@ -989,13 +1110,15 @@ function react(options = {}) {
|
|
|
989
1110
|
"@eslint-react/dom-no-render": "warn",
|
|
990
1111
|
"@eslint-react/dom-no-script-url": "warn",
|
|
991
1112
|
"@eslint-react/dom-no-string-style-prop": "error",
|
|
1113
|
+
"@eslint-react/dom-no-unknown-property": "off",
|
|
992
1114
|
"@eslint-react/dom-no-unsafe-iframe-sandbox": "warn",
|
|
993
1115
|
"@eslint-react/dom-no-unsafe-target-blank": "warn",
|
|
994
1116
|
"@eslint-react/jsx-no-comment-textnodes": "warn",
|
|
995
1117
|
"@eslint-react/jsx-no-children-prop": "warn",
|
|
996
1118
|
"@eslint-react/jsx-no-children-prop-with-children": "warn",
|
|
997
1119
|
"@eslint-react/jsx-no-key-after-spread": "error",
|
|
998
|
-
"@eslint-react/no-leaked-dollar": "error",
|
|
1120
|
+
"@eslint-react/jsx-no-leaked-dollar": "error",
|
|
1121
|
+
"@eslint-react/jsx-no-leaked-semicolon": "error",
|
|
999
1122
|
"@eslint-react/jsx-no-useless-fragment": "warn",
|
|
1000
1123
|
"@eslint-react/jsx-no-namespace": "error",
|
|
1001
1124
|
"@eslint-react/no-access-state-in-setstate": "error",
|
|
@@ -1005,6 +1128,7 @@ function react(options = {}) {
|
|
|
1005
1128
|
"@eslint-react/no-children-map": "warn",
|
|
1006
1129
|
"@eslint-react/no-children-only": "warn",
|
|
1007
1130
|
"@eslint-react/no-children-to-array": "warn",
|
|
1131
|
+
"@eslint-react/no-class-component": "off",
|
|
1008
1132
|
"@eslint-react/no-clone-element": "warn",
|
|
1009
1133
|
"@eslint-react/no-component-will-mount": "error",
|
|
1010
1134
|
"@eslint-react/no-component-will-receive-props": "error",
|
|
@@ -1014,6 +1138,8 @@ function react(options = {}) {
|
|
|
1014
1138
|
"@eslint-react/no-direct-mutation-state": "error",
|
|
1015
1139
|
"@eslint-react/no-duplicate-key": "error",
|
|
1016
1140
|
"@eslint-react/no-forward-ref": "warn",
|
|
1141
|
+
"@eslint-react/no-leaked-conditional-rendering": "error",
|
|
1142
|
+
"@eslint-react/no-missing-component-display-name": "off",
|
|
1017
1143
|
"@eslint-react/no-missing-context-display-name": "warn",
|
|
1018
1144
|
"@eslint-react/no-missing-key": "error",
|
|
1019
1145
|
"@eslint-react/no-misused-capture-owner-stack": "error",
|
|
@@ -1619,6 +1745,7 @@ function typescript(options = {}) {
|
|
|
1619
1745
|
"@typescript-eslint/promise-function-async": "off",
|
|
1620
1746
|
"@typescript-eslint/restrict-plus-operands": "warn",
|
|
1621
1747
|
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
1748
|
+
"@typescript-eslint/strict-void-return": "error",
|
|
1622
1749
|
"@typescript-eslint/triple-slash-reference": "error",
|
|
1623
1750
|
"@typescript-eslint/unified-signatures": "error",
|
|
1624
1751
|
...predicate(projectService, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullstacksjs/eslint-config",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.1.0",
|
|
4
4
|
"description": "fullstacks eslint config",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "fullstacks <fullstacksjs@gmail.com>",
|
|
@@ -32,46 +32,46 @@
|
|
|
32
32
|
"check:rules": "node scripts/check-missing-rules.mjs"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@eslint-react/eslint-plugin": "5.18.
|
|
36
|
-
"@eslint/compat": "2.1.
|
|
37
|
-
"@next/eslint-plugin-next": "16.3.
|
|
35
|
+
"@eslint-react/eslint-plugin": "5.18.7",
|
|
36
|
+
"@eslint/compat": "2.1.1",
|
|
37
|
+
"@next/eslint-plugin-next": "16.3.4",
|
|
38
38
|
"@stylistic/eslint-plugin": "5.10.0",
|
|
39
39
|
"@vitest/eslint-plugin": "1.6.27",
|
|
40
40
|
"deepmerge": "4.3.1",
|
|
41
41
|
"eslint-flat-config-utils": "3.2.0",
|
|
42
42
|
"eslint-plugin-better-tailwindcss": "4.7.0",
|
|
43
|
-
"eslint-plugin-cypress": "7.0.
|
|
43
|
+
"eslint-plugin-cypress": "7.0.1",
|
|
44
44
|
"eslint-plugin-import-x": "4.17.1",
|
|
45
|
-
"eslint-plugin-jest": "29.16.
|
|
45
|
+
"eslint-plugin-jest": "29.16.6",
|
|
46
46
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
47
47
|
"eslint-plugin-n": "18.3.0",
|
|
48
|
-
"eslint-plugin-perfectionist": "5.
|
|
48
|
+
"eslint-plugin-perfectionist": "5.11.0",
|
|
49
49
|
"eslint-plugin-playwright": "2.11.0",
|
|
50
50
|
"eslint-plugin-prettier": "5.5.6",
|
|
51
51
|
"eslint-plugin-promise": "7.3.0",
|
|
52
|
-
"eslint-plugin-react-refresh": "0.5.
|
|
53
|
-
"eslint-plugin-regexp": "3.
|
|
54
|
-
"eslint-plugin-storybook": "10.
|
|
55
|
-
"globals": "17.
|
|
52
|
+
"eslint-plugin-react-refresh": "0.5.6",
|
|
53
|
+
"eslint-plugin-regexp": "3.3.0",
|
|
54
|
+
"eslint-plugin-storybook": "10.6.0",
|
|
55
|
+
"globals": "17.12.0",
|
|
56
56
|
"local-pkg": "1.2.1",
|
|
57
|
-
"typescript-eslint": "8.
|
|
57
|
+
"typescript-eslint": "8.69.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@eslint/eslintrc": "3.3.
|
|
60
|
+
"@eslint/eslintrc": "3.3.7",
|
|
61
61
|
"@eslint/js": "10.0.1",
|
|
62
62
|
"@semantic-release/github": "12.0.9",
|
|
63
63
|
"@semantic-release/npm": "13.1.5",
|
|
64
64
|
"@semantic-release/release-notes-generator": "14.1.1",
|
|
65
65
|
"@types/eslint": "9.6.1",
|
|
66
|
-
"cspell": "10.
|
|
67
|
-
"eslint": "10.
|
|
68
|
-
"jest": "30.
|
|
66
|
+
"cspell": "10.2.2",
|
|
67
|
+
"eslint": "10.10.0",
|
|
68
|
+
"jest": "30.5.1",
|
|
69
69
|
"pinst": "3.0.0",
|
|
70
70
|
"prettier": "3.9.6",
|
|
71
71
|
"semantic-release": "25.0.9",
|
|
72
|
-
"storybook": "10.
|
|
72
|
+
"storybook": "10.6.0",
|
|
73
73
|
"typescript": "6.0.3",
|
|
74
|
-
"vite-plus": "0.
|
|
74
|
+
"vite-plus": "0.3.0",
|
|
75
75
|
"vitest": "4.1.10"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
@@ -106,5 +106,8 @@
|
|
|
106
106
|
"onFail": "download"
|
|
107
107
|
}
|
|
108
108
|
},
|
|
109
|
-
"packageManager": "npm@12.0.2"
|
|
109
|
+
"packageManager": "npm@12.0.2",
|
|
110
|
+
"inlinedDependencies": {
|
|
111
|
+
"@eslint/config-helpers": "0.7.0"
|
|
112
|
+
}
|
|
110
113
|
}
|
package/src/modules/react.mjs
CHANGED
|
@@ -70,6 +70,7 @@ function react(options = {}) {
|
|
|
70
70
|
'@eslint-react/dom-no-render': 'warn',
|
|
71
71
|
'@eslint-react/dom-no-script-url': 'warn',
|
|
72
72
|
'@eslint-react/dom-no-string-style-prop': 'error',
|
|
73
|
+
'@eslint-react/dom-no-unknown-property': 'off',
|
|
73
74
|
'@eslint-react/dom-no-unsafe-iframe-sandbox': 'warn',
|
|
74
75
|
'@eslint-react/dom-no-unsafe-target-blank': 'warn',
|
|
75
76
|
|
|
@@ -77,7 +78,8 @@ function react(options = {}) {
|
|
|
77
78
|
'@eslint-react/jsx-no-children-prop': 'warn',
|
|
78
79
|
'@eslint-react/jsx-no-children-prop-with-children': 'warn',
|
|
79
80
|
'@eslint-react/jsx-no-key-after-spread': 'error',
|
|
80
|
-
'@eslint-react/no-leaked-dollar': 'error',
|
|
81
|
+
'@eslint-react/jsx-no-leaked-dollar': 'error',
|
|
82
|
+
'@eslint-react/jsx-no-leaked-semicolon': 'error',
|
|
81
83
|
'@eslint-react/jsx-no-useless-fragment': 'warn',
|
|
82
84
|
'@eslint-react/jsx-no-namespace': 'error',
|
|
83
85
|
|
|
@@ -88,6 +90,7 @@ function react(options = {}) {
|
|
|
88
90
|
'@eslint-react/no-children-map': 'warn',
|
|
89
91
|
'@eslint-react/no-children-only': 'warn',
|
|
90
92
|
'@eslint-react/no-children-to-array': 'warn',
|
|
93
|
+
'@eslint-react/no-class-component': 'off',
|
|
91
94
|
'@eslint-react/no-clone-element': 'warn',
|
|
92
95
|
'@eslint-react/no-component-will-mount': 'error',
|
|
93
96
|
'@eslint-react/no-component-will-receive-props': 'error',
|
|
@@ -98,6 +101,8 @@ function react(options = {}) {
|
|
|
98
101
|
'@eslint-react/no-direct-mutation-state': 'error',
|
|
99
102
|
'@eslint-react/no-duplicate-key': 'error',
|
|
100
103
|
'@eslint-react/no-forward-ref': 'warn',
|
|
104
|
+
'@eslint-react/no-leaked-conditional-rendering': 'error',
|
|
105
|
+
'@eslint-react/no-missing-component-display-name': 'off',
|
|
101
106
|
'@eslint-react/no-missing-context-display-name': 'warn',
|
|
102
107
|
'@eslint-react/no-missing-key': 'error',
|
|
103
108
|
'@eslint-react/no-misused-capture-owner-stack': 'error',
|
|
@@ -150,6 +150,7 @@ function typescript(options = {}) {
|
|
|
150
150
|
'@typescript-eslint/promise-function-async': 'off', // Breaks react component when return type is React.ReactNode
|
|
151
151
|
'@typescript-eslint/restrict-plus-operands': 'warn',
|
|
152
152
|
'@typescript-eslint/strict-boolean-expressions': 'off', // Annoying
|
|
153
|
+
'@typescript-eslint/strict-void-return': 'error',
|
|
153
154
|
|
|
154
155
|
'@typescript-eslint/triple-slash-reference': 'error',
|
|
155
156
|
'@typescript-eslint/unified-signatures': 'error',
|