eslint-config-typed 3.8.1 → 3.10.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/README.md +1 -1
- package/dist/plugins/react-coding-style/rules/ban-use-imperative-handle-hook.mjs +4 -4
- package/dist/plugins/react-coding-style/rules/ban-use-imperative-handle-hook.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/component-name.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/component-name.mjs +5 -3
- package/dist/plugins/react-coding-style/rules/component-name.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/display-name.d.mts +14 -0
- package/dist/plugins/react-coding-style/rules/display-name.d.mts.map +1 -0
- package/dist/plugins/react-coding-style/rules/display-name.mjs +86 -0
- package/dist/plugins/react-coding-style/rules/display-name.mjs.map +1 -0
- package/dist/plugins/react-coding-style/rules/import-style.d.mts +8 -2
- package/dist/plugins/react-coding-style/rules/import-style.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/import-style.mjs +63 -26
- package/dist/plugins/react-coding-style/rules/import-style.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/props-type-annotation-style.mjs +2 -2
- package/dist/plugins/react-coding-style/rules/props-type-annotation-style.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/react-memo-props-argument-name.mjs +2 -2
- package/dist/plugins/react-coding-style/rules/react-memo-props-argument-name.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/react-memo-type-parameter.mjs +2 -2
- package/dist/plugins/react-coding-style/rules/react-memo-type-parameter.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/rules.d.mts +6 -1
- package/dist/plugins/react-coding-style/rules/rules.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/rules.mjs +2 -0
- package/dist/plugins/react-coding-style/rules/rules.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/shared.d.mts +7 -3
- package/dist/plugins/react-coding-style/rules/shared.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/shared.mjs +61 -3
- package/dist/plugins/react-coding-style/rules/shared.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/use-memo-hooks-style.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/use-memo-hooks-style.mjs +45 -3
- package/dist/plugins/react-coding-style/rules/use-memo-hooks-style.mjs.map +1 -1
- package/dist/plugins/ts-restrictions/rules/check-destructuring-completeness.d.mts.map +1 -1
- package/dist/plugins/ts-restrictions/rules/check-destructuring-completeness.mjs +46 -46
- package/dist/plugins/ts-restrictions/rules/check-destructuring-completeness.mjs.map +1 -1
- package/dist/rules/eslint-import-rules.d.mts +1 -3
- package/dist/rules/eslint-import-rules.d.mts.map +1 -1
- package/dist/rules/eslint-import-rules.mjs +3 -1
- package/dist/rules/eslint-import-rules.mjs.map +1 -1
- package/dist/rules/eslint-react-coding-style-rules.d.mts +6 -1
- package/dist/rules/eslint-react-coding-style-rules.d.mts.map +1 -1
- package/dist/rules/eslint-react-coding-style-rules.mjs +3 -2
- package/dist/rules/eslint-react-coding-style-rules.mjs.map +1 -1
- package/dist/types/rules/eslint-react-coding-style-rules.d.mts +69 -2
- package/dist/types/rules/eslint-react-coding-style-rules.d.mts.map +1 -1
- package/package.json +1 -1
- package/src/plugins/react-coding-style/README.md +22 -0
- package/src/plugins/react-coding-style/rules/ban-use-imperative-handle-hook.mts +4 -4
- package/src/plugins/react-coding-style/rules/ban-use-imperative-handle-hook.test.mts +50 -18
- package/src/plugins/react-coding-style/rules/component-name.mts +6 -3
- package/src/plugins/react-coding-style/rules/display-name.mts +117 -0
- package/src/plugins/react-coding-style/rules/display-name.test.mts +87 -0
- package/src/plugins/react-coding-style/rules/import-style.mts +92 -34
- package/src/plugins/react-coding-style/rules/import-style.test.mts +81 -34
- package/src/plugins/react-coding-style/rules/props-type-annotation-style.mts +2 -2
- package/src/plugins/react-coding-style/rules/react-memo-props-argument-name.mts +2 -2
- package/src/plugins/react-coding-style/rules/react-memo-type-parameter.mts +2 -2
- package/src/plugins/react-coding-style/rules/rules.mts +2 -0
- package/src/plugins/react-coding-style/rules/shared.mts +92 -7
- package/src/plugins/react-coding-style/rules/use-memo-hooks-style-named.test.mts +162 -0
- package/src/plugins/react-coding-style/rules/use-memo-hooks-style-namespace.test.mts +162 -0
- package/src/plugins/react-coding-style/rules/use-memo-hooks-style.mts +68 -3
- package/src/plugins/ts-restrictions/rules/check-destructuring-completeness.mts +59 -59
- package/src/rules/eslint-import-rules.mts +4 -1
- package/src/rules/eslint-react-coding-style-rules.mts +3 -2
- package/src/types/rules/eslint-react-coding-style-rules.mts +78 -2
- package/src/plugins/react-coding-style/rules/use-memo-hooks-style.test.mts +0 -72
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
-
import { castDeepMutable } from 'ts-data-forge';
|
|
3
|
-
import {
|
|
2
|
+
import { castDeepMutable, hasKey } from 'ts-data-forge';
|
|
3
|
+
import { isReactApiCall } from './shared.mjs';
|
|
4
4
|
|
|
5
5
|
const useMemoHooksStyleRule = {
|
|
6
6
|
meta: {
|
|
@@ -15,7 +15,7 @@ const useMemoHooksStyleRule = {
|
|
|
15
15
|
},
|
|
16
16
|
create: (context) => ({
|
|
17
17
|
CallExpression: (node) => {
|
|
18
|
-
if (!
|
|
18
|
+
if (!isReactApiCall(context, node, 'useMemo')) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
const parent = node.parent;
|
|
@@ -33,10 +33,52 @@ const useMemoHooksStyleRule = {
|
|
|
33
33
|
messageId: 'disallowUseMemoTypeAnnotation',
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
+
const [firstArg] = node.arguments;
|
|
37
|
+
if (firstArg?.type === AST_NODE_TYPES.ArrowFunctionExpression) {
|
|
38
|
+
const { returnType, body } = firstArg;
|
|
39
|
+
if (returnType !== undefined) {
|
|
40
|
+
context.report({
|
|
41
|
+
node: castDeepMutable(returnType),
|
|
42
|
+
messageId: 'disallowUseMemoTypeAnnotation',
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
checkNodeForTypeAnnotations(context, body);
|
|
46
|
+
}
|
|
36
47
|
},
|
|
37
48
|
}),
|
|
38
49
|
defaultOptions: [],
|
|
39
50
|
};
|
|
51
|
+
const checkNodeForTypeAnnotations = (context, node) => {
|
|
52
|
+
if (node.type === AST_NODE_TYPES.TSAsExpression ||
|
|
53
|
+
node.type === AST_NODE_TYPES.TSTypeAssertion ||
|
|
54
|
+
node.type === AST_NODE_TYPES.TSSatisfiesExpression) {
|
|
55
|
+
context.report({
|
|
56
|
+
node: castDeepMutable(node),
|
|
57
|
+
messageId: 'disallowUseMemoTypeAnnotation',
|
|
58
|
+
});
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (hasKey(node, 'body')) {
|
|
62
|
+
const nodeWithBody = node;
|
|
63
|
+
if (nodeWithBody.body !== undefined && nodeWithBody.body !== null) {
|
|
64
|
+
checkNodeForTypeAnnotations(context,
|
|
65
|
+
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
66
|
+
nodeWithBody.body);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (hasKey(node, 'expression')) {
|
|
70
|
+
const nodeWithExpression = node;
|
|
71
|
+
checkNodeForTypeAnnotations(context,
|
|
72
|
+
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
73
|
+
nodeWithExpression.expression);
|
|
74
|
+
}
|
|
75
|
+
if (hasKey(node, 'argument')) {
|
|
76
|
+
const nodeWithArgument = node;
|
|
77
|
+
checkNodeForTypeAnnotations(context,
|
|
78
|
+
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
79
|
+
nodeWithArgument.argument);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
40
82
|
|
|
41
83
|
export { useMemoHooksStyleRule };
|
|
42
84
|
//# sourceMappingURL=use-memo-hooks-style.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-memo-hooks-style.mjs","sources":["../../../../src/plugins/react-coding-style/rules/use-memo-hooks-style.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAUO,MAAM,qBAAqB,GAAoC;AACpE,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,YAAY;AAClB,QAAA,IAAI,EAAE;AACJ,YAAA,WAAW,EACT,oEAAoE;AACvE,SAAA;AACD,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,QAAQ,EAAE;AACR,YAAA,6BAA6B,EAC3B,qGAAqG;AACxG,SAAA;AACF,KAAA;AACD,IAAA,MAAM,EAAE,CAAC,OAAO,MAAM;AACpB,QAAA,cAAc,EAAE,CAAC,IAA2C,KAAI;YAC9D,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"use-memo-hooks-style.mjs","sources":["../../../../src/plugins/react-coding-style/rules/use-memo-hooks-style.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAUO,MAAM,qBAAqB,GAAoC;AACpE,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,YAAY;AAClB,QAAA,IAAI,EAAE;AACJ,YAAA,WAAW,EACT,oEAAoE;AACvE,SAAA;AACD,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,QAAQ,EAAE;AACR,YAAA,6BAA6B,EAC3B,qGAAqG;AACxG,SAAA;AACF,KAAA;AACD,IAAA,MAAM,EAAE,CAAC,OAAO,MAAM;AACpB,QAAA,cAAc,EAAE,CAAC,IAA2C,KAAI;YAC9D,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE;gBAC7C;YACF;AAEA,YAAA,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM;AAE1B,YAAA,IACE,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,cAAc;AAC7C,gBAAA,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,eAAe;AAC9C,gBAAA,MAAM,CAAC,IAAI,KA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ACF;AAEA,IAAA,IAAI,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE;QACxB,MAAM,YAAY,GAAG,IAAI;AAEzB,QAAA,IAAI,YAAY,CAAC,IAAI,KAAK,SAAS,IAAI,YAAY,CAAC,IAAI,KAAK,IAAI,EAAE;AACjE,YAAA,2BAA2B,CACzB,OAAO;;YAEP,YAAY,CAAC,IAAmC,CACjD;QACH;IACF;AAEA,IAAA,IAAI,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE;QAC9B,MAAM,kBAAkB,GAAG,IAAI;AAE/B,QAAA,2BAA2B,CACzB,OAAO;;QAEP,kBAAkB,CAAC,UAAyC,CAC7D;IACH;AAEA,IAAA,IAAI,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE;QAC5B,MAAM,gBAAgB,GAAG,IAAI;AAE7B,QAAA,2BAA2B,CACzB,OAAO;;QAEP,gBAAgB,CAAC,QAAuC,CACzD;IACH;AACF,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-destructuring-completeness.d.mts","sourceRoot":"","sources":["../../../../src/plugins/ts-restrictions/rules/check-destructuring-completeness.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EAEd,MAAM,0BAA0B,CAAC;AAGlC,KAAK,OAAO,GAAG,SAAS;IACtB,QAAQ,CAAC;QACP,8BAA8B,CAAC,EAAE,OAAO,CAAC;QACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC,CAAC;CACJ,CAAC;AAEF,KAAK,UAAU,GAAG,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"check-destructuring-completeness.d.mts","sourceRoot":"","sources":["../../../../src/plugins/ts-restrictions/rules/check-destructuring-completeness.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EAEd,MAAM,0BAA0B,CAAC;AAGlC,KAAK,OAAO,GAAG,SAAS;IACtB,QAAQ,CAAC;QACP,8BAA8B,CAAC,EAAE,OAAO,CAAC;QACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC,CAAC;CACJ,CAAC;AAEF,KAAK,UAAU,GAAG,yBAAyB,CAAC;AAI5C,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,UAAU,CAC9D,UAAU,EACV,OAAO,CAmOR,CAAC"}
|
|
@@ -1,51 +1,6 @@
|
|
|
1
1
|
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
2
|
|
|
3
3
|
const DEFAULT_DIRECTIVE_KEYWORD = '@check-destructuring-completeness';
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
5
|
-
const getObjectTypeProperties = (type) => {
|
|
6
|
-
try {
|
|
7
|
-
const properties = type.getProperties();
|
|
8
|
-
// Limit to reasonable number of properties to avoid hangs
|
|
9
|
-
if (properties.length > 1000) {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
return properties
|
|
13
|
-
.map((prop) => prop.name)
|
|
14
|
-
.filter((name) =>
|
|
15
|
-
// Filter out symbol properties and internal properties
|
|
16
|
-
!name.startsWith('__') &&
|
|
17
|
-
// Only include string property names
|
|
18
|
-
typeof name === 'string' &&
|
|
19
|
-
name.length > 0);
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
// If there's any error getting properties, return empty array
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const isReactComponentFunction = (node) => {
|
|
27
|
-
if (node === undefined || node === null)
|
|
28
|
-
return false;
|
|
29
|
-
// Arrow function component
|
|
30
|
-
if (node.type === AST_NODE_TYPES.ArrowFunctionExpression) {
|
|
31
|
-
const { body } = node;
|
|
32
|
-
if (body.type === AST_NODE_TYPES.BlockStatement) {
|
|
33
|
-
return body.body.some((statement) => {
|
|
34
|
-
if (statement.type !== AST_NODE_TYPES.ReturnStatement)
|
|
35
|
-
return false;
|
|
36
|
-
const { argument } = statement;
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
38
|
-
if (argument === null || argument === undefined)
|
|
39
|
-
return false;
|
|
40
|
-
const argType = argument.type;
|
|
41
|
-
return argType === 'JSXElement' || argType === 'JSXFragment';
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
const bodyType = body.type;
|
|
45
|
-
return bodyType === 'JSXElement' || bodyType === 'JSXFragment';
|
|
46
|
-
}
|
|
47
|
-
return false;
|
|
48
|
-
};
|
|
49
4
|
const checkDestructuringCompleteness = {
|
|
50
5
|
meta: {
|
|
51
6
|
type: 'suggestion',
|
|
@@ -210,7 +165,52 @@ const checkDestructuringCompleteness = {
|
|
|
210
165
|
},
|
|
211
166
|
};
|
|
212
167
|
},
|
|
213
|
-
defaultOptions: [],
|
|
168
|
+
defaultOptions: [{ alwaysCheckReactComponentProps: true }],
|
|
169
|
+
};
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
171
|
+
const getObjectTypeProperties = (type) => {
|
|
172
|
+
try {
|
|
173
|
+
const properties = type.getProperties();
|
|
174
|
+
// Limit to reasonable number of properties to avoid hangs
|
|
175
|
+
if (properties.length > 1000) {
|
|
176
|
+
return [];
|
|
177
|
+
}
|
|
178
|
+
return properties
|
|
179
|
+
.map((prop) => prop.name)
|
|
180
|
+
.filter((name) =>
|
|
181
|
+
// Filter out symbol properties and internal properties
|
|
182
|
+
!name.startsWith('__') &&
|
|
183
|
+
// Only include string property names
|
|
184
|
+
typeof name === 'string' &&
|
|
185
|
+
name.length > 0);
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
// If there's any error getting properties, return empty array
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
const isReactComponentFunction = (node) => {
|
|
193
|
+
if (node === undefined || node === null)
|
|
194
|
+
return false;
|
|
195
|
+
// Arrow function component
|
|
196
|
+
if (node.type === AST_NODE_TYPES.ArrowFunctionExpression) {
|
|
197
|
+
const { body } = node;
|
|
198
|
+
if (body.type === AST_NODE_TYPES.BlockStatement) {
|
|
199
|
+
return body.body.some((statement) => {
|
|
200
|
+
if (statement.type !== AST_NODE_TYPES.ReturnStatement)
|
|
201
|
+
return false;
|
|
202
|
+
const { argument } = statement;
|
|
203
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
204
|
+
if (argument === null || argument === undefined)
|
|
205
|
+
return false;
|
|
206
|
+
const argType = argument.type;
|
|
207
|
+
return argType === 'JSXElement' || argType === 'JSXFragment';
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
const bodyType = body.type;
|
|
211
|
+
return bodyType === 'JSXElement' || bodyType === 'JSXFragment';
|
|
212
|
+
}
|
|
213
|
+
return false;
|
|
214
214
|
};
|
|
215
215
|
|
|
216
216
|
export { checkDestructuringCompleteness };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-destructuring-completeness.mjs","sources":["../../../../src/plugins/ts-restrictions/rules/check-destructuring-completeness.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAgBA,MAAM,yBAAyB,GAAG,mCAAmC;
|
|
1
|
+
{"version":3,"file":"check-destructuring-completeness.mjs","sources":["../../../../src/plugins/ts-restrictions/rules/check-destructuring-completeness.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAgBA,MAAM,yBAAyB,GAAG,mCAAmC;AAE9D,MAAM,8BAA8B,GAGvC;AACF,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,YAAY;AAClB,QAAA,IAAI,EAAE;AACJ,YAAA,WAAW,EACT,iFAAiF;AACpF,SAAA;AACD,QAAA,MAAM,EAAE;AACN,YAAA;AACE,gBAAA,IAAI,EAAE,QAAQ;AACd,gBAAA,UAAU,EAAE;AACV,oBAAA,8BAA8B,EAAE;AAC9B,wBAAA,IAAI,EAAE,SAAS;AACf,wBAAA,WAAW,EACT,4EAA4E;AAC/E,qBAAA;AACD,oBA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AK;AAEnE,gBAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS;;AAG9B,gBAAA,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS;AAAE,oBAAA,OAAO,KAAK;AAE7D,gBAAA,MAAM,OAAO,GAAI,QAA8B,CAAC,IAAI;AAEpD,gBAAA,OAAO,OAAO,KAAK,YAAY,IAAI,OAAO,KAAK,aAAa;AAC9D,YAAA,CAAC,CAAC;QACJ;AAEA,QAAA,MAAM,QAAQ,GAAI,IAA0B,CAAC,IAAI;AAEjD,QAAA,OAAO,QAAQ,KAAK,YAAY,IAAI,QAAQ,KAAK,aAAa;IAChE;AAEA,IAAA,OAAO,KAAK;AACd,CAAC;;;;"}
|
|
@@ -60,9 +60,7 @@ export declare const eslintImportsRules: {
|
|
|
60
60
|
readonly 'import-x/dynamic-import-chunkname': "off";
|
|
61
61
|
readonly 'import-x/no-empty-named-blocks': "error";
|
|
62
62
|
readonly 'import-x/no-rename-default': 2 | 1;
|
|
63
|
-
readonly 'import-x/prefer-namespace-import':
|
|
64
|
-
readonly patterns: readonly ["react"];
|
|
65
|
-
}];
|
|
63
|
+
readonly 'import-x/prefer-namespace-import': "off";
|
|
66
64
|
readonly 'import-x/imports-first': 0;
|
|
67
65
|
};
|
|
68
66
|
//# sourceMappingURL=eslint-import-rules.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-import-rules.d.mts","sourceRoot":"","sources":["../../src/rules/eslint-import-rules.mts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiH7B;;;OAGG
|
|
1
|
+
{"version":3,"file":"eslint-import-rules.d.mts","sourceRoot":"","sources":["../../src/rules/eslint-import-rules.mts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiH7B;;;OAGG;;;;;;;;;;CAsBkC,CAAC"}
|
|
@@ -114,7 +114,9 @@ const eslintImportsRules = {
|
|
|
114
114
|
// Covered by unicorn/prefer-node-protocol
|
|
115
115
|
// 'import/enforce-node-protocol-usage': ['error', 'always'],
|
|
116
116
|
'import-x/no-rename-default': withDefaultOption('error'),
|
|
117
|
-
|
|
117
|
+
// Covered by react-coding-style/import-style
|
|
118
|
+
'import-x/prefer-namespace-import': 'off',
|
|
119
|
+
// 'import-x/prefer-namespace-import': ['error', { patterns: ['react'] }],
|
|
118
120
|
// deprecated rules
|
|
119
121
|
'import-x/imports-first': 0,
|
|
120
122
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-import-rules.mjs","sources":["../../src/rules/eslint-import-rules.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAGO,MAAM,kBAAkB,GAAG;;AAEhC,IAAA,wBAAwB,EAAE,KAAK;;AAG/B,IAAA,gBAAgB,EAAE,KAAK;AAEvB,IAAA,kBAAkB,EAAE,OAAO;AAC3B,IAAA,oBAAoB,EAAE,iBAAiB,CAAC,OAAO,CAAC;IAChD,8BAA8B,EAAE,KAAK;AACrC,IAAA,2BAA2B,EAAE,iBAAiB,CAAC,OAAO,CAAC;AACvD,IAAA,6BAA6B,EAAE,iBAAiB,CAAC,OAAO,CAAC;AACzD,IAAA,8BAA8B,EAAE;QAC9B,OAAO;AACP,QAAA;AACE,YAAA,KAAK,EAAE;AACL,gBAAA,CAAA,SAAA,EAAY,gBAAgB,CAAA,CAAA,CAAG;AAC/B,gBAAA,CAAA,SAAA,EAAY,gBAAgB,CAAA,CAAA,CAAG;gBAC/B,gBAAgB;gBAChB,cAAc;gBACd,8BAA8B;gBAC9B,kBAAkB;gBAClB,WAAW;gBACX,UAAU;gBACV,YAAY;gBACZ,uBAAuB;gBACvB,gBAAgB;gBAChB,iBAAiB;gBACjB,eAAe;gBACf,gBAAgB;gBAChB,yCAAyC;gBACzC,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;AACtB,YAAA,KAAK,EAAE,CAAC;AACT,SAAA;AACF,KAAA;AAED,IAAA,gCAAgC,EAAE,KAAK;AACvC,IAAA,2BAA2B,EAAE,KAAK;AAClC,IAAA,+BAA+B,EAAE;QAC/B,OAAO;AACP,QAAA;AACE,YAAA,KAAK,EAAE;gBACL,UAAU;gBACV,8BAA8B;gBAC9B,UAAU;gBACV,YAAY;AACb,aAAA;AACF,SAAA;AACF,KAAA;AACD,IAAA,2BAA2B,EAAE,KAAK;AAElC;;;AAGG;AACH,IAAA,4BAA4B,EAAE,OAAO;AAErC,IAAA,0BAA0B,EAAE,KAAK;AACjC,IAAA,sCAAsC,EAAE,iBAAiB,CAAC,OAAO,CAAC;AAClE,IAAA,wBAAwB,EAAE,KAAK;AAE/B,IAAA,mCAAmC,EAAE,KAAK;AAE1C,IAAA,gCAAgC,EAAE,OAAO;;;AAKzC,IAAA,4BAA4B,EAAE,iBAAiB,CAAC,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"eslint-import-rules.mjs","sources":["../../src/rules/eslint-import-rules.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAGO,MAAM,kBAAkB,GAAG;;AAEhC,IAAA,wBAAwB,EAAE,KAAK;;AAG/B,IAAA,gBAAgB,EAAE,KAAK;AAEvB,IAAA,kBAAkB,EAAE,OAAO;AAC3B,IAAA,oBAAoB,EAAE,iBAAiB,CAAC,OAAO,CAAC;IAChD,8BAA8B,EAAE,KAAK;AACrC,IAAA,2BAA2B,EAAE,iBAAiB,CAAC,OAAO,CAAC;AACvD,IAAA,6BAA6B,EAAE,iBAAiB,CAAC,OAAO,CAAC;AACzD,IAAA,8BAA8B,EAAE;QAC9B,OAAO;AACP,QAAA;AACE,YAAA,KAAK,EAAE;AACL,gBAAA,CAAA,SAAA,EAAY,gBAAgB,CAAA,CAAA,CAAG;AAC/B,gBAAA,CAAA,SAAA,EAAY,gBAAgB,CAAA,CAAA,CAAG;gBAC/B,gBAAgB;gBAChB,cAAc;gBACd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G,EAAE,QAAQ,EAAE;AAC3C,SAAA;AACF,KAAA;IAED,gBAAgB,EAAE,KAAK;;;;;;;;AAQvB,IAAA,+BAA+B,EAAE;QAC/B,OAAO;AACP,QAAA;AACE,YAAA,gBAAgB,EAAE,IAAI;AACtB,YAAA,KAAK,EAAE,CAAC;AACT,SAAA;AACF,KAAA;AAED,IAAA,gCAAgC,EAAE,KAAK;AACvC,IAAA,2BAA2B,EAAE,KAAK;AAClC,IAAA,+BAA+B,EAAE;QAC/B,OAAO;AACP,QAAA;AACE,YAAA,KAAK,EAAE;gBACL,UAAU;gBACV,8BAA8B;gBAC9B,UAAU;gBACV,YAAY;AACb,aAAA;AACF,SAAA;AACF,KAAA;AACD,IAAA,2BAA2B,EAAE,KAAK;AAElC;;;AAGG;AACH,IAAA,4BAA4B,EAAE,OAAO;AAErC,IAAA,0BAA0B,EAAE,KAAK;AACjC,IAAA,sCAAsC,EAAE,iBAAiB,CAAC,OAAO,CAAC;AAClE,IAAA,wBAAwB,EAAE,KAAK;AAE/B,IAAA,mCAAmC,EAAE,KAAK;AAE1C,IAAA,gCAAgC,EAAE,OAAO;;;AAKzC,IAAA,4BAA4B,EAAE,iBAAiB,CAAC,OAAO,CAAC;;AAGxD,IAAA,kCAAkC,EAAE,KAAK;;;AAIzC,IAAA,wBAAwB,EAAE,CAAC;;;;;"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare const eslintReactCodingStyleRules: {
|
|
2
|
-
readonly 'react-coding-style/import-style': "
|
|
2
|
+
readonly 'react-coding-style/import-style': readonly ["error", {
|
|
3
|
+
readonly importStyle: "namespace";
|
|
4
|
+
}];
|
|
3
5
|
readonly 'react-coding-style/component-name': readonly ["error", {
|
|
4
6
|
readonly maxLength: 42;
|
|
5
7
|
}];
|
|
@@ -9,5 +11,8 @@ export declare const eslintReactCodingStyleRules: {
|
|
|
9
11
|
readonly 'react-coding-style/react-memo-type-parameter': "error";
|
|
10
12
|
readonly 'react-coding-style/ban-use-imperative-handle-hook': "error";
|
|
11
13
|
readonly 'react-coding-style/use-memo-hook-style': "error";
|
|
14
|
+
readonly 'react-coding-style/display-name': readonly ["error", {
|
|
15
|
+
readonly ignoreTranspilerName: false;
|
|
16
|
+
}];
|
|
12
17
|
};
|
|
13
18
|
//# sourceMappingURL=eslint-react-coding-style-rules.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-react-coding-style-rules.d.mts","sourceRoot":"","sources":["../../src/rules/eslint-react-coding-style-rules.mts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B
|
|
1
|
+
{"version":3,"file":"eslint-react-coding-style-rules.d.mts","sourceRoot":"","sources":["../../src/rules/eslint-react-coding-style-rules.mts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;CAYQ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const eslintReactCodingStyleRules = {
|
|
2
|
-
//
|
|
3
|
-
'react-coding-style/import-style': '
|
|
2
|
+
// import-x/prefer-namespace-import checks similar things, but this rule enforces more strict style.
|
|
3
|
+
'react-coding-style/import-style': ['error', { importStyle: 'namespace' }],
|
|
4
4
|
'react-coding-style/component-name': ['error', { maxLength: 42 }],
|
|
5
5
|
'react-coding-style/component-var-type-annotation': 'error',
|
|
6
6
|
'react-coding-style/props-type-annotation-style': 'error',
|
|
@@ -8,6 +8,7 @@ const eslintReactCodingStyleRules = {
|
|
|
8
8
|
'react-coding-style/react-memo-type-parameter': 'error',
|
|
9
9
|
'react-coding-style/ban-use-imperative-handle-hook': 'error',
|
|
10
10
|
'react-coding-style/use-memo-hook-style': 'error',
|
|
11
|
+
'react-coding-style/display-name': ['error', { ignoreTranspilerName: false }],
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
export { eslintReactCodingStyleRules };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-react-coding-style-rules.mjs","sources":["../../src/rules/eslint-react-coding-style-rules.mts"],"sourcesContent":[null],"names":[],"mappings":"AAEO,MAAM,2BAA2B,GAAG;;
|
|
1
|
+
{"version":3,"file":"eslint-react-coding-style-rules.mjs","sources":["../../src/rules/eslint-react-coding-style-rules.mts"],"sourcesContent":[null],"names":[],"mappings":"AAEO,MAAM,2BAA2B,GAAG;;IAEzC,iCAAiC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;IAE1E,mCAAmC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;AACjE,IAAA,kDAAkD,EAAE,OAAO;AAC3D,IAAA,gDAAgD,EAAE,OAAO;AACzD,IAAA,mDAAmD,EAAE,OAAO;AAC5D,IAAA,8CAA8C,EAAE,OAAO;AACvD,IAAA,mDAAmD,EAAE,OAAO;AAC5D,IAAA,wCAAwC,EAAE,OAAO;IACjD,iCAAiC,EAAE,CAAC,OAAO,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC;;;;;"}
|
|
@@ -53,7 +53,7 @@ declare namespace ComponentVarTypeAnnotation {
|
|
|
53
53
|
type RuleEntry = Linter.StringSeverity;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
* Enforces importing React with a
|
|
56
|
+
* Enforces importing React with a specific style (namespace or named imports).
|
|
57
57
|
*
|
|
58
58
|
* ```md
|
|
59
59
|
* | key | value |
|
|
@@ -63,7 +63,36 @@ declare namespace ComponentVarTypeAnnotation {
|
|
|
63
63
|
* ```
|
|
64
64
|
*/
|
|
65
65
|
declare namespace ImportStyle {
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* ### schema
|
|
68
|
+
*
|
|
69
|
+
* ```json
|
|
70
|
+
* [
|
|
71
|
+
* {
|
|
72
|
+
* "type": "object",
|
|
73
|
+
* "properties": {
|
|
74
|
+
* "importStyle": {
|
|
75
|
+
* "type": "string",
|
|
76
|
+
* "enum": [
|
|
77
|
+
* "namespace",
|
|
78
|
+
* "named"
|
|
79
|
+
* ],
|
|
80
|
+
* "description": "Import style to enforce: \"namespace\" for `import * as React` or \"named\" for `import { ... }`"
|
|
81
|
+
* }
|
|
82
|
+
* },
|
|
83
|
+
* "additionalProperties": false
|
|
84
|
+
* }
|
|
85
|
+
* ]
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
type Options = {
|
|
89
|
+
/**
|
|
90
|
+
* Import style to enforce: "namespace" for `import * as React` or "named"
|
|
91
|
+
* for `import { ... }`
|
|
92
|
+
*/
|
|
93
|
+
readonly importStyle?: 'named' | 'namespace';
|
|
94
|
+
};
|
|
95
|
+
type RuleEntry = Linter.Severity | SpreadOptionsIfIsArray<readonly [Linter.StringSeverity, Options]> | 'off';
|
|
67
96
|
}
|
|
68
97
|
/**
|
|
69
98
|
* Forbids annotating props directly in the arrow function passed to React.memo.
|
|
@@ -131,6 +160,41 @@ declare namespace UseMemoHookStyle {
|
|
|
131
160
|
declare namespace BanUseImperativeHandleHook {
|
|
132
161
|
type RuleEntry = Linter.StringSeverity;
|
|
133
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Require displayName property for React components created with React.memo
|
|
165
|
+
*
|
|
166
|
+
* ```md
|
|
167
|
+
* | key | value |
|
|
168
|
+
* | :--------- | :--------- |
|
|
169
|
+
* | type | suggestion |
|
|
170
|
+
* | deprecated | false |
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
declare namespace DisplayName {
|
|
174
|
+
/**
|
|
175
|
+
* ### schema
|
|
176
|
+
*
|
|
177
|
+
* ```json
|
|
178
|
+
* [
|
|
179
|
+
* {
|
|
180
|
+
* "type": "object",
|
|
181
|
+
* "properties": {
|
|
182
|
+
* "ignoreTranspilerName": {
|
|
183
|
+
* "type": "boolean",
|
|
184
|
+
* "description": "When true, ignores components that get displayName from variable name"
|
|
185
|
+
* }
|
|
186
|
+
* },
|
|
187
|
+
* "additionalProperties": false
|
|
188
|
+
* }
|
|
189
|
+
* ]
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
type Options = {
|
|
193
|
+
/** When true, ignores components that get displayName from variable name */
|
|
194
|
+
readonly ignoreTranspilerName?: boolean;
|
|
195
|
+
};
|
|
196
|
+
type RuleEntry = Linter.Severity | SpreadOptionsIfIsArray<readonly [Linter.StringSeverity, Options]> | 'off';
|
|
197
|
+
}
|
|
134
198
|
export type EslintReactCodingStyleRules = {
|
|
135
199
|
readonly 'react-coding-style/component-name': ComponentName.RuleEntry;
|
|
136
200
|
readonly 'react-coding-style/component-var-type-annotation': ComponentVarTypeAnnotation.RuleEntry;
|
|
@@ -140,9 +204,12 @@ export type EslintReactCodingStyleRules = {
|
|
|
140
204
|
readonly 'react-coding-style/react-memo-type-parameter': ReactMemoTypeParameter.RuleEntry;
|
|
141
205
|
readonly 'react-coding-style/use-memo-hook-style': UseMemoHookStyle.RuleEntry;
|
|
142
206
|
readonly 'react-coding-style/ban-use-imperative-handle-hook': BanUseImperativeHandleHook.RuleEntry;
|
|
207
|
+
readonly 'react-coding-style/display-name': DisplayName.RuleEntry;
|
|
143
208
|
};
|
|
144
209
|
export type EslintReactCodingStyleRulesOption = {
|
|
145
210
|
readonly 'react-coding-style/component-name': ComponentName.Options;
|
|
211
|
+
readonly 'react-coding-style/import-style': ImportStyle.Options;
|
|
212
|
+
readonly 'react-coding-style/display-name': DisplayName.Options;
|
|
146
213
|
};
|
|
147
214
|
export {};
|
|
148
215
|
//# sourceMappingURL=eslint-react-coding-style-rules.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-react-coding-style-rules.d.mts","sourceRoot":"","sources":["../../../src/types/rules/eslint-react-coding-style-rules.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,KAAK,sBAAsB,CACzB,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,IACjD,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,GAC/B,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GACzC,CAAC,CAAC;AAEN;;;;;;;;;;GAUG;AACH,kBAAU,aAAa,CAAC;IACtB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAY,OAAO,GAAG;QACpB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;KAClC,CAAC;IAEF,KAAY,SAAS,GACjB,MAAM,CAAC,QAAQ,GACf,sBAAsB,CAAC,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,GACjE,KAAK,CAAC;CACX;AAED;;;;;;;;;GASG;AACH,kBAAU,0BAA0B,CAAC;IACnC,KAAY,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;CAC/C;AAED;;;;;;;;;GASG;AACH,kBAAU,WAAW,CAAC;IACpB,KAAY,
|
|
1
|
+
{"version":3,"file":"eslint-react-coding-style-rules.d.mts","sourceRoot":"","sources":["../../../src/types/rules/eslint-react-coding-style-rules.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,KAAK,sBAAsB,CACzB,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,IACjD,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,GAC/B,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GACzC,CAAC,CAAC;AAEN;;;;;;;;;;GAUG;AACH,kBAAU,aAAa,CAAC;IACtB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAY,OAAO,GAAG;QACpB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,OAAO,CAAC,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AAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;KACzC,CAAC;IAEF,KAAY,SAAS,GACjB,MAAM,CAAC,QAAQ,GACf,sBAAsB,CAAC,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,GACjE,KAAK,CAAC;CACX;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,CAAC,mCAAmC,EAAE,aAAa,CAAC,SAAS,CAAC;IACtE,QAAQ,CAAC,kDAAkD,EAAE,0BAA0B,CAAC,SAAS,CAAC;IAClG,QAAQ,CAAC,iCAAiC,EAAE,WAAW,CAAC,SAAS,CAAC;IAClE,QAAQ,CAAC,gDAAgD,EAAE,wBAAwB,CAAC,SAAS,CAAC;IAC9F,QAAQ,CAAC,mDAAmD,EAAE,0BAA0B,CAAC,SAAS,CAAC;IACnG,QAAQ,CAAC,8CAA8C,EAAE,sBAAsB,CAAC,SAAS,CAAC;IAC1F,QAAQ,CAAC,wCAAwC,EAAE,gBAAgB,CAAC,SAAS,CAAC;IAC9E,QAAQ,CAAC,mDAAmD,EAAE,0BAA0B,CAAC,SAAS,CAAC;IACnG,QAAQ,CAAC,iCAAiC,EAAE,WAAW,CAAC,SAAS,CAAC;CACnE,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,QAAQ,CAAC,mCAAmC,EAAE,aAAa,CAAC,OAAO,CAAC;IACpE,QAAQ,CAAC,iCAAiC,EAAE,WAAW,CAAC,OAAO,CAAC;IAChE,QAAQ,CAAC,iCAAiC,EAAE,WAAW,CAAC,OAAO,CAAC;CACjE,CAAC"}
|
package/package.json
CHANGED
|
@@ -34,3 +34,25 @@ export const MemoWithoutProps = React.memo(() => <div>{1}</div>);
|
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
[typescript-eslint PlayGround](https://typescript-eslint.io/play/#ts=5.9.3&showAST=es&fileType=.tsx&code=JYWwDg9gTgLgBAKjgQwM5wEoFNkGN4BmUEIcARFDvmQN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ED-zztAoujgS4YzLljCBADa6qP7v1PGLcWI1Tbm9LWvIxKFhwXgtgYAqAbksOiOxlh2D1nrE0GYYASCkDsLgHo7swJOKImAeAEwZ5kJ4rY1wlA2DDCQFgvIQxzZXytl%2BHUts6psIas8Y%2B6IPjQHPuhAA9AAPUcMAAALAAJnEOcAAJEUwOgjvAADUTAUFiUgQkxhTAmkkRiNx3MISp1ruIt%2BedBn50AWo4B1ly5UkmSo%2BucCBoLlsqxDWZieRoPsZMLcmCRQhLeE0We31BgjDGEgBoANBJ%2BOqU%2BdcDYKCvCkiQMOlBaDrAWPY18YB1x7KcZ4ChXQspJiXpebMfdbzrwrLWAA3GAaRugKz-M3EEuYRQpSIFRY4zB5w4UQ0YXvFSB8skaSajpT%2BmcOpGRARCeZKzrKKkQOkIQJJhIAAl4p0CQEguQKCQL4H%2BvGZlRQAkAx4jPOY8UHBKlEM4gFmD6yNnfAwi4JiIAsM7GS%2BGIslqu3wO7eCudpbexGenKlsj%2BmQIxEsmZtK5laJNcRO1%2Bim4LmZVpfAfL2RbNQWMaJHS4kFVCGAbkZyhgqnim7Mw0xZjzxBZ67iyZuRZknvK%2BYPylRgGcBgcNQKRUKC9TmR8RZUlKRqIEfg5wQDnCAA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eFYDArugDTg2RGwAqkWgALdNADW6ACYBJIjPQAPWQEFo0dCTKUO6XgF8QhoA&tokens=false)
|
|
37
|
+
|
|
38
|
+
## `display-name`
|
|
39
|
+
|
|
40
|
+
Requires React components created with `React.memo` to have a `displayName` property for better debugging in React DevTools.
|
|
41
|
+
|
|
42
|
+
**Options:**
|
|
43
|
+
|
|
44
|
+
- `ignoreTranspilerName` (boolean, default: `false`): When true, ignores components that get displayName from variable name (many transpilers add this automatically).
|
|
45
|
+
|
|
46
|
+
**Examples:**
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// ❌ Bad
|
|
50
|
+
const MyComponent = React.memo(() => <div>Hello</div>);
|
|
51
|
+
|
|
52
|
+
// ✅ Good
|
|
53
|
+
const MyComponent = React.memo(() => <div>Hello</div>);
|
|
54
|
+
MyComponent.displayName = 'MyComponent';
|
|
55
|
+
|
|
56
|
+
// ✅ Good (with ignoreTranspilerName: true)
|
|
57
|
+
const MyComponent = React.memo(() => <div>Hello</div>);
|
|
58
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type TSESLint, type TSESTree } from '@typescript-eslint/utils';
|
|
2
2
|
import { castDeepMutable } from 'ts-data-forge';
|
|
3
|
-
import {
|
|
3
|
+
import { isReactApiCall } from './shared.mjs';
|
|
4
4
|
|
|
5
5
|
type MessageIds = 'disallowUseImperativeHandle';
|
|
6
6
|
|
|
@@ -18,10 +18,10 @@ export const banUseImperativeHandleHook: TSESLint.RuleModule<MessageIds> = {
|
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
create: (context) => ({
|
|
21
|
-
|
|
22
|
-
if (
|
|
21
|
+
CallExpression: (node: DeepReadonly<TSESTree.CallExpression>) => {
|
|
22
|
+
if (isReactApiCall(context, node, 'useImperativeHandle')) {
|
|
23
23
|
context.report({
|
|
24
|
-
node: castDeepMutable(node),
|
|
24
|
+
node: castDeepMutable(node.callee),
|
|
25
25
|
messageId: 'disallowUseImperativeHandle',
|
|
26
26
|
});
|
|
27
27
|
}
|
|
@@ -15,26 +15,58 @@ const tester = new RuleTester({
|
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
describe('ban-use-imperative-handle-hook', () => {
|
|
19
|
+
describe('namespace import (React.useImperativeHandle)', () => {
|
|
20
|
+
tester.run(ruleName, banUseImperativeHandleHook, {
|
|
21
|
+
valid: [],
|
|
22
|
+
invalid: [
|
|
23
|
+
{
|
|
24
|
+
name: 'Disallow React.useImperativeHandle',
|
|
25
|
+
code: dedent`
|
|
26
|
+
type Props = Readonly<{
|
|
27
|
+
readonly ref: unknown;
|
|
28
|
+
}>;
|
|
29
|
+
|
|
30
|
+
const Component = React.memo<Props>((props) => {
|
|
31
|
+
React.useImperativeHandle(props.ref, () => ({}));
|
|
32
|
+
return null;
|
|
33
|
+
});
|
|
34
|
+
`,
|
|
35
|
+
errors: [
|
|
36
|
+
{
|
|
37
|
+
messageId: 'disallowUseImperativeHandle',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
});
|
|
43
|
+
});
|
|
27
44
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
`,
|
|
33
|
-
errors: [
|
|
45
|
+
describe('named import (useImperativeHandle)', () => {
|
|
46
|
+
tester.run(ruleName, banUseImperativeHandleHook, {
|
|
47
|
+
valid: [],
|
|
48
|
+
invalid: [
|
|
34
49
|
{
|
|
35
|
-
|
|
50
|
+
name: 'Disallow useImperativeHandle',
|
|
51
|
+
code: dedent`
|
|
52
|
+
import { memo, useImperativeHandle } from 'react';
|
|
53
|
+
|
|
54
|
+
type Props = Readonly<{
|
|
55
|
+
readonly ref: unknown;
|
|
56
|
+
}>;
|
|
57
|
+
|
|
58
|
+
const Component = memo<Props>((props) => {
|
|
59
|
+
useImperativeHandle(props.ref, () => ({}));
|
|
60
|
+
return null;
|
|
61
|
+
});
|
|
62
|
+
`,
|
|
63
|
+
errors: [
|
|
64
|
+
{
|
|
65
|
+
messageId: 'disallowUseImperativeHandle',
|
|
66
|
+
},
|
|
67
|
+
],
|
|
36
68
|
},
|
|
37
69
|
],
|
|
38
|
-
}
|
|
39
|
-
|
|
70
|
+
});
|
|
71
|
+
});
|
|
40
72
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AST_NODE_TYPES, type TSESLint } from '@typescript-eslint/utils';
|
|
2
|
-
import {
|
|
2
|
+
import { isReactApiCall } from './shared.mjs';
|
|
3
3
|
|
|
4
4
|
type ComponentNameOption = Readonly<{
|
|
5
5
|
maxLength?: number;
|
|
@@ -60,12 +60,15 @@ export const componentNameRule: TSESLint.RuleModule<MessageIds, Options> = {
|
|
|
60
60
|
VariableDeclarator: (node) => {
|
|
61
61
|
if (
|
|
62
62
|
node.id.type !== AST_NODE_TYPES.Identifier ||
|
|
63
|
-
node.init?.type !== AST_NODE_TYPES.CallExpression
|
|
64
|
-
!isReactCallExpression(node.init, 'memo')
|
|
63
|
+
node.init?.type !== AST_NODE_TYPES.CallExpression
|
|
65
64
|
) {
|
|
66
65
|
return;
|
|
67
66
|
}
|
|
68
67
|
|
|
68
|
+
if (!isReactApiCall(context, node.init, 'memo')) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
69
72
|
if (node.id.name.length >= maxLength) {
|
|
70
73
|
context.report({
|
|
71
74
|
node: node.id,
|