eslint-plugin-react-features 1.2.9 → 1.2.10
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 +2 -2
- package/src/index.js +1 -179
- package/src/oxlint.js +1 -3
- package/src/rules/component-api/no-arbitrary-token-class.js +1 -74
- package/src/rules/component-api/no-default-test-id.js +1 -46
- package/src/rules/component-api/no-inline-style.js +1 -57
- package/src/rules/component-api/no-is-prefix-prop.js +1 -59
- package/src/rules/component-api/no-kind-prop-discriminator.js +1 -57
- package/src/rules/component-api/no-raw-color-literal.js +1 -55
- package/src/rules/component-api/no-wrapper-sub-component.js +1 -95
- package/src/rules/component-api/require-data-slot.js +1 -40
- package/src/rules/migration/react-class-to-hooks.js +1 -159
- package/src/rules/performance/no-unnecessary-rerenders.js +1 -185
- package/src/rules/performance/react-no-inline-functions.js +1 -187
- package/src/rules/performance/react-render-optimization.js +1 -256
- package/src/rules/react/checked-requires-onchange-or-readonly.js +1 -68
- package/src/rules/react/default-props-match-prop-types.js +1 -99
- package/src/rules/react/display-name.js +1 -133
- package/src/rules/react/hooks-exhaustive-deps.js +1 -466
- package/src/rules/react/jsx-handler-names.js +1 -50
- package/src/rules/react/jsx-key.js +1 -323
- package/src/rules/react/jsx-max-depth.js +1 -71
- package/src/rules/react/jsx-no-bind.js +1 -55
- package/src/rules/react/jsx-no-duplicate-props.js +1 -66
- package/src/rules/react/jsx-no-literals.js +1 -79
- package/src/rules/react/jsx-no-script-url.js +1 -119
- package/src/rules/react/jsx-no-target-blank.js +1 -163
- package/src/rules/react/no-access-state-in-setstate.js +1 -80
- package/src/rules/react/no-adjacent-inline-elements.js +1 -72
- package/src/rules/react/no-arrow-function-lifecycle.js +1 -57
- package/src/rules/react/no-children-prop.js +1 -54
- package/src/rules/react/no-danger-with-children.js +1 -99
- package/src/rules/react/no-danger.js +1 -43
- package/src/rules/react/no-deprecated.js +1 -130
- package/src/rules/react/no-did-mount-set-state.js +1 -50
- package/src/rules/react/no-did-update-set-state.js +1 -71
- package/src/rules/react/no-direct-mutation-state.js +3 -211
- package/src/rules/react/no-find-dom-node.js +1 -50
- package/src/rules/react/no-invalid-html-attribute.js +1 -80
- package/src/rules/react/no-is-mounted.js +1 -46
- package/src/rules/react/no-multi-comp.js +1 -150
- package/src/rules/react/no-namespace.js +1 -37
- package/src/rules/react/no-object-type-as-default-prop.js +1 -53
- package/src/rules/react/no-redundant-should-component-update.js +1 -50
- package/src/rules/react/no-render-return-value.js +1 -67
- package/src/rules/react/no-set-state.js +1 -45
- package/src/rules/react/no-string-refs.js +1 -61
- package/src/rules/react/no-this-in-sfc.js +1 -55
- package/src/rules/react/no-typos.js +1 -90
- package/src/rules/react/no-unescaped-entities.js +1 -44
- package/src/rules/react/no-unknown-property.js +1 -124
- package/src/rules/react/no-unsafe.js +1 -106
- package/src/rules/react/prefer-es6-class.js +1 -50
- package/src/rules/react/prefer-stateless-function.js +1 -126
- package/src/rules/react/prop-types.js +1 -143
- package/src/rules/react/react-in-jsx-scope.js +1 -86
- package/src/rules/react/require-default-props.js +1 -134
- package/src/rules/react/require-optimization.js +1 -397
- package/src/rules/react/require-render-return.js +1 -79
- package/src/rules/react/required-attributes.js +1 -185
- package/src/rules/react/sort-comp.js +1 -146
- package/src/rules/react/state-in-constructor.js +1 -95
- package/src/rules/react/static-property-placement.js +1 -122
- package/src/rules/react/void-dom-elements-no-children.js +1 -89
- package/src/types/index.js +1 -2
|
@@ -1,211 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
-
const eslint_devkit_2 = require("@interlace/eslint-devkit");
|
|
6
|
-
exports.noDirectMutationState = (0, eslint_devkit_1.createRule)({
|
|
7
|
-
name: 'no-direct-mutation-state',
|
|
8
|
-
meta: {
|
|
9
|
-
type: 'problem',
|
|
10
|
-
docs: {
|
|
11
|
-
url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-direct-mutation-state.md',
|
|
12
|
-
description: 'Prevent direct mutation of this.state that breaks React reconciliation',
|
|
13
|
-
},
|
|
14
|
-
hasSuggestions: true,
|
|
15
|
-
messages: {
|
|
16
|
-
noDirectMutationState: (0, eslint_devkit_2.formatLLMMessage)({
|
|
17
|
-
icon: eslint_devkit_2.MessageIcons.WARNING,
|
|
18
|
-
issueName: 'Direct State Mutation',
|
|
19
|
-
description: 'Never mutate this.state directly',
|
|
20
|
-
severity: 'HIGH',
|
|
21
|
-
fix: 'Use setState() or functional updates for immutable state changes',
|
|
22
|
-
documentationLink: 'https://react.dev/learn/state-and-lifecycle#state-updates-may-be-asynchronous',
|
|
23
|
-
}),
|
|
24
|
-
suggestSetState: (0, eslint_devkit_2.formatLLMMessage)({
|
|
25
|
-
icon: eslint_devkit_2.MessageIcons.WARNING,
|
|
26
|
-
issueName: 'State Update',
|
|
27
|
-
description: 'Use setState with object for state updates',
|
|
28
|
-
severity: 'MEDIUM',
|
|
29
|
-
fix: 'Use this.setState({ count: this.state.count + 1 })',
|
|
30
|
-
documentationLink: 'https://react.dev/reference/react/Component#setstate',
|
|
31
|
-
}),
|
|
32
|
-
suggestFunctionalUpdate: (0, eslint_devkit_2.formatLLMMessage)({
|
|
33
|
-
icon: eslint_devkit_2.MessageIcons.WARNING,
|
|
34
|
-
issueName: 'Functional State Update',
|
|
35
|
-
description: 'Use functional setState for immutable updates',
|
|
36
|
-
severity: 'MEDIUM',
|
|
37
|
-
fix: 'Use this.setState(prevState => ({ count: prevState.count + 1 }))',
|
|
38
|
-
documentationLink: 'https://react.dev/reference/react/Component#setstate',
|
|
39
|
-
}),
|
|
40
|
-
},
|
|
41
|
-
schema: [
|
|
42
|
-
{
|
|
43
|
-
type: 'object',
|
|
44
|
-
properties: {
|
|
45
|
-
allowInLifecycleMethods: {
|
|
46
|
-
type: 'boolean',
|
|
47
|
-
default: false,
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
additionalProperties: false,
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
},
|
|
54
|
-
defaultOptions: [{ allowInLifecycleMethods: false }],
|
|
55
|
-
create(context) {
|
|
56
|
-
const [options] = context.options;
|
|
57
|
-
const { allowInLifecycleMethods = false } = options || {};
|
|
58
|
-
let inClassComponent = false;
|
|
59
|
-
let inLifecycleMethod = false;
|
|
60
|
-
const classStack = [];
|
|
61
|
-
function isLifecycleMethod(methodName) {
|
|
62
|
-
const lifecycleMethods = [
|
|
63
|
-
'componentDidMount',
|
|
64
|
-
'componentDidUpdate',
|
|
65
|
-
'componentWillUnmount',
|
|
66
|
-
'componentWillMount',
|
|
67
|
-
'componentWillReceiveProps',
|
|
68
|
-
'componentWillUpdate',
|
|
69
|
-
'shouldComponentUpdate',
|
|
70
|
-
'getSnapshotBeforeUpdate',
|
|
71
|
-
'getDerivedStateFromProps',
|
|
72
|
-
'getDerivedStateFromError',
|
|
73
|
-
'componentDidCatch',
|
|
74
|
-
];
|
|
75
|
-
return lifecycleMethods.includes(methodName);
|
|
76
|
-
}
|
|
77
|
-
function isInReactClassComponent() {
|
|
78
|
-
return inClassComponent;
|
|
79
|
-
}
|
|
80
|
-
function reportStateMutation(node, mutationType) {
|
|
81
|
-
if (!isInReactClassComponent()) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
if (allowInLifecycleMethods && inLifecycleMethod) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
context.report({
|
|
88
|
-
node,
|
|
89
|
-
messageId: 'noDirectMutationState',
|
|
90
|
-
data: {
|
|
91
|
-
mutationType,
|
|
92
|
-
context: inLifecycleMethod ? 'lifecycle method' : 'regular method',
|
|
93
|
-
},
|
|
94
|
-
suggest: [
|
|
95
|
-
{
|
|
96
|
-
messageId: 'suggestSetState',
|
|
97
|
-
fix(fixer) {
|
|
98
|
-
const sourceCode = context.sourceCode;
|
|
99
|
-
const start = node.range[0];
|
|
100
|
-
const lineStart = sourceCode.getIndexFromLoc({
|
|
101
|
-
line: sourceCode.getLocFromIndex(start).line,
|
|
102
|
-
column: 0
|
|
103
|
-
});
|
|
104
|
-
const lineText = sourceCode.getText().slice(lineStart, start);
|
|
105
|
-
const indent = lineText.slice(0, lineText.length - lineText.trimStart().length);
|
|
106
|
-
return fixer.insertTextBefore(node, `// TODO: Use setState instead of direct mutation\n${indent}`);
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
messageId: 'suggestFunctionalUpdate',
|
|
111
|
-
fix(fixer) {
|
|
112
|
-
const sourceCode = context.sourceCode;
|
|
113
|
-
const start = node.range[0];
|
|
114
|
-
const lineStart = sourceCode.getIndexFromLoc({
|
|
115
|
-
line: sourceCode.getLocFromIndex(start).line,
|
|
116
|
-
column: 0
|
|
117
|
-
});
|
|
118
|
-
const lineText = sourceCode.getText().slice(lineStart, start);
|
|
119
|
-
const indent = lineText.slice(0, lineText.length - lineText.trimStart().length);
|
|
120
|
-
return fixer.insertTextBefore(node, `// TODO: Use functional setState for immutable updates\n${indent}`);
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
function isStatePropertyAccess(target) {
|
|
127
|
-
if (target.type === 'MemberExpression' &&
|
|
128
|
-
target.object.type === 'MemberExpression' &&
|
|
129
|
-
target.object.object.type === 'ThisExpression' &&
|
|
130
|
-
target.object.property.type === 'Identifier' &&
|
|
131
|
-
target.object.property.name === 'state') {
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
if (target.type === 'MemberExpression') {
|
|
135
|
-
return isStatePropertyAccess(target.object);
|
|
136
|
-
}
|
|
137
|
-
if (target.type === 'LogicalExpression') {
|
|
138
|
-
return isStatePropertyAccess(target.left);
|
|
139
|
-
}
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
return {
|
|
143
|
-
ClassDeclaration(node) {
|
|
144
|
-
if (node.superClass) {
|
|
145
|
-
if (node.superClass.type === 'Identifier' &&
|
|
146
|
-
['Component', 'PureComponent'].includes(node.superClass.name)) {
|
|
147
|
-
inClassComponent = true;
|
|
148
|
-
classStack.push(true);
|
|
149
|
-
}
|
|
150
|
-
else if (node.superClass.type === 'MemberExpression' &&
|
|
151
|
-
node.superClass.object.type === 'Identifier' &&
|
|
152
|
-
node.superClass.object.name === 'React' &&
|
|
153
|
-
node.superClass.property.type === 'Identifier' &&
|
|
154
|
-
['Component', 'PureComponent'].includes(node.superClass.property.name)) {
|
|
155
|
-
inClassComponent = true;
|
|
156
|
-
classStack.push(true);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
'ClassDeclaration:exit'() {
|
|
161
|
-
classStack.pop();
|
|
162
|
-
inClassComponent = classStack.length > 0 && classStack[classStack.length - 1];
|
|
163
|
-
},
|
|
164
|
-
MethodDefinition(node) {
|
|
165
|
-
if (node.key.type === 'Identifier') {
|
|
166
|
-
inLifecycleMethod = isLifecycleMethod(node.key.name);
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
'MethodDefinition:exit'() {
|
|
170
|
-
inLifecycleMethod = false;
|
|
171
|
-
},
|
|
172
|
-
AssignmentExpression(node) {
|
|
173
|
-
if (node.left.type === 'MemberExpression') {
|
|
174
|
-
if (isStatePropertyAccess(node.left)) {
|
|
175
|
-
reportStateMutation(node, 'assignment');
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
UpdateExpression(node) {
|
|
180
|
-
if (node.argument.type === 'MemberExpression') {
|
|
181
|
-
if (isStatePropertyAccess(node.argument)) {
|
|
182
|
-
reportStateMutation(node, 'update');
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
UnaryExpression(node) {
|
|
187
|
-
if (node.operator === 'delete' && node.argument.type === 'MemberExpression') {
|
|
188
|
-
if (isStatePropertyAccess(node.argument)) {
|
|
189
|
-
reportStateMutation(node, 'delete operator');
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
CallExpression(node) {
|
|
194
|
-
if (node.callee.type === 'MemberExpression' &&
|
|
195
|
-
node.callee.property.type === 'Identifier') {
|
|
196
|
-
const methodName = node.callee.property.name;
|
|
197
|
-
if (isStatePropertyAccess(node.callee.object)) {
|
|
198
|
-
const mutatingMethods = [
|
|
199
|
-
'push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse',
|
|
200
|
-
'copyWithin', 'fill',
|
|
201
|
-
'defineProperty', 'deleteProperty', 'setPrototypeOf',
|
|
202
|
-
];
|
|
203
|
-
if (mutatingMethods.includes(methodName)) {
|
|
204
|
-
reportStateMutation(node, `mutating method (${methodName})`);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
};
|
|
210
|
-
},
|
|
211
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noDirectMutationState=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.noDirectMutationState=(0,eslint_devkit_1.createRule)({name:"no-direct-mutation-state",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-direct-mutation-state.md",description:"Prevent direct mutation of this.state that breaks React reconciliation"},hasSuggestions:true,messages:{noDirectMutationState:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Direct State Mutation",description:"Never mutate this.state directly",severity:"HIGH",fix:"Use setState() or functional updates for immutable state changes",documentationLink:"https://react.dev/learn/state-and-lifecycle#state-updates-may-be-asynchronous"}),suggestSetState:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"State Update",description:"Use setState with object for state updates",severity:"MEDIUM",fix:"Use this.setState({ count: this.state.count + 1 })",documentationLink:"https://react.dev/reference/react/Component#setstate"}),suggestFunctionalUpdate:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Functional State Update",description:"Use functional setState for immutable updates",severity:"MEDIUM",fix:"Use this.setState(prevState => ({ count: prevState.count + 1 }))",documentationLink:"https://react.dev/reference/react/Component#setstate"})},schema:[{type:"object",properties:{allowInLifecycleMethods:{type:"boolean",default:false}},additionalProperties:false}]},defaultOptions:[{allowInLifecycleMethods:false}],create(context){const[options]=context.options;const{allowInLifecycleMethods=false}=options||{};let inClassComponent=false;let inLifecycleMethod=false;const classStack=[];function isLifecycleMethod(methodName){const lifecycleMethods=["componentDidMount","componentDidUpdate","componentWillUnmount","componentWillMount","componentWillReceiveProps","componentWillUpdate","shouldComponentUpdate","getSnapshotBeforeUpdate","getDerivedStateFromProps","getDerivedStateFromError","componentDidCatch"];return lifecycleMethods.includes(methodName)}function isInReactClassComponent(){return inClassComponent}function reportStateMutation(node,mutationType){if(!isInReactClassComponent()){return}if(allowInLifecycleMethods&&inLifecycleMethod){return}context.report({node,messageId:"noDirectMutationState",data:{mutationType,context:inLifecycleMethod?"lifecycle method":"regular method"},suggest:[{messageId:"suggestSetState",fix(fixer){const sourceCode=context.sourceCode;const start=node.range[0];const lineStart=sourceCode.getIndexFromLoc({line:sourceCode.getLocFromIndex(start).line,column:0});const lineText=sourceCode.getText().slice(lineStart,start);const indent=lineText.slice(0,lineText.length-lineText.trimStart().length);return fixer.insertTextBefore(node,`// TODO: Use setState instead of direct mutation
|
|
2
|
+
${indent}`)}},{messageId:"suggestFunctionalUpdate",fix(fixer){const sourceCode=context.sourceCode;const start=node.range[0];const lineStart=sourceCode.getIndexFromLoc({line:sourceCode.getLocFromIndex(start).line,column:0});const lineText=sourceCode.getText().slice(lineStart,start);const indent=lineText.slice(0,lineText.length-lineText.trimStart().length);return fixer.insertTextBefore(node,`// TODO: Use functional setState for immutable updates
|
|
3
|
+
${indent}`)}}]})}function isStatePropertyAccess(target){if(target.type==="MemberExpression"&&target.object.type==="MemberExpression"&&target.object.object.type==="ThisExpression"&&target.object.property.type==="Identifier"&&target.object.property.name==="state"){return true}if(target.type==="MemberExpression"){return isStatePropertyAccess(target.object)}if(target.type==="LogicalExpression"){return isStatePropertyAccess(target.left)}return false}return{ClassDeclaration(node){if(node.superClass){if(node.superClass.type==="Identifier"&&["Component","PureComponent"].includes(node.superClass.name)){inClassComponent=true;classStack.push(true)}else if(node.superClass.type==="MemberExpression"&&node.superClass.object.type==="Identifier"&&node.superClass.object.name==="React"&&node.superClass.property.type==="Identifier"&&["Component","PureComponent"].includes(node.superClass.property.name)){inClassComponent=true;classStack.push(true)}}},"ClassDeclaration:exit"(){classStack.pop();inClassComponent=classStack.length>0&&classStack[classStack.length-1]},MethodDefinition(node){if(node.key.type==="Identifier"){inLifecycleMethod=isLifecycleMethod(node.key.name)}},"MethodDefinition:exit"(){inLifecycleMethod=false},AssignmentExpression(node){if(node.left.type==="MemberExpression"){if(isStatePropertyAccess(node.left)){reportStateMutation(node,"assignment")}}},UpdateExpression(node){if(node.argument.type==="MemberExpression"){if(isStatePropertyAccess(node.argument)){reportStateMutation(node,"update")}}},UnaryExpression(node){if(node.operator==="delete"&&node.argument.type==="MemberExpression"){if(isStatePropertyAccess(node.argument)){reportStateMutation(node,"delete operator")}}},CallExpression(node){if(node.callee.type==="MemberExpression"&&node.callee.property.type==="Identifier"){const methodName=node.callee.property.name;if(isStatePropertyAccess(node.callee.object)){const mutatingMethods=["push","pop","shift","unshift","splice","sort","reverse","copyWithin","fill","defineProperty","deleteProperty","setPrototypeOf"];if(mutatingMethods.includes(methodName)){reportStateMutation(node,`mutating method (${methodName})`)}}}}}}});
|
|
@@ -1,50 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noFindDomNode = void 0;
|
|
4
|
-
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
-
const eslint_devkit_2 = require("@interlace/eslint-devkit");
|
|
6
|
-
exports.noFindDomNode = (0, eslint_devkit_2.createRule)({
|
|
7
|
-
name: 'no-find-dom-node',
|
|
8
|
-
meta: {
|
|
9
|
-
type: 'problem',
|
|
10
|
-
docs: {
|
|
11
|
-
url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-find-dom-node.md',
|
|
12
|
-
description: 'Prevent using findDOMNode',
|
|
13
|
-
},
|
|
14
|
-
messages: {
|
|
15
|
-
noFindDOMNode: (0, eslint_devkit_1.formatLLMMessage)({
|
|
16
|
-
icon: eslint_devkit_1.MessageIcons.DEPRECATION,
|
|
17
|
-
issueName: 'Deprecated findDOMNode',
|
|
18
|
-
description: 'findDOMNode is deprecated since React 16.3 and removed in React 19',
|
|
19
|
-
severity: 'HIGH',
|
|
20
|
-
fix: 'Use refs instead: const ref = useRef(); return <div ref={ref} />',
|
|
21
|
-
documentationLink: 'https://react.dev/reference/react-dom/findDOMNode',
|
|
22
|
-
}),
|
|
23
|
-
},
|
|
24
|
-
schema: [],
|
|
25
|
-
},
|
|
26
|
-
defaultOptions: [],
|
|
27
|
-
create(context) {
|
|
28
|
-
return {
|
|
29
|
-
CallExpression(node) {
|
|
30
|
-
if (node.callee.type === 'MemberExpression' &&
|
|
31
|
-
node.callee.object.type === 'Identifier' &&
|
|
32
|
-
node.callee.object.name === 'ReactDOM' &&
|
|
33
|
-
node.callee.property.type === 'Identifier' &&
|
|
34
|
-
node.callee.property.name === 'findDOMNode') {
|
|
35
|
-
context.report({
|
|
36
|
-
node,
|
|
37
|
-
messageId: 'noFindDOMNode',
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
if (node.callee.type === 'Identifier' &&
|
|
41
|
-
node.callee.name === 'findDOMNode') {
|
|
42
|
-
context.report({
|
|
43
|
-
node,
|
|
44
|
-
messageId: 'noFindDOMNode',
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noFindDomNode=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.noFindDomNode=(0,eslint_devkit_2.createRule)({name:"no-find-dom-node",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-find-dom-node.md",description:"Prevent using findDOMNode"},messages:{noFindDOMNode:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.DEPRECATION,issueName:"Deprecated findDOMNode",description:"findDOMNode is deprecated since React 16.3 and removed in React 19",severity:"HIGH",fix:"Use refs instead: const ref = useRef(); return <div ref={ref} />",documentationLink:"https://react.dev/reference/react-dom/findDOMNode"})},schema:[]},defaultOptions:[],create(context){return{CallExpression(node){if(node.callee.type==="MemberExpression"&&node.callee.object.type==="Identifier"&&node.callee.object.name==="ReactDOM"&&node.callee.property.type==="Identifier"&&node.callee.property.name==="findDOMNode"){context.report({node,messageId:"noFindDOMNode"})}if(node.callee.type==="Identifier"&&node.callee.name==="findDOMNode"){context.report({node,messageId:"noFindDOMNode"})}}}}});
|
|
@@ -1,80 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noInvalidHtmlAttribute = void 0;
|
|
4
|
-
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
-
const eslint_devkit_2 = require("@interlace/eslint-devkit");
|
|
6
|
-
const INVALID_HTML_ATTRIBUTES = new Set([
|
|
7
|
-
'accept-charset',
|
|
8
|
-
'accesskey',
|
|
9
|
-
'allowfullscreen',
|
|
10
|
-
'allowtransparency',
|
|
11
|
-
'bgcolor',
|
|
12
|
-
'cellpadding',
|
|
13
|
-
'cellspacing',
|
|
14
|
-
'charset',
|
|
15
|
-
'class',
|
|
16
|
-
'colspan',
|
|
17
|
-
'contenteditable',
|
|
18
|
-
'contextmenu',
|
|
19
|
-
'crossorigin',
|
|
20
|
-
'datetime',
|
|
21
|
-
'enctype',
|
|
22
|
-
'for',
|
|
23
|
-
'formaction',
|
|
24
|
-
'formenctype',
|
|
25
|
-
'formmethod',
|
|
26
|
-
'formnovalidate',
|
|
27
|
-
'formtarget',
|
|
28
|
-
'frameborder',
|
|
29
|
-
'hreflang',
|
|
30
|
-
'http-equiv',
|
|
31
|
-
'inputmode',
|
|
32
|
-
'maxlength',
|
|
33
|
-
'minlength',
|
|
34
|
-
'novalidate',
|
|
35
|
-
'readonly',
|
|
36
|
-
'rowspan',
|
|
37
|
-
'spellcheck',
|
|
38
|
-
'srcdoc',
|
|
39
|
-
'srclang',
|
|
40
|
-
'srcset',
|
|
41
|
-
'tabindex',
|
|
42
|
-
'usemap',
|
|
43
|
-
]);
|
|
44
|
-
exports.noInvalidHtmlAttribute = (0, eslint_devkit_1.createRule)({
|
|
45
|
-
name: 'no-invalid-html-attribute',
|
|
46
|
-
meta: {
|
|
47
|
-
type: 'problem',
|
|
48
|
-
docs: {
|
|
49
|
-
url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-invalid-html-attribute.md',
|
|
50
|
-
description: 'Prevent invalid HTML attributes',
|
|
51
|
-
},
|
|
52
|
-
messages: {
|
|
53
|
-
noInvalidHtmlAttribute: (0, eslint_devkit_2.formatLLMMessage)({
|
|
54
|
-
icon: eslint_devkit_2.MessageIcons.WARNING,
|
|
55
|
-
issueName: 'Invalid HTML Attribute',
|
|
56
|
-
description: 'Invalid HTML attribute detected',
|
|
57
|
-
severity: 'MEDIUM',
|
|
58
|
-
fix: 'Use camelCase React attribute instead',
|
|
59
|
-
documentationLink: 'https://react.dev/reference/react-dom/components/common#html-attributes',
|
|
60
|
-
}),
|
|
61
|
-
},
|
|
62
|
-
schema: [],
|
|
63
|
-
},
|
|
64
|
-
defaultOptions: [],
|
|
65
|
-
create(context) {
|
|
66
|
-
return {
|
|
67
|
-
JSXAttribute(node) {
|
|
68
|
-
if (node.name.type === 'JSXIdentifier') {
|
|
69
|
-
const attrName = node.name.name;
|
|
70
|
-
if (INVALID_HTML_ATTRIBUTES.has(attrName)) {
|
|
71
|
-
context.report({
|
|
72
|
-
node: node.name,
|
|
73
|
-
messageId: 'noInvalidHtmlAttribute',
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
},
|
|
80
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noInvalidHtmlAttribute=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");const INVALID_HTML_ATTRIBUTES=new Set(["accept-charset","accesskey","allowfullscreen","allowtransparency","bgcolor","cellpadding","cellspacing","charset","class","colspan","contenteditable","contextmenu","crossorigin","datetime","enctype","for","formaction","formenctype","formmethod","formnovalidate","formtarget","frameborder","hreflang","http-equiv","inputmode","maxlength","minlength","novalidate","readonly","rowspan","spellcheck","srcdoc","srclang","srcset","tabindex","usemap"]);exports.noInvalidHtmlAttribute=(0,eslint_devkit_1.createRule)({name:"no-invalid-html-attribute",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-invalid-html-attribute.md",description:"Prevent invalid HTML attributes"},messages:{noInvalidHtmlAttribute:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Invalid HTML Attribute",description:"Invalid HTML attribute detected",severity:"MEDIUM",fix:"Use camelCase React attribute instead",documentationLink:"https://react.dev/reference/react-dom/components/common#html-attributes"})},schema:[]},defaultOptions:[],create(context){return{JSXAttribute(node){if(node.name.type==="JSXIdentifier"){const attrName=node.name.name;if(INVALID_HTML_ATTRIBUTES.has(attrName)){context.report({node:node.name,messageId:"noInvalidHtmlAttribute"})}}}}}});
|
|
@@ -1,46 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noIsMounted = void 0;
|
|
4
|
-
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
-
const eslint_devkit_2 = require("@interlace/eslint-devkit");
|
|
6
|
-
exports.noIsMounted = (0, eslint_devkit_1.createRule)({
|
|
7
|
-
name: 'no-is-mounted',
|
|
8
|
-
meta: {
|
|
9
|
-
type: 'problem',
|
|
10
|
-
docs: {
|
|
11
|
-
url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-is-mounted.md',
|
|
12
|
-
description: 'Prevent isMounted anti-pattern',
|
|
13
|
-
},
|
|
14
|
-
schema: [],
|
|
15
|
-
messages: {
|
|
16
|
-
noIsMounted: (0, eslint_devkit_2.formatLLMMessage)({
|
|
17
|
-
icon: eslint_devkit_2.MessageIcons.WARNING,
|
|
18
|
-
issueName: 'isMounted Usage',
|
|
19
|
-
description: 'isMounted anti-pattern detected',
|
|
20
|
-
severity: 'HIGH',
|
|
21
|
-
fix: 'Use proper lifecycle management or cancellation tokens',
|
|
22
|
-
documentationLink: 'https://react.dev/blog/2015/12/16/ismounted-antipattern.html',
|
|
23
|
-
}),
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
defaultOptions: [],
|
|
27
|
-
create(context) {
|
|
28
|
-
return {
|
|
29
|
-
MemberExpression(node) {
|
|
30
|
-
if (node.property.type === 'Identifier' &&
|
|
31
|
-
node.property.name === 'isMounted') {
|
|
32
|
-
context.report({
|
|
33
|
-
node: node.property,
|
|
34
|
-
messageId: 'noIsMounted',
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
'VariableDeclarator[id.name="isMounted"]'(node) {
|
|
39
|
-
context.report({
|
|
40
|
-
node: node.id,
|
|
41
|
-
messageId: 'noIsMounted',
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noIsMounted=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.noIsMounted=(0,eslint_devkit_1.createRule)({name:"no-is-mounted",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-is-mounted.md",description:"Prevent isMounted anti-pattern"},schema:[],messages:{noIsMounted:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"isMounted Usage",description:"isMounted anti-pattern detected",severity:"HIGH",fix:"Use proper lifecycle management or cancellation tokens",documentationLink:"https://react.dev/blog/2015/12/16/ismounted-antipattern.html"})}},defaultOptions:[],create(context){return{MemberExpression(node){if(node.property.type==="Identifier"&&node.property.name==="isMounted"){context.report({node:node.property,messageId:"noIsMounted"})}},'VariableDeclarator[id.name="isMounted"]'(node){context.report({node:node.id,messageId:"noIsMounted"})}}}});
|
|
@@ -1,150 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noMultiComp = void 0;
|
|
4
|
-
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
-
const eslint_devkit_2 = require("@interlace/eslint-devkit");
|
|
6
|
-
exports.noMultiComp = (0, eslint_devkit_1.createRule)({
|
|
7
|
-
name: 'no-multi-comp',
|
|
8
|
-
meta: {
|
|
9
|
-
type: 'problem',
|
|
10
|
-
docs: {
|
|
11
|
-
url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-multi-comp.md',
|
|
12
|
-
description: 'Prevent multiple components per file',
|
|
13
|
-
},
|
|
14
|
-
schema: [
|
|
15
|
-
{
|
|
16
|
-
type: 'object',
|
|
17
|
-
properties: {
|
|
18
|
-
ignoreStateless: {
|
|
19
|
-
type: 'boolean',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
additionalProperties: false,
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
messages: {
|
|
26
|
-
noMultiComp: (0, eslint_devkit_2.formatLLMMessage)({
|
|
27
|
-
icon: eslint_devkit_2.MessageIcons.WARNING,
|
|
28
|
-
issueName: 'Multiple Components',
|
|
29
|
-
description: 'Multiple components defined in single file',
|
|
30
|
-
severity: 'LOW',
|
|
31
|
-
fix: 'Extract components to separate files',
|
|
32
|
-
documentationLink: 'https://react.dev/learn/thinking-in-react#step-3-identify-where-your-state-should-live',
|
|
33
|
-
}),
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
defaultOptions: [{ ignoreStateless: false }],
|
|
37
|
-
create(context) {
|
|
38
|
-
const components = [];
|
|
39
|
-
return {
|
|
40
|
-
ClassDeclaration(node) {
|
|
41
|
-
if (isReactComponent(node)) {
|
|
42
|
-
components.push(node);
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
'VariableDeclarator, FunctionDeclaration'(node) {
|
|
46
|
-
if (isReactComponentFunction(getComponentFromDeclaration(node))) {
|
|
47
|
-
components.push(node);
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
'Program:exit'() {
|
|
51
|
-
const [firstOption] = context.options;
|
|
52
|
-
const ignoreStateless = firstOption?.ignoreStateless ?? false;
|
|
53
|
-
let componentCount = components.length;
|
|
54
|
-
if (ignoreStateless) {
|
|
55
|
-
componentCount = components.filter(comp => !isStatelessComponent(comp)).length;
|
|
56
|
-
}
|
|
57
|
-
if (componentCount > 1) {
|
|
58
|
-
for (let i = 1; i < components.length; i++) {
|
|
59
|
-
const comp = components[i];
|
|
60
|
-
if (!ignoreStateless || !isStatelessComponent(comp)) {
|
|
61
|
-
context.report({
|
|
62
|
-
node: getComponentNameNode(comp),
|
|
63
|
-
messageId: 'noMultiComp',
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
function getComponentFromDeclaration(node) {
|
|
71
|
-
if (node.type === 'FunctionDeclaration') {
|
|
72
|
-
return node;
|
|
73
|
-
}
|
|
74
|
-
if (node.type === 'VariableDeclarator' && node.init) {
|
|
75
|
-
if (node.init.type === 'FunctionExpression' || node.init.type === 'ArrowFunctionExpression') {
|
|
76
|
-
return node.init;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
function isReactComponentFunction(node) {
|
|
82
|
-
if (!node)
|
|
83
|
-
return false;
|
|
84
|
-
const body = node.type === 'FunctionDeclaration' ? node.body : node.body;
|
|
85
|
-
return containsJSX(body);
|
|
86
|
-
}
|
|
87
|
-
function containsJSX(node, visited = new Set()) {
|
|
88
|
-
if (!node)
|
|
89
|
-
return false;
|
|
90
|
-
if (visited.has(node))
|
|
91
|
-
return false;
|
|
92
|
-
visited.add(node);
|
|
93
|
-
if (node.type === 'JSXElement' || node.type === 'JSXFragment') {
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
const skipKeys = new Set(['parent', 'range', 'loc', 'start', 'end', 'tokens', 'comments']);
|
|
97
|
-
for (const key in node) {
|
|
98
|
-
if (skipKeys.has(key))
|
|
99
|
-
continue;
|
|
100
|
-
const child = node[key];
|
|
101
|
-
if (child && typeof child === 'object') {
|
|
102
|
-
if (Array.isArray(child)) {
|
|
103
|
-
for (const item of child) {
|
|
104
|
-
if (item && typeof item === 'object' && 'type' in item) {
|
|
105
|
-
if (containsJSX(item, visited)) {
|
|
106
|
-
return true;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
else if ('type' in child) {
|
|
112
|
-
if (containsJSX(child, visited)) {
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
function isReactComponent(node) {
|
|
121
|
-
if (!node.superClass)
|
|
122
|
-
return false;
|
|
123
|
-
if (node.superClass.type === 'Identifier') {
|
|
124
|
-
return node.superClass.name === 'Component' || node.superClass.name === 'PureComponent';
|
|
125
|
-
}
|
|
126
|
-
if (node.superClass.type === 'MemberExpression') {
|
|
127
|
-
return (node.superClass.object.type === 'Identifier' &&
|
|
128
|
-
node.superClass.object.name === 'React' &&
|
|
129
|
-
node.superClass.property.type === 'Identifier' &&
|
|
130
|
-
(node.superClass.property.name === 'Component' || node.superClass.property.name === 'PureComponent'));
|
|
131
|
-
}
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
function isStatelessComponent(node) {
|
|
135
|
-
return !isReactComponent(node);
|
|
136
|
-
}
|
|
137
|
-
function getComponentNameNode(node) {
|
|
138
|
-
if (node.type === 'ClassDeclaration') {
|
|
139
|
-
return node.id || node;
|
|
140
|
-
}
|
|
141
|
-
if (node.type === 'FunctionDeclaration') {
|
|
142
|
-
return node.id || node;
|
|
143
|
-
}
|
|
144
|
-
if (node.type === 'VariableDeclarator') {
|
|
145
|
-
return node.id || node;
|
|
146
|
-
}
|
|
147
|
-
return node;
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noMultiComp=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.noMultiComp=(0,eslint_devkit_1.createRule)({name:"no-multi-comp",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-multi-comp.md",description:"Prevent multiple components per file"},schema:[{type:"object",properties:{ignoreStateless:{type:"boolean"}},additionalProperties:false}],messages:{noMultiComp:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Multiple Components",description:"Multiple components defined in single file",severity:"LOW",fix:"Extract components to separate files",documentationLink:"https://react.dev/learn/thinking-in-react#step-3-identify-where-your-state-should-live"})}},defaultOptions:[{ignoreStateless:false}],create(context){const components=[];return{ClassDeclaration(node){if(isReactComponent(node)){components.push(node)}},"VariableDeclarator, FunctionDeclaration"(node){if(isReactComponentFunction(getComponentFromDeclaration(node))){components.push(node)}},"Program:exit"(){const[firstOption]=context.options;const ignoreStateless=firstOption?.ignoreStateless??false;let componentCount=components.length;if(ignoreStateless){componentCount=components.filter(comp=>!isStatelessComponent(comp)).length}if(componentCount>1){for(let i=1;i<components.length;i++){const comp=components[i];if(!ignoreStateless||!isStatelessComponent(comp)){context.report({node:getComponentNameNode(comp),messageId:"noMultiComp"})}}}}};function getComponentFromDeclaration(node){if(node.type==="FunctionDeclaration"){return node}if(node.type==="VariableDeclarator"&&node.init){if(node.init.type==="FunctionExpression"||node.init.type==="ArrowFunctionExpression"){return node.init}}return null}function isReactComponentFunction(node){if(!node)return false;const body=node.type==="FunctionDeclaration"?node.body:node.body;return containsJSX(body)}function containsJSX(node,visited=new Set){if(!node)return false;if(visited.has(node))return false;visited.add(node);if(node.type==="JSXElement"||node.type==="JSXFragment"){return true}const skipKeys=new Set(["parent","range","loc","start","end","tokens","comments"]);for(const key in node){if(skipKeys.has(key))continue;const child=node[key];if(child&&typeof child==="object"){if(Array.isArray(child)){for(const item of child){if(item&&typeof item==="object"&&"type"in item){if(containsJSX(item,visited)){return true}}}}else if("type"in child){if(containsJSX(child,visited)){return true}}}}return false}function isReactComponent(node){if(!node.superClass)return false;if(node.superClass.type==="Identifier"){return node.superClass.name==="Component"||node.superClass.name==="PureComponent"}if(node.superClass.type==="MemberExpression"){return node.superClass.object.type==="Identifier"&&node.superClass.object.name==="React"&&node.superClass.property.type==="Identifier"&&(node.superClass.property.name==="Component"||node.superClass.property.name==="PureComponent")}return false}function isStatelessComponent(node){return!isReactComponent(node)}function getComponentNameNode(node){if(node.type==="ClassDeclaration"){return node.id||node}if(node.type==="FunctionDeclaration"){return node.id||node}if(node.type==="VariableDeclarator"){return node.id||node}return node}}});
|
|
@@ -1,37 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noNamespace = void 0;
|
|
4
|
-
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
-
const eslint_devkit_2 = require("@interlace/eslint-devkit");
|
|
6
|
-
exports.noNamespace = (0, eslint_devkit_1.createRule)({
|
|
7
|
-
name: 'no-namespace',
|
|
8
|
-
meta: {
|
|
9
|
-
type: 'problem',
|
|
10
|
-
docs: {
|
|
11
|
-
url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-namespace.md',
|
|
12
|
-
description: 'Prevent namespace imports',
|
|
13
|
-
},
|
|
14
|
-
messages: {
|
|
15
|
-
noNamespace: (0, eslint_devkit_2.formatLLMMessage)({
|
|
16
|
-
icon: eslint_devkit_2.MessageIcons.WARNING,
|
|
17
|
-
issueName: 'Namespace Import',
|
|
18
|
-
description: 'Namespace import detected',
|
|
19
|
-
severity: 'LOW',
|
|
20
|
-
fix: 'Use named imports instead: import { Component } from "react"',
|
|
21
|
-
documentationLink: 'https://react.dev/learn/importing-and-exporting-components',
|
|
22
|
-
}),
|
|
23
|
-
},
|
|
24
|
-
schema: [],
|
|
25
|
-
},
|
|
26
|
-
defaultOptions: [],
|
|
27
|
-
create(context) {
|
|
28
|
-
return {
|
|
29
|
-
ImportNamespaceSpecifier(node) {
|
|
30
|
-
context.report({
|
|
31
|
-
node,
|
|
32
|
-
messageId: 'noNamespace',
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noNamespace=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.noNamespace=(0,eslint_devkit_1.createRule)({name:"no-namespace",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-namespace.md",description:"Prevent namespace imports"},messages:{noNamespace:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Namespace Import",description:"Namespace import detected",severity:"LOW",fix:'Use named imports instead: import { Component } from "react"',documentationLink:"https://react.dev/learn/importing-and-exporting-components"})},schema:[]},defaultOptions:[],create(context){return{ImportNamespaceSpecifier(node){context.report({node,messageId:"noNamespace"})}}}});
|