eslint-plugin-react-x 3.0.0-next.55 → 3.0.0-next.57
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.d.ts +5 -82
- package/dist/index.js +13 -28
- package/package.json +8 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,86 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ESLint, Linter } from "eslint";
|
|
2
2
|
|
|
3
3
|
//#region src/index.d.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Disable experimental rules that might be subject to change in the future
|
|
8
|
-
*/
|
|
9
|
-
"disable-experimental": {
|
|
10
|
-
plugins: {};
|
|
11
|
-
name?: string;
|
|
12
|
-
rules?: Record<string, _eslint_react_shared0.RuleConfig>;
|
|
13
|
-
settings?: _eslint_react_shared0.SettingsConfig;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Disable rules that can be enforced by TypeScript
|
|
17
|
-
*/
|
|
18
|
-
"disable-type-checked": {
|
|
19
|
-
plugins: {};
|
|
20
|
-
name?: string;
|
|
21
|
-
rules?: Record<string, _eslint_react_shared0.RuleConfig>;
|
|
22
|
-
settings?: _eslint_react_shared0.SettingsConfig;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Enforce rules that are recommended by ESLint React for general purpose React + React DOM projects
|
|
26
|
-
*/
|
|
27
|
-
recommended: {
|
|
28
|
-
plugins: {};
|
|
29
|
-
name?: string;
|
|
30
|
-
rules?: Record<string, _eslint_react_shared0.RuleConfig>;
|
|
31
|
-
settings?: _eslint_react_shared0.SettingsConfig;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Same as the `recommended-typescript` preset but enables additional rules that require type information
|
|
35
|
-
*/
|
|
36
|
-
"recommended-type-checked": {
|
|
37
|
-
plugins: {};
|
|
38
|
-
name?: string;
|
|
39
|
-
rules?: Record<string, _eslint_react_shared0.RuleConfig>;
|
|
40
|
-
settings?: _eslint_react_shared0.SettingsConfig;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Same as the `recommended` preset but disables rules that can be enforced by TypeScript
|
|
44
|
-
*/
|
|
45
|
-
"recommended-typescript": {
|
|
46
|
-
plugins: {};
|
|
47
|
-
name?: string;
|
|
48
|
-
rules?: Record<string, _eslint_react_shared0.RuleConfig>;
|
|
49
|
-
settings?: _eslint_react_shared0.SettingsConfig;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* More strict version of the `recommended` preset
|
|
53
|
-
*/
|
|
54
|
-
strict: {
|
|
55
|
-
plugins: {};
|
|
56
|
-
name?: string;
|
|
57
|
-
rules?: Record<string, _eslint_react_shared0.RuleConfig>;
|
|
58
|
-
settings?: _eslint_react_shared0.SettingsConfig;
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Same as the `strict-typescript` preset but enables additional rules that require type information
|
|
62
|
-
*/
|
|
63
|
-
"strict-type-checked": {
|
|
64
|
-
plugins: {};
|
|
65
|
-
name?: string;
|
|
66
|
-
rules?: Record<string, _eslint_react_shared0.RuleConfig>;
|
|
67
|
-
settings?: _eslint_react_shared0.SettingsConfig;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Same as the `strict` preset but disables rules that can be enforced by TypeScript
|
|
71
|
-
*/
|
|
72
|
-
"strict-typescript": {
|
|
73
|
-
plugins: {};
|
|
74
|
-
name?: string;
|
|
75
|
-
rules?: Record<string, _eslint_react_shared0.RuleConfig>;
|
|
76
|
-
settings?: _eslint_react_shared0.SettingsConfig;
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
meta: {
|
|
80
|
-
name: string;
|
|
81
|
-
version: string;
|
|
82
|
-
};
|
|
83
|
-
rules: Record<string, _eslint_react_shared0.CompatibleRule>;
|
|
4
|
+
type ConfigName = "disable-experimental" | "disable-type-checked" | "recommended" | "recommended-type-checked" | "recommended-typescript" | "strict" | "strict-type-checked" | "strict-typescript";
|
|
5
|
+
declare const finalPlugin: ESLint.Plugin & {
|
|
6
|
+
configs: Record<ConfigName, Linter.Config>;
|
|
84
7
|
};
|
|
85
8
|
//#endregion
|
|
86
|
-
export {
|
|
9
|
+
export { finalPlugin as default };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_ESLINT_REACT_SETTINGS, IMPURE_CTORS, IMPURE_FUNCS, WEBSITE_URL,
|
|
1
|
+
import { DEFAULT_ESLINT_REACT_SETTINGS, IMPURE_CTORS, IMPURE_FUNCS, WEBSITE_URL, defineRuleListener, getSettingsFromContext, report, toRegExp } from "@eslint-react/shared";
|
|
2
2
|
import * as ast from "@eslint-react/ast";
|
|
3
3
|
import * as core from "@eslint-react/core";
|
|
4
4
|
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
@@ -68,7 +68,7 @@ const rules$7 = {
|
|
|
68
68
|
//#endregion
|
|
69
69
|
//#region package.json
|
|
70
70
|
var name$6 = "eslint-plugin-react-x";
|
|
71
|
-
var version = "3.0.0-next.
|
|
71
|
+
var version = "3.0.0-next.57";
|
|
72
72
|
|
|
73
73
|
//#endregion
|
|
74
74
|
//#region src/utils/create-rule.ts
|
|
@@ -1812,7 +1812,6 @@ function create$51(context) {
|
|
|
1812
1812
|
//#endregion
|
|
1813
1813
|
//#region src/rules/no-array-index-key/no-array-index-key.ts
|
|
1814
1814
|
const RULE_NAME$50 = "no-array-index-key";
|
|
1815
|
-
const REACT_CHILDREN_METHOD = ["forEach", "map"];
|
|
1816
1815
|
function getIndexParamPosition(methodName) {
|
|
1817
1816
|
switch (methodName) {
|
|
1818
1817
|
case "every":
|
|
@@ -1830,19 +1829,6 @@ function getIndexParamPosition(methodName) {
|
|
|
1830
1829
|
default: return -1;
|
|
1831
1830
|
}
|
|
1832
1831
|
}
|
|
1833
|
-
function isReactChildrenMethod(name) {
|
|
1834
|
-
return REACT_CHILDREN_METHOD.includes(name);
|
|
1835
|
-
}
|
|
1836
|
-
function isUsingReactChildren(context, node) {
|
|
1837
|
-
const { importSource = "react" } = coerceSettings(context.settings);
|
|
1838
|
-
const { callee } = node;
|
|
1839
|
-
if (!("property" in callee) || !("object" in callee) || !("name" in callee.property)) return false;
|
|
1840
|
-
if (!isReactChildrenMethod(callee.property.name)) return false;
|
|
1841
|
-
const initialScope = context.sourceCode.getScope(node);
|
|
1842
|
-
if (callee.object.type === AST_NODE_TYPES.Identifier && callee.object.name === "Children") return true;
|
|
1843
|
-
if (callee.object.type === AST_NODE_TYPES.MemberExpression && "name" in callee.object.object) return core.isInitializedFromReact(callee.object.object.name, initialScope, importSource);
|
|
1844
|
-
return false;
|
|
1845
|
-
}
|
|
1846
1832
|
function getMapIndexParamName(context, node) {
|
|
1847
1833
|
const { callee } = node;
|
|
1848
1834
|
if (callee.type !== AST_NODE_TYPES.MemberExpression) return unit;
|
|
@@ -1850,7 +1836,7 @@ function getMapIndexParamName(context, node) {
|
|
|
1850
1836
|
const { name } = callee.property;
|
|
1851
1837
|
const indexPosition = getIndexParamPosition(name);
|
|
1852
1838
|
if (indexPosition === -1) return unit;
|
|
1853
|
-
const callbackArg = node.arguments[
|
|
1839
|
+
const callbackArg = node.arguments[core.isChildrenMap(context, callee) || core.isChildrenForEach(context, callee) ? 1 : 0];
|
|
1854
1840
|
if (callbackArg == null) return unit;
|
|
1855
1841
|
if (!ast.isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(callbackArg)) return unit;
|
|
1856
1842
|
const { params } = callbackArg;
|
|
@@ -7342,20 +7328,19 @@ const settings = { ...settings$1 };
|
|
|
7342
7328
|
|
|
7343
7329
|
//#endregion
|
|
7344
7330
|
//#region src/index.ts
|
|
7345
|
-
const
|
|
7346
|
-
var src_default = {
|
|
7331
|
+
const finalPlugin = {
|
|
7347
7332
|
...plugin,
|
|
7348
7333
|
configs: {
|
|
7349
|
-
["disable-experimental"]:
|
|
7350
|
-
["disable-type-checked"]:
|
|
7351
|
-
["recommended"]:
|
|
7352
|
-
["recommended-type-checked"]:
|
|
7353
|
-
["recommended-typescript"]:
|
|
7354
|
-
["strict"]:
|
|
7355
|
-
["strict-type-checked"]:
|
|
7356
|
-
["strict-typescript"]:
|
|
7334
|
+
["disable-experimental"]: disable_experimental_exports,
|
|
7335
|
+
["disable-type-checked"]: disable_type_checked_exports,
|
|
7336
|
+
["recommended"]: recommended_exports,
|
|
7337
|
+
["recommended-type-checked"]: recommended_type_checked_exports,
|
|
7338
|
+
["recommended-typescript"]: recommended_typescript_exports,
|
|
7339
|
+
["strict"]: strict_exports,
|
|
7340
|
+
["strict-type-checked"]: strict_type_checked_exports,
|
|
7341
|
+
["strict-typescript"]: strict_typescript_exports
|
|
7357
7342
|
}
|
|
7358
7343
|
};
|
|
7359
7344
|
|
|
7360
7345
|
//#endregion
|
|
7361
|
-
export {
|
|
7346
|
+
export { finalPlugin as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.57",
|
|
4
4
|
"description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -45,16 +45,17 @@
|
|
|
45
45
|
"string-ts": "^2.3.1",
|
|
46
46
|
"ts-api-utils": "^2.4.0",
|
|
47
47
|
"ts-pattern": "^5.9.0",
|
|
48
|
-
"@eslint-react/ast": "3.0.0-next.
|
|
49
|
-
"@eslint-react/eff": "3.0.0-next.
|
|
50
|
-
"@eslint-react/shared": "3.0.0-next.
|
|
51
|
-
"@eslint-react/var": "3.0.0-next.
|
|
52
|
-
"@eslint-react/core": "3.0.0-next.
|
|
48
|
+
"@eslint-react/ast": "3.0.0-next.57",
|
|
49
|
+
"@eslint-react/eff": "3.0.0-next.57",
|
|
50
|
+
"@eslint-react/shared": "3.0.0-next.57",
|
|
51
|
+
"@eslint-react/var": "3.0.0-next.57",
|
|
52
|
+
"@eslint-react/core": "3.0.0-next.57"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/react": "^19.2.14",
|
|
56
56
|
"@types/react-dom": "^19.2.3",
|
|
57
|
-
"
|
|
57
|
+
"eslint": "^10.0.2",
|
|
58
|
+
"tsdown": "^0.21.0-beta.2",
|
|
58
59
|
"tsl-dx": "^0.8.0",
|
|
59
60
|
"@local/configs": "0.0.0"
|
|
60
61
|
},
|