@jsenv/eslint-config-relax 1.8.9 → 2.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/eslint-config-relax",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A pleaseant ESLint configuration for any project",
|
|
6
6
|
"repository": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"engines": {
|
|
17
|
-
"node": "
|
|
17
|
+
"node": "^22.18.0 || >=24.11.0"
|
|
18
18
|
},
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
],
|
|
28
28
|
"scripts": {},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@babel/eslint-parser": "
|
|
30
|
+
"@babel/eslint-parser": "8.0.1",
|
|
31
31
|
"@jsenv/eslint-import-resolver": "8.4.6",
|
|
32
|
-
"@jsenv/eslint-plugin": "1.
|
|
32
|
+
"@jsenv/eslint-plugin": "1.5.0",
|
|
33
33
|
"@jsenv/urls": "2.9.10",
|
|
34
34
|
"@preact/eslint-plugin-signals": "0.3.0",
|
|
35
|
-
"eslint-plugin-html": "8.
|
|
35
|
+
"eslint-plugin-html": "8.2.0",
|
|
36
36
|
"eslint-plugin-import-x": "4.17.1",
|
|
37
37
|
"eslint-plugin-react": "7.37.5",
|
|
38
|
-
"eslint-plugin-regexp": "3.
|
|
39
|
-
"globals": "17.
|
|
38
|
+
"eslint-plugin-regexp": "3.2.0",
|
|
39
|
+
"globals": "17.11.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {},
|
|
42
42
|
"publishConfig": {
|
|
@@ -12,6 +12,7 @@ import * as regexpPlugin from "eslint-plugin-regexp";
|
|
|
12
12
|
import globals from "globals";
|
|
13
13
|
import { existsSync, readFileSync } from "node:fs";
|
|
14
14
|
import { explicitGlobals } from "./explicit_globals.js";
|
|
15
|
+
import { reactPluginEslint10Compat } from "./react_plugin_eslint_10_compat.js";
|
|
15
16
|
import { rulesImportRelax } from "./rules_import_relax.js";
|
|
16
17
|
import { rulesOffPrettier } from "./rules_off_prettier.js";
|
|
17
18
|
import { rulesReactRelax } from "./rules_react_relax.js";
|
|
@@ -141,8 +142,14 @@ export const eslintConfigRelax = ({
|
|
|
141
142
|
const parserOptions = {
|
|
142
143
|
ecmaVersion: 2022,
|
|
143
144
|
sourceType: "module",
|
|
144
|
-
ecmaFeatures: { jsx: true },
|
|
145
145
|
regexpUnicodeSets: true,
|
|
146
|
+
// "@babel/eslint-parser" 8 reads only ecmaFeatures.globalReturn; every other
|
|
147
|
+
// syntax is opted into through Babel's own parser plugins.
|
|
148
|
+
babelOptions: {
|
|
149
|
+
parserOpts: {
|
|
150
|
+
plugins: ["jsx", "decorators", "importAttributes"],
|
|
151
|
+
},
|
|
152
|
+
},
|
|
146
153
|
};
|
|
147
154
|
const globalsForNodeModule = {
|
|
148
155
|
...globals.node,
|
|
@@ -258,7 +265,7 @@ export const eslintConfigRelax = ({
|
|
|
258
265
|
{
|
|
259
266
|
files: ["**/*.jsx"],
|
|
260
267
|
plugins: {
|
|
261
|
-
react: reactPlugin,
|
|
268
|
+
react: reactPluginEslint10Compat(reactPlugin),
|
|
262
269
|
},
|
|
263
270
|
settings: {
|
|
264
271
|
react: {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* ESLint 10 removed the deprecated method form of a few rule context accessors
|
|
3
|
+
* (getFilename, getCwd, getSourceCode, parserOptions); only the property form
|
|
4
|
+
* survives. "eslint-plugin-react" still calls the method form in
|
|
5
|
+
* lib/util/version.js and lib/rules/jsx-filename-extension.js, so every one of
|
|
6
|
+
* its rules throws "context.getFilename is not a function" under ESLint 10.
|
|
7
|
+
*
|
|
8
|
+
* Upstream tracks this in https://github.com/jsx-eslint/eslint-plugin-react/issues/3977
|
|
9
|
+
* (open since february 2026, no fix released). Until it lands, hand each rule a
|
|
10
|
+
* context that answers both forms.
|
|
11
|
+
*
|
|
12
|
+
* Delete this file, and its use in eslint_config_relax.js, once
|
|
13
|
+
* eslint-plugin-react ships an ESLint 10 compatible release.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const eslint10Context = (context) =>
|
|
17
|
+
new Proxy(context, {
|
|
18
|
+
get: (target, property, receiver) => {
|
|
19
|
+
if (property === "getFilename") {
|
|
20
|
+
return () => target.filename;
|
|
21
|
+
}
|
|
22
|
+
if (property === "getPhysicalFilename") {
|
|
23
|
+
return () => target.physicalFilename;
|
|
24
|
+
}
|
|
25
|
+
if (property === "getCwd") {
|
|
26
|
+
return () => target.cwd;
|
|
27
|
+
}
|
|
28
|
+
if (property === "getSourceCode") {
|
|
29
|
+
return () => target.sourceCode;
|
|
30
|
+
}
|
|
31
|
+
if (property === "parserOptions") {
|
|
32
|
+
return target.languageOptions?.parserOptions || {};
|
|
33
|
+
}
|
|
34
|
+
return Reflect.get(target, property, receiver);
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const reactPluginEslint10Compat = (reactPlugin) => {
|
|
39
|
+
return {
|
|
40
|
+
...reactPlugin,
|
|
41
|
+
rules: Object.fromEntries(
|
|
42
|
+
Object.entries(reactPlugin.rules).map(([name, rule]) => [
|
|
43
|
+
name,
|
|
44
|
+
{
|
|
45
|
+
...rule,
|
|
46
|
+
create: (context) => rule.create(eslint10Context(context)),
|
|
47
|
+
},
|
|
48
|
+
]),
|
|
49
|
+
),
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -42,7 +42,13 @@ export const rulesImportRelax = {
|
|
|
42
42
|
],
|
|
43
43
|
"import-x/no-extraneous-dependencies": ["error"],
|
|
44
44
|
"import-x/no-self-import": ["error"],
|
|
45
|
-
|
|
45
|
+
// The cycle search follows every import by default, node_modules included.
|
|
46
|
+
// Under eslint 10 that exhausts the heap (8GB is not enough on a codebase
|
|
47
|
+
// importing a large bundle) where eslint 9 completed, and a cycle found
|
|
48
|
+
// inside node_modules is not something the project can fix anyway.
|
|
49
|
+
// A project whose own packages resolve outside the linted package (a
|
|
50
|
+
// monorepo) keeps them in scope with "import-x/internal-regex".
|
|
51
|
+
"import-x/no-cycle": ["error", { ignoreExternal: true }],
|
|
46
52
|
"import-x/no-useless-path-segments": ["error"],
|
|
47
53
|
// named imports are definitely better than import default
|
|
48
54
|
// but some tools expect you to use default export.
|