@agilebot/eslint-plugin 0.8.0 → 0.8.1
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/LICENSE +9 -9
- package/dist/index.js +93 -428
- package/package.json +3 -4
package/LICENSE
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2024 Agilebot, Inc.
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
-
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
-
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 Agilebot, Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/dist/index.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
/**
|
2
|
-
* @license @agilebot/eslint-plugin v0.8.
|
3
|
-
*
|
4
|
-
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
-
*
|
6
|
-
* This source code is licensed under the MIT license found in the
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
8
|
-
*/
|
1
|
+
/**
|
2
|
+
* @license @agilebot/eslint-plugin v0.8.1
|
3
|
+
*
|
4
|
+
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
|
+
*
|
6
|
+
* This source code is licensed under the MIT license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
9
9
|
'use strict';
|
10
10
|
|
11
11
|
var utils = require('@typescript-eslint/utils');
|
@@ -38,9 +38,9 @@ const hasDocs = typeof ["enforce-mui-icon-alias","intl-id-missing","intl-id-pref
|
|
38
38
|
["enforce-mui-icon-alias","intl-id-missing","intl-id-prefix","intl-no-default","react-better-exhaustive-deps"] : [];
|
39
39
|
const createRule = utils.ESLintUtils.RuleCreator(name => hasDocs.includes(name) ? "".concat(docBaseUrl).concat(name, ".md") : "".concat(docBaseUrl).concat(name, ".test.js"));
|
40
40
|
|
41
|
-
const RULE_NAME$
|
41
|
+
const RULE_NAME$h = 'enforce-mui-icon-alias';
|
42
42
|
var enforceMuiIconAlias = createRule({
|
43
|
-
name: RULE_NAME$
|
43
|
+
name: RULE_NAME$h,
|
44
44
|
meta: {
|
45
45
|
type: 'problem',
|
46
46
|
docs: {
|
@@ -61,7 +61,7 @@ var enforceMuiIconAlias = createRule({
|
|
61
61
|
return;
|
62
62
|
}
|
63
63
|
for (const specifier of node.specifiers) {
|
64
|
-
if (specifier.type !==
|
64
|
+
if (specifier.type !== utils.AST_NODE_TYPES.ImportSpecifier) {
|
65
65
|
return;
|
66
66
|
}
|
67
67
|
if (specifier.imported.name === specifier.local.name || !specifier.local.name.endsWith('Icon')) {
|
@@ -84,9 +84,9 @@ function getSetting(context, name) {
|
|
84
84
|
return context.settings["agilebot/".concat(name)];
|
85
85
|
}
|
86
86
|
|
87
|
-
const RULE_NAME$
|
87
|
+
const RULE_NAME$g = 'import-monorepo';
|
88
88
|
var importMonorepo = createRule({
|
89
|
-
name: RULE_NAME$
|
89
|
+
name: RULE_NAME$g,
|
90
90
|
meta: {
|
91
91
|
type: 'problem',
|
92
92
|
docs: {
|
@@ -134,25 +134,25 @@ var importMonorepo = createRule({
|
|
134
134
|
});
|
135
135
|
|
136
136
|
function findFormatMessageAttrNode(node, attrName) {
|
137
|
-
if (node.type ===
|
137
|
+
if (node.type === utils.AST_NODE_TYPES.CallExpression && (node.callee.name === 'formatMessage' || node.callee.name === '$t') && node.arguments.length > 0 && node.arguments[0].properties) {
|
138
138
|
return node.arguments[0].properties.find(a => a.key && a.key.name === attrName);
|
139
139
|
}
|
140
|
-
if (node.type ===
|
140
|
+
if (node.type === utils.AST_NODE_TYPES.CallExpression && node.callee.type === utils.AST_NODE_TYPES.MemberExpression && (node.callee.object.name === 'intl' || node.callee.object.name && node.callee.object.name.endsWith('Intl')) && (node.callee.property.name === 'formatMessage' || node.callee.property.name === '$t')) {
|
141
141
|
return node.arguments[0].properties.find(a => a.key && a.key.name === attrName);
|
142
142
|
}
|
143
143
|
}
|
144
144
|
function findFormattedMessageAttrNode(node, attrName) {
|
145
|
-
if (node.type ===
|
145
|
+
if (node.type === utils.AST_NODE_TYPES.JSXIdentifier && node.name === 'FormattedMessage' && node.parent && node.parent.type === utils.AST_NODE_TYPES.JSXOpeningElement) {
|
146
146
|
return node.parent.attributes.find(a => a.name && a.name.name === attrName);
|
147
147
|
}
|
148
148
|
}
|
149
149
|
function findAttrNodeInDefineMessages(node, attrName) {
|
150
|
-
if (node.type === 'Property' && node.key.name === attrName && node.parent && node.parent.parent && node.parent.parent.parent && node.parent.parent.parent.parent && node.parent.parent.parent.parent.type ===
|
150
|
+
if (node.type === 'Property' && node.key.name === attrName && node.parent && node.parent.parent && node.parent.parent.parent && node.parent.parent.parent.parent && node.parent.parent.parent.parent.type === utils.AST_NODE_TYPES.CallExpression && node.parent.parent.parent.parent.callee.name === 'defineMessages') {
|
151
151
|
return node;
|
152
152
|
}
|
153
153
|
}
|
154
154
|
function findAttrNodeInDefineMessage(node, attrName) {
|
155
|
-
if (node.type === 'Property' && node.key.name === attrName && node.parent && node.parent.parent && node.parent.parent.type ===
|
155
|
+
if (node.type === 'Property' && node.key.name === attrName && node.parent && node.parent.parent && node.parent.parent.type === utils.AST_NODE_TYPES.CallExpression && node.parent.parent.callee.name === 'defineMessage') {
|
156
156
|
return node;
|
157
157
|
}
|
158
158
|
}
|
@@ -201,9 +201,9 @@ function getIntlIds(context) {
|
|
201
201
|
return results;
|
202
202
|
}
|
203
203
|
|
204
|
-
const RULE_NAME$
|
204
|
+
const RULE_NAME$f = 'intl-id-missing';
|
205
205
|
var intlIdMissing = createRule({
|
206
|
-
name: RULE_NAME$
|
206
|
+
name: RULE_NAME$f,
|
207
207
|
meta: {
|
208
208
|
type: 'problem',
|
209
209
|
docs: {
|
@@ -251,13 +251,13 @@ var intlIdMissing = createRule({
|
|
251
251
|
}
|
252
252
|
}
|
253
253
|
function processAttrNode(node) {
|
254
|
-
if (node.value.type ===
|
254
|
+
if (node.value.type === utils.AST_NODE_TYPES.Literal) {
|
255
255
|
return processLiteral(node.value);
|
256
256
|
}
|
257
|
-
if (node.value.type ===
|
257
|
+
if (node.value.type === utils.AST_NODE_TYPES.JSXExpressionContainer && node.value.expression.type === utils.AST_NODE_TYPES.TemplateLiteral) {
|
258
258
|
return processTemplateLiteral(node.value.expression);
|
259
259
|
}
|
260
|
-
if (node.value.type ===
|
260
|
+
if (node.value.type === utils.AST_NODE_TYPES.TemplateLiteral) {
|
261
261
|
return processTemplateLiteral(node.value);
|
262
262
|
}
|
263
263
|
context.report({
|
@@ -291,9 +291,9 @@ var intlIdMissing = createRule({
|
|
291
291
|
}
|
292
292
|
});
|
293
293
|
|
294
|
-
const RULE_NAME$
|
294
|
+
const RULE_NAME$e = 'intl-id-naming';
|
295
295
|
var intlIdNaming = createRule({
|
296
|
-
name: RULE_NAME$
|
296
|
+
name: RULE_NAME$e,
|
297
297
|
meta: {
|
298
298
|
type: 'problem',
|
299
299
|
docs: {
|
@@ -353,13 +353,13 @@ var intlIdNaming = createRule({
|
|
353
353
|
report(node, displayStr);
|
354
354
|
}
|
355
355
|
function processAttrNode(node) {
|
356
|
-
if (node.value.type ===
|
356
|
+
if (node.value.type === utils.AST_NODE_TYPES.Literal) {
|
357
357
|
return processLiteral(node.value);
|
358
358
|
}
|
359
|
-
if (node.value.type ===
|
359
|
+
if (node.value.type === utils.AST_NODE_TYPES.JSXExpressionContainer && node.value.expression.type === utils.AST_NODE_TYPES.TemplateLiteral) {
|
360
360
|
return processTemplateLiteral(node.value.expression);
|
361
361
|
}
|
362
|
-
if (node.value.type ===
|
362
|
+
if (node.value.type === utils.AST_NODE_TYPES.TemplateLiteral) {
|
363
363
|
return processTemplateLiteral(node.value);
|
364
364
|
}
|
365
365
|
}
|
@@ -386,9 +386,9 @@ var intlIdNaming = createRule({
|
|
386
386
|
}
|
387
387
|
});
|
388
388
|
|
389
|
-
const RULE_NAME$
|
389
|
+
const RULE_NAME$d = 'intl-id-prefix';
|
390
390
|
var intlIdPrefix = createRule({
|
391
|
-
name: RULE_NAME$
|
391
|
+
name: RULE_NAME$d,
|
392
392
|
meta: {
|
393
393
|
type: 'problem',
|
394
394
|
docs: {
|
@@ -429,13 +429,13 @@ var intlIdPrefix = createRule({
|
|
429
429
|
report(node, displayStr);
|
430
430
|
}
|
431
431
|
function processAttrNode(node) {
|
432
|
-
if (node.value.type ===
|
432
|
+
if (node.value.type === utils.AST_NODE_TYPES.Literal) {
|
433
433
|
return processLiteral(node.value);
|
434
434
|
}
|
435
|
-
if (node.value.type ===
|
435
|
+
if (node.value.type === utils.AST_NODE_TYPES.JSXExpressionContainer && node.value.expression.type === utils.AST_NODE_TYPES.TemplateLiteral) {
|
436
436
|
return processTemplateLiteral(node.value.expression);
|
437
437
|
}
|
438
|
-
if (node.value.type ===
|
438
|
+
if (node.value.type === utils.AST_NODE_TYPES.TemplateLiteral) {
|
439
439
|
return processTemplateLiteral(node.value);
|
440
440
|
}
|
441
441
|
}
|
@@ -462,10 +462,10 @@ var intlIdPrefix = createRule({
|
|
462
462
|
}
|
463
463
|
});
|
464
464
|
|
465
|
-
const RULE_NAME$
|
465
|
+
const RULE_NAME$c = 'intl-id-unused';
|
466
466
|
const usedIds = new Map();
|
467
467
|
var intlIdUnused = createRule({
|
468
|
-
name: RULE_NAME$
|
468
|
+
name: RULE_NAME$c,
|
469
469
|
meta: {
|
470
470
|
type: 'problem',
|
471
471
|
docs: {
|
@@ -503,13 +503,13 @@ var intlIdUnused = createRule({
|
|
503
503
|
if (isTemplateTranslated(re)) ;
|
504
504
|
}
|
505
505
|
function processAttrNode(node) {
|
506
|
-
if (node.value.type ===
|
506
|
+
if (node.value.type === utils.AST_NODE_TYPES.Literal) {
|
507
507
|
return processLiteral(node.value);
|
508
508
|
}
|
509
|
-
if (node.value.type ===
|
509
|
+
if (node.value.type === utils.AST_NODE_TYPES.JSXExpressionContainer && node.value.expression.type === utils.AST_NODE_TYPES.TemplateLiteral) {
|
510
510
|
return processTemplateLiteral(node.value.expression);
|
511
511
|
}
|
512
|
-
if (node.value.type ===
|
512
|
+
if (node.value.type === utils.AST_NODE_TYPES.TemplateLiteral) {
|
513
513
|
return processTemplateLiteral(node.value);
|
514
514
|
}
|
515
515
|
}
|
@@ -541,9 +541,9 @@ var intlIdUnused = createRule({
|
|
541
541
|
}
|
542
542
|
});
|
543
543
|
|
544
|
-
const RULE_NAME$
|
544
|
+
const RULE_NAME$b = 'intl-no-default';
|
545
545
|
var intlNoDefault = createRule({
|
546
|
-
name: RULE_NAME$
|
546
|
+
name: RULE_NAME$b,
|
547
547
|
meta: {
|
548
548
|
type: 'problem',
|
549
549
|
docs: {
|
@@ -585,9 +585,9 @@ var intlNoDefault = createRule({
|
|
585
585
|
}
|
586
586
|
});
|
587
587
|
|
588
|
-
const RULE_NAME$
|
588
|
+
const RULE_NAME$a = 'no-async-array-methods';
|
589
589
|
var noAsyncArrayMethods = createRule({
|
590
|
-
name: RULE_NAME$
|
590
|
+
name: RULE_NAME$a,
|
591
591
|
meta: {
|
592
592
|
type: 'problem',
|
593
593
|
docs: {
|
@@ -612,7 +612,7 @@ var noAsyncArrayMethods = createRule({
|
|
612
612
|
}
|
613
613
|
if (notAllowedArrayMethods.includes(callee.property.name)) {
|
614
614
|
const functionArguments = node.expression.arguments.find(n => {
|
615
|
-
return [
|
615
|
+
return [utils.AST_NODE_TYPES.ArrowFunctionExpression, utils.AST_NODE_TYPES.FunctionExpression].includes(n.type);
|
616
616
|
});
|
617
617
|
if (functionArguments && functionArguments.async) {
|
618
618
|
context.report({
|
@@ -629,9 +629,9 @@ var noAsyncArrayMethods = createRule({
|
|
629
629
|
}
|
630
630
|
});
|
631
631
|
|
632
|
-
const RULE_NAME$
|
632
|
+
const RULE_NAME$9 = 'no-extends-error';
|
633
633
|
var noExtendsError = createRule({
|
634
|
-
name: RULE_NAME$
|
634
|
+
name: RULE_NAME$9,
|
635
635
|
meta: {
|
636
636
|
type: 'problem',
|
637
637
|
docs: {
|
@@ -647,7 +647,7 @@ var noExtendsError = createRule({
|
|
647
647
|
create(context) {
|
648
648
|
return {
|
649
649
|
ClassDeclaration(node) {
|
650
|
-
if (node.superClass && node.superClass.type ===
|
650
|
+
if (node.superClass && node.superClass.type === utils.AST_NODE_TYPES.Identifier && node.superClass.name === 'Error') {
|
651
651
|
context.report({
|
652
652
|
node: node.superClass,
|
653
653
|
messageId: 'noExtendsError'
|
@@ -658,9 +658,9 @@ var noExtendsError = createRule({
|
|
658
658
|
}
|
659
659
|
});
|
660
660
|
|
661
|
-
const RULE_NAME$
|
661
|
+
const RULE_NAME$8 = 'no-import-css';
|
662
662
|
var noImportCss = createRule({
|
663
|
-
name: RULE_NAME$
|
663
|
+
name: RULE_NAME$8,
|
664
664
|
meta: {
|
665
665
|
type: 'problem',
|
666
666
|
docs: {
|
@@ -691,9 +691,9 @@ var noImportCss = createRule({
|
|
691
691
|
}
|
692
692
|
});
|
693
693
|
|
694
|
-
const RULE_NAME$
|
694
|
+
const RULE_NAME$7 = 'no-then-catch-finally';
|
695
695
|
var noThenCatchFinally = createRule({
|
696
|
-
name: RULE_NAME$
|
696
|
+
name: RULE_NAME$7,
|
697
697
|
meta: {
|
698
698
|
type: 'suggestion',
|
699
699
|
docs: {
|
@@ -731,7 +731,7 @@ var noThenCatchFinally = createRule({
|
|
731
731
|
return node.property && (node.property.name === 'then' || node.property.name === 'catch' || node.property.name === 'finally');
|
732
732
|
}
|
733
733
|
return {
|
734
|
-
|
734
|
+
["".concat(utils.AST_NODE_TYPES.CallExpression, " > ").concat(utils.AST_NODE_TYPES.MemberExpression, ".callee")]: node => {
|
735
735
|
if (isTopLevelScoped(node)) {
|
736
736
|
return;
|
737
737
|
}
|
@@ -739,7 +739,7 @@ var noThenCatchFinally = createRule({
|
|
739
739
|
return;
|
740
740
|
}
|
741
741
|
const callExpression = node.object;
|
742
|
-
if (callExpression.type ===
|
742
|
+
if (callExpression.type === utils.AST_NODE_TYPES.CallExpression && callExpression.callee.type === utils.AST_NODE_TYPES.Identifier && restrictedFunctions.includes(callExpression.callee.name)) {
|
743
743
|
context.report({
|
744
744
|
node: node.property,
|
745
745
|
messageId: 'forbiddenThenCatchFinally',
|
@@ -753,9 +753,9 @@ var noThenCatchFinally = createRule({
|
|
753
753
|
}
|
754
754
|
});
|
755
755
|
|
756
|
-
const RULE_NAME$
|
756
|
+
const RULE_NAME$6 = 'no-unnecessary-template-literals';
|
757
757
|
var noUnnecessaryTemplateLiterals = createRule({
|
758
|
-
name: RULE_NAME$
|
758
|
+
name: RULE_NAME$6,
|
759
759
|
meta: {
|
760
760
|
type: 'problem',
|
761
761
|
docs: {
|
@@ -2055,9 +2055,9 @@ function isUseEffectEventIdentifier(node) {
|
|
2055
2055
|
}
|
2056
2056
|
|
2057
2057
|
const Components = require('eslint-plugin-react/lib/util/Components');
|
2058
|
-
const RULE_NAME$
|
2058
|
+
const RULE_NAME$5 = 'react-hook-use-ref';
|
2059
2059
|
var reactHookUseRef = createRule({
|
2060
|
-
name: RULE_NAME$
|
2060
|
+
name: RULE_NAME$5,
|
2061
2061
|
meta: {
|
2062
2062
|
type: 'suggestion',
|
2063
2063
|
docs: {
|
@@ -2073,11 +2073,11 @@ var reactHookUseRef = createRule({
|
|
2073
2073
|
defaultOptions: [],
|
2074
2074
|
create: Components.detect((context, component, util) => ({
|
2075
2075
|
CallExpression(node) {
|
2076
|
-
const isImmediateReturn = node.parent && node.parent.type ===
|
2076
|
+
const isImmediateReturn = node.parent && node.parent.type === utils.AST_NODE_TYPES.ReturnStatement;
|
2077
2077
|
if (isImmediateReturn || !util.isReactHookCall(node, ['useRef'])) {
|
2078
2078
|
return;
|
2079
2079
|
}
|
2080
|
-
if (node.parent.id.type !==
|
2080
|
+
if (node.parent.id.type !== utils.AST_NODE_TYPES.Identifier) {
|
2081
2081
|
return;
|
2082
2082
|
}
|
2083
2083
|
const variable = node.parent.id.name;
|
@@ -2091,94 +2091,9 @@ var reactHookUseRef = createRule({
|
|
2091
2091
|
}))
|
2092
2092
|
});
|
2093
2093
|
|
2094
|
-
const RULE_NAME$
|
2095
|
-
function* updateImportStatement(context, fixer, key) {
|
2096
|
-
const sourceCode = context.sourceCode;
|
2097
|
-
const importNode = sourceCode.ast.body.find(node => node.type === 'ImportDeclaration' && node.source.value === 'react');
|
2098
|
-
if (!importNode) {
|
2099
|
-
yield fixer.insertTextBefore(sourceCode.ast.body[0], "import { ".concat(key, " } from 'react';\n"));
|
2100
|
-
return;
|
2101
|
-
}
|
2102
|
-
if (importNode.specifiers.length === 1 && importNode.specifiers[0].type === 'ImportDefaultSpecifier') {
|
2103
|
-
yield fixer.insertTextAfter(importNode.specifiers[0], ", { ".concat(key, " }"));
|
2104
|
-
return;
|
2105
|
-
}
|
2106
|
-
const alreadyImportedKeys = importNode.specifiers.filter(specifier => specifier.type === 'ImportSpecifier').map(specifier => specifier.imported.name);
|
2107
|
-
if (alreadyImportedKeys.includes(key)) {
|
2108
|
-
return;
|
2109
|
-
}
|
2110
|
-
yield fixer.insertTextAfter([...importNode.specifiers].pop(), ", ".concat(key));
|
2111
|
-
}
|
2112
|
-
var reactPreferNamedPropertyAccess = createRule({
|
2113
|
-
name: RULE_NAME$6,
|
2114
|
-
meta: {
|
2115
|
-
type: 'problem',
|
2116
|
-
fixable: 'code',
|
2117
|
-
docs: {
|
2118
|
-
description: 'Enforce importing each member of React namespace separately instead of accessing them through React namespace',
|
2119
|
-
recommended: 'recommended'
|
2120
|
-
},
|
2121
|
-
messages: {
|
2122
|
-
illegalReactPropertyAccess: 'Illegal React property access: {{name}}. Use named import instead.',
|
2123
|
-
disallowImportReactEvent: 'Disallow importing React event types to avoid conflicts with global event types.'
|
2124
|
-
},
|
2125
|
-
schema: []
|
2126
|
-
},
|
2127
|
-
defaultOptions: [],
|
2128
|
-
create(context) {
|
2129
|
-
return {
|
2130
|
-
TSQualifiedName(node) {
|
2131
|
-
if ('name' in node.left && node.left.name !== 'React' || 'name' in node.right && node.right.name.endsWith('Event')) {
|
2132
|
-
return;
|
2133
|
-
}
|
2134
|
-
context.report({
|
2135
|
-
node,
|
2136
|
-
messageId: 'illegalReactPropertyAccess',
|
2137
|
-
data: {
|
2138
|
-
name: node.right.name
|
2139
|
-
},
|
2140
|
-
*fix(fixer) {
|
2141
|
-
yield fixer.replaceText(node, node.right.name);
|
2142
|
-
yield* updateImportStatement(context, fixer, node.right.name);
|
2143
|
-
}
|
2144
|
-
});
|
2145
|
-
},
|
2146
|
-
MemberExpression(node) {
|
2147
|
-
if (node.object.name !== 'React') {
|
2148
|
-
return;
|
2149
|
-
}
|
2150
|
-
context.report({
|
2151
|
-
node,
|
2152
|
-
messageId: 'illegalReactPropertyAccess',
|
2153
|
-
data: {
|
2154
|
-
name: node.property.name
|
2155
|
-
},
|
2156
|
-
*fix(fixer) {
|
2157
|
-
yield fixer.replaceText(node, node.property.name);
|
2158
|
-
yield* updateImportStatement(context, fixer, node.property.name);
|
2159
|
-
}
|
2160
|
-
});
|
2161
|
-
},
|
2162
|
-
ImportDeclaration(node) {
|
2163
|
-
if (node.source.value !== 'react' && node.source.value !== 'preact') {
|
2164
|
-
return;
|
2165
|
-
}
|
2166
|
-
node.specifiers.forEach(specifier => {
|
2167
|
-
if (specifier.type === 'ImportSpecifier' && specifier.imported.name && specifier.imported.name.endsWith('Event')) {
|
2168
|
-
context.report({
|
2169
|
-
node: specifier,
|
2170
|
-
messageId: 'disallowImportReactEvent'
|
2171
|
-
});
|
2172
|
-
}
|
2173
|
-
});
|
2174
|
-
}
|
2175
|
-
};
|
2176
|
-
}
|
2177
|
-
});
|
2178
|
-
|
2179
|
-
const RULE_NAME$5 = 'react-prefer-sx-prop';
|
2094
|
+
const RULE_NAME$4 = 'react-prefer-sx-prop';
|
2180
2095
|
var reactPreferSxProp = createRule({
|
2181
|
-
name: RULE_NAME$
|
2096
|
+
name: RULE_NAME$4,
|
2182
2097
|
meta: {
|
2183
2098
|
type: 'problem',
|
2184
2099
|
docs: {
|
@@ -2249,13 +2164,13 @@ var reactPreferSxProp = createRule({
|
|
2249
2164
|
});
|
2250
2165
|
|
2251
2166
|
function getBasicIdentifier(node) {
|
2252
|
-
if (node.type ===
|
2167
|
+
if (node.type === utils.AST_NODE_TYPES.Identifier) {
|
2253
2168
|
return node.name;
|
2254
2169
|
}
|
2255
|
-
if (node.type ===
|
2170
|
+
if (node.type === utils.AST_NODE_TYPES.Literal) {
|
2256
2171
|
return node.value;
|
2257
2172
|
}
|
2258
|
-
if (node.type ===
|
2173
|
+
if (node.type === utils.AST_NODE_TYPES.TemplateLiteral) {
|
2259
2174
|
if (node.expressions.length > 0) {
|
2260
2175
|
return null;
|
2261
2176
|
}
|
@@ -2265,15 +2180,15 @@ function getBasicIdentifier(node) {
|
|
2265
2180
|
}
|
2266
2181
|
function getBaseIdentifier(node) {
|
2267
2182
|
switch (node.type) {
|
2268
|
-
case
|
2183
|
+
case utils.AST_NODE_TYPES.Identifier:
|
2269
2184
|
{
|
2270
2185
|
return node;
|
2271
2186
|
}
|
2272
|
-
case
|
2187
|
+
case utils.AST_NODE_TYPES.CallExpression:
|
2273
2188
|
{
|
2274
2189
|
return getBaseIdentifier(node.callee);
|
2275
2190
|
}
|
2276
|
-
case
|
2191
|
+
case utils.AST_NODE_TYPES.MemberExpression:
|
2277
2192
|
{
|
2278
2193
|
return getBaseIdentifier(node.object);
|
2279
2194
|
}
|
@@ -2282,7 +2197,7 @@ function getBaseIdentifier(node) {
|
|
2282
2197
|
}
|
2283
2198
|
function getStyesObj(node) {
|
2284
2199
|
const isMakeStyles = node.callee.name === 'makeStyles';
|
2285
|
-
const isModernApi = node.callee.type ===
|
2200
|
+
const isModernApi = node.callee.type === utils.AST_NODE_TYPES.MemberExpression && node.callee.property.name === 'create' && getBaseIdentifier(node.callee.object) && getBaseIdentifier(node.callee.object).name === 'tss';
|
2286
2201
|
if (!isMakeStyles && !isModernApi) {
|
2287
2202
|
return;
|
2288
2203
|
}
|
@@ -2298,21 +2213,21 @@ function getStyesObj(node) {
|
|
2298
2213
|
return;
|
2299
2214
|
}
|
2300
2215
|
switch (styles.type) {
|
2301
|
-
case
|
2216
|
+
case utils.AST_NODE_TYPES.ObjectExpression:
|
2302
2217
|
return styles;
|
2303
|
-
case
|
2218
|
+
case utils.AST_NODE_TYPES.ArrowFunctionExpression:
|
2304
2219
|
{
|
2305
2220
|
const {
|
2306
2221
|
body
|
2307
2222
|
} = styles;
|
2308
2223
|
switch (body.type) {
|
2309
|
-
case
|
2224
|
+
case utils.AST_NODE_TYPES.ObjectExpression:
|
2310
2225
|
return body;
|
2311
|
-
case
|
2226
|
+
case utils.AST_NODE_TYPES.BlockStatement:
|
2312
2227
|
{
|
2313
2228
|
let stylesObj;
|
2314
2229
|
body.body.forEach(bodyNode => {
|
2315
|
-
if (bodyNode.type ===
|
2230
|
+
if (bodyNode.type === utils.AST_NODE_TYPES.ReturnStatement && bodyNode.argument.type === utils.AST_NODE_TYPES.ObjectExpression) {
|
2316
2231
|
stylesObj = bodyNode.argument;
|
2317
2232
|
}
|
2318
2233
|
});
|
@@ -2324,10 +2239,10 @@ function getStyesObj(node) {
|
|
2324
2239
|
}
|
2325
2240
|
}
|
2326
2241
|
function loopStylesObj(node, callback) {
|
2327
|
-
if (node && node.type ===
|
2242
|
+
if (node && node.type === utils.AST_NODE_TYPES.ObjectExpression) {
|
2328
2243
|
node.properties.forEach(property => {
|
2329
|
-
if (property.type ===
|
2330
|
-
if (property.value.type ===
|
2244
|
+
if (property.type === utils.AST_NODE_TYPES.Property && property.value) {
|
2245
|
+
if (property.value.type === utils.AST_NODE_TYPES.ObjectExpression) {
|
2331
2246
|
loopStylesObj(property.value, callback);
|
2332
2247
|
} else {
|
2333
2248
|
callback(property.value);
|
@@ -2337,9 +2252,9 @@ function loopStylesObj(node, callback) {
|
|
2337
2252
|
}
|
2338
2253
|
}
|
2339
2254
|
|
2340
|
-
const RULE_NAME$
|
2255
|
+
const RULE_NAME$3 = 'tss-class-naming';
|
2341
2256
|
var tssClassNaming = createRule({
|
2342
|
-
name: RULE_NAME$
|
2257
|
+
name: RULE_NAME$3,
|
2343
2258
|
meta: {
|
2344
2259
|
type: 'problem',
|
2345
2260
|
docs: {
|
@@ -2363,7 +2278,7 @@ var tssClassNaming = createRule({
|
|
2363
2278
|
if (property.computed) {
|
2364
2279
|
return;
|
2365
2280
|
}
|
2366
|
-
if (property.type === 'ExperimentalSpreadProperty' || property.type ===
|
2281
|
+
if (property.type === 'ExperimentalSpreadProperty' || property.type === utils.AST_NODE_TYPES.SpreadElement) {
|
2367
2282
|
return;
|
2368
2283
|
}
|
2369
2284
|
const className = property.key.value || property.key.name;
|
@@ -2533,9 +2448,9 @@ var colors = {
|
|
2533
2448
|
yellowgreen: [154, 205, 50]
|
2534
2449
|
};
|
2535
2450
|
|
2536
|
-
const RULE_NAME$
|
2451
|
+
const RULE_NAME$2 = 'tss-no-color-name';
|
2537
2452
|
var tssNoColorName = createRule({
|
2538
|
-
name: RULE_NAME$
|
2453
|
+
name: RULE_NAME$2,
|
2539
2454
|
meta: {
|
2540
2455
|
type: 'suggestion',
|
2541
2456
|
docs: {
|
@@ -2556,7 +2471,7 @@ var tssNoColorName = createRule({
|
|
2556
2471
|
return;
|
2557
2472
|
}
|
2558
2473
|
function checkColorLiteral(value) {
|
2559
|
-
if (value.type ===
|
2474
|
+
if (value.type === utils.AST_NODE_TYPES.Literal && typeof value.value === 'string' && Object.keys(colors).includes(value.value.toLowerCase())) {
|
2560
2475
|
context.report({
|
2561
2476
|
node: value,
|
2562
2477
|
messageId: 'disallowColorName'
|
@@ -2569,9 +2484,9 @@ var tssNoColorName = createRule({
|
|
2569
2484
|
}
|
2570
2485
|
});
|
2571
2486
|
|
2572
|
-
const RULE_NAME$
|
2487
|
+
const RULE_NAME$1 = 'tss-no-color-value';
|
2573
2488
|
var tssNoColorValue = createRule({
|
2574
|
-
name: RULE_NAME$
|
2489
|
+
name: RULE_NAME$1,
|
2575
2490
|
meta: {
|
2576
2491
|
type: 'problem',
|
2577
2492
|
docs: {
|
@@ -2592,7 +2507,7 @@ var tssNoColorValue = createRule({
|
|
2592
2507
|
return;
|
2593
2508
|
}
|
2594
2509
|
function checkColorLiteral(value) {
|
2595
|
-
if (value.type ===
|
2510
|
+
if (value.type === utils.AST_NODE_TYPES.Literal && typeof value.value === 'string') {
|
2596
2511
|
const colorCodePattern = /#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgb\?\(\s*(\d{1,3}\s*,\s*){2}\d{1,3}(?:\s*,\s*\d*(?:\.\d+)?)?\s*\)/g;
|
2597
2512
|
if (colorCodePattern.test(value.value)) {
|
2598
2513
|
context.report({
|
@@ -2608,9 +2523,9 @@ var tssNoColorValue = createRule({
|
|
2608
2523
|
}
|
2609
2524
|
});
|
2610
2525
|
|
2611
|
-
const RULE_NAME
|
2526
|
+
const RULE_NAME = 'tss-unused-classes';
|
2612
2527
|
var tssUnusedClasses = createRule({
|
2613
|
-
name: RULE_NAME
|
2528
|
+
name: RULE_NAME,
|
2614
2529
|
meta: {
|
2615
2530
|
type: 'suggestion',
|
2616
2531
|
docs: {
|
@@ -2636,14 +2551,14 @@ var tssUnusedClasses = createRule({
|
|
2636
2551
|
if (property.computed) {
|
2637
2552
|
return;
|
2638
2553
|
}
|
2639
|
-
if (property.type === 'ExperimentalSpreadProperty' || property.type ===
|
2554
|
+
if (property.type === 'ExperimentalSpreadProperty' || property.type === utils.AST_NODE_TYPES.SpreadElement) {
|
2640
2555
|
return;
|
2641
2556
|
}
|
2642
2557
|
definedClasses[property.key.value || property.key.name] = property;
|
2643
2558
|
});
|
2644
2559
|
},
|
2645
2560
|
MemberExpression(node) {
|
2646
|
-
if (node.object.type ===
|
2561
|
+
if (node.object.type === utils.AST_NODE_TYPES.Identifier && node.object.name === 'classes') {
|
2647
2562
|
const whichClass = getBasicIdentifier(node.property);
|
2648
2563
|
if (whichClass) {
|
2649
2564
|
usedClasses[whichClass] = true;
|
@@ -2660,22 +2575,22 @@ var tssUnusedClasses = createRule({
|
|
2660
2575
|
const {
|
2661
2576
|
parent
|
2662
2577
|
} = node;
|
2663
|
-
if (parent.type !==
|
2578
|
+
if (parent.type !== utils.AST_NODE_TYPES.MemberExpression) {
|
2664
2579
|
return;
|
2665
2580
|
}
|
2666
2581
|
if (
|
2667
2582
|
node.object.object &&
|
2668
|
-
node.object.object.type !==
|
2583
|
+
node.object.object.type !== utils.AST_NODE_TYPES.ThisExpression) {
|
2669
2584
|
return;
|
2670
2585
|
}
|
2671
2586
|
const propsIdentifier = getBasicIdentifier(parent.object);
|
2672
2587
|
if (propsIdentifier && propsIdentifier !== 'props') {
|
2673
2588
|
return;
|
2674
2589
|
}
|
2675
|
-
if (!propsIdentifier && parent.object.type !==
|
2590
|
+
if (!propsIdentifier && parent.object.type !== utils.AST_NODE_TYPES.MemberExpression) {
|
2676
2591
|
return;
|
2677
2592
|
}
|
2678
|
-
if (parent.parent.type ===
|
2593
|
+
if (parent.parent.type === utils.AST_NODE_TYPES.MemberExpression) {
|
2679
2594
|
return;
|
2680
2595
|
}
|
2681
2596
|
const parentClassIdentifier = getBasicIdentifier(parent.property);
|
@@ -2700,254 +2615,6 @@ var tssUnusedClasses = createRule({
|
|
2700
2615
|
}
|
2701
2616
|
});
|
2702
2617
|
|
2703
|
-
const RULE_NAME = 'var-naming';
|
2704
|
-
const reactGlobalFuncs = new Set(['createContext', 'forwardRef', 'lazy', 'memo', 'combineProviders']);
|
2705
|
-
const reactFCTypes = new Set(['FC', 'FunctionComponent', 'VFC', 'VoidFunctionComponent']);
|
2706
|
-
const defaultExcludeTypes = ['StoryObj', 'StoryFn'];
|
2707
|
-
const defaultExcludeNames = ['^(__dirname|__filename)$', '(.*)Event$'];
|
2708
|
-
var varNaming = createRule({
|
2709
|
-
name: RULE_NAME,
|
2710
|
-
meta: {
|
2711
|
-
type: 'problem',
|
2712
|
-
docs: {
|
2713
|
-
description: 'Enforce variable and function naming convention',
|
2714
|
-
recommended: 'recommended'
|
2715
|
-
},
|
2716
|
-
schema: [{
|
2717
|
-
type: 'object',
|
2718
|
-
properties: {
|
2719
|
-
funcFormat: {
|
2720
|
-
type: 'array',
|
2721
|
-
items: {
|
2722
|
-
"enum": ['camelCase', 'PascalCase', 'UPPER_CASE']
|
2723
|
-
}
|
2724
|
-
},
|
2725
|
-
varFormat: {
|
2726
|
-
type: 'array',
|
2727
|
-
items: {
|
2728
|
-
"enum": ['camelCase', 'PascalCase', 'UPPER_CASE']
|
2729
|
-
}
|
2730
|
-
},
|
2731
|
-
excludeNames: {
|
2732
|
-
type: 'array',
|
2733
|
-
items: {
|
2734
|
-
type: 'string'
|
2735
|
-
}
|
2736
|
-
},
|
2737
|
-
excludeFuncs: {
|
2738
|
-
type: 'array',
|
2739
|
-
items: {
|
2740
|
-
type: 'string'
|
2741
|
-
}
|
2742
|
-
},
|
2743
|
-
excludeTypes: {
|
2744
|
-
type: 'array',
|
2745
|
-
items: {
|
2746
|
-
type: 'string'
|
2747
|
-
}
|
2748
|
-
}
|
2749
|
-
}
|
2750
|
-
}],
|
2751
|
-
messages: {
|
2752
|
-
invalidFuncNaming: 'Invalid function naming for non-React component, expected {{formats}}',
|
2753
|
-
invalidReactFCNaming: 'Invalid naming convention for React functional component, expected PascalCase',
|
2754
|
-
invalidVarNaming: 'Invalid variable naming, expected {{formats}}'
|
2755
|
-
}
|
2756
|
-
},
|
2757
|
-
defaultOptions: [],
|
2758
|
-
create(context) {
|
2759
|
-
if (!context.options[0]) {
|
2760
|
-
context.options[0] = {};
|
2761
|
-
}
|
2762
|
-
const funcFormat = context.options[0].funcFormat || ['camelCase'];
|
2763
|
-
const varFormat = context.options[0].varFormat || ['camelCase', 'UPPER_CASE'];
|
2764
|
-
let excludeNames = context.options[0].excludeNames || [];
|
2765
|
-
excludeNames = [...defaultExcludeNames, ...excludeNames];
|
2766
|
-
const excludeFuncs = context.options[0].excludeFuncs || [];
|
2767
|
-
let excludeTypes = context.options[0].excludeTypes || [];
|
2768
|
-
excludeTypes = [...defaultExcludeTypes, ...excludeTypes];
|
2769
|
-
function validate(type, {
|
2770
|
-
node,
|
2771
|
-
name
|
2772
|
-
}) {
|
2773
|
-
let isPass = false;
|
2774
|
-
let formats;
|
2775
|
-
let messageId;
|
2776
|
-
switch (type) {
|
2777
|
-
case 'func':
|
2778
|
-
formats = funcFormat;
|
2779
|
-
messageId = 'invalidFuncNaming';
|
2780
|
-
break;
|
2781
|
-
case 'var':
|
2782
|
-
formats = varFormat;
|
2783
|
-
messageId = 'invalidVarNaming';
|
2784
|
-
break;
|
2785
|
-
}
|
2786
|
-
for (const format of formats) {
|
2787
|
-
switch (format) {
|
2788
|
-
case 'camelCase':
|
2789
|
-
if (eslintUtils.isCamelCase(name)) {
|
2790
|
-
isPass = true;
|
2791
|
-
}
|
2792
|
-
break;
|
2793
|
-
case 'PascalCase':
|
2794
|
-
if (eslintUtils.isPascalCase(name)) {
|
2795
|
-
isPass = true;
|
2796
|
-
}
|
2797
|
-
break;
|
2798
|
-
case 'UPPER_CASE':
|
2799
|
-
if (eslintUtils.isUpperCase(name)) {
|
2800
|
-
isPass = true;
|
2801
|
-
}
|
2802
|
-
break;
|
2803
|
-
}
|
2804
|
-
}
|
2805
|
-
if (!isPass) {
|
2806
|
-
context.report({
|
2807
|
-
node: node,
|
2808
|
-
messageId: messageId,
|
2809
|
-
data: {
|
2810
|
-
formats: formats.join(', ')
|
2811
|
-
}
|
2812
|
-
});
|
2813
|
-
}
|
2814
|
-
}
|
2815
|
-
function checkJSXElement(node) {
|
2816
|
-
if (!node) {
|
2817
|
-
return false;
|
2818
|
-
}
|
2819
|
-
if (node.type === 'JSXElement' || node.type === 'JSXFragment') {
|
2820
|
-
return true;
|
2821
|
-
}
|
2822
|
-
if (node.type === 'BlockStatement') {
|
2823
|
-
for (const statement of node.body) {
|
2824
|
-
if (statement.type === 'ReturnStatement') {
|
2825
|
-
if (checkJSXElement(statement.argument)) {
|
2826
|
-
return true;
|
2827
|
-
}
|
2828
|
-
} else if (checkJSXElement(statement)) {
|
2829
|
-
return true;
|
2830
|
-
}
|
2831
|
-
}
|
2832
|
-
}
|
2833
|
-
if (node.type === 'ArrowFunctionExpression' || node.type === 'FunctionExpression') {
|
2834
|
-
return checkJSXElement(node.body);
|
2835
|
-
}
|
2836
|
-
return false;
|
2837
|
-
}
|
2838
|
-
function getTypeReference(node) {
|
2839
|
-
if (node.id.typeAnnotation && node.id.typeAnnotation.typeAnnotation) {
|
2840
|
-
const typeAnnotation = node.id.typeAnnotation.typeAnnotation;
|
2841
|
-
if (typeAnnotation.type === 'TSTypeReference' && typeAnnotation.typeName.type === 'Identifier') {
|
2842
|
-
const typeName = typeAnnotation.typeName.name;
|
2843
|
-
const typeNameLast = typeName.split('.').pop();
|
2844
|
-
return typeNameLast;
|
2845
|
-
}
|
2846
|
-
}
|
2847
|
-
}
|
2848
|
-
return {
|
2849
|
-
FunctionDeclaration(node) {
|
2850
|
-
if (node.type === 'FunctionDeclaration' && node.id) {
|
2851
|
-
const fnName = node.id.name;
|
2852
|
-
const isReactComponent = checkJSXElement(node.body);
|
2853
|
-
if (!isReactComponent) {
|
2854
|
-
validate('func', {
|
2855
|
-
node,
|
2856
|
-
name: fnName
|
2857
|
-
});
|
2858
|
-
}
|
2859
|
-
}
|
2860
|
-
},
|
2861
|
-
VariableDeclarator(node) {
|
2862
|
-
if (node.id && node.init && ['FunctionExpression', 'ArrowFunctionExpression'].includes(node.init.type)) {
|
2863
|
-
const fnName = node.id.name;
|
2864
|
-
let isReactComponent = checkJSXElement(node.init.body);
|
2865
|
-
const typeName = getTypeReference(node);
|
2866
|
-
if (typeName && reactFCTypes.has(typeName)) {
|
2867
|
-
isReactComponent = true;
|
2868
|
-
}
|
2869
|
-
if (!isReactComponent) {
|
2870
|
-
validate('func', {
|
2871
|
-
node,
|
2872
|
-
name: fnName
|
2873
|
-
});
|
2874
|
-
}
|
2875
|
-
} else if (node.id && node.init && node.init.type === 'LogicalExpression') {
|
2876
|
-
const varName = node.id.name;
|
2877
|
-
const parts = [node.init.left, node.init.right];
|
2878
|
-
let partIsReactComponent = false;
|
2879
|
-
for (const part of parts) {
|
2880
|
-
if (['FunctionExpression', 'ArrowFunctionExpression'].includes(part.type)) {
|
2881
|
-
const isReactComponent = checkJSXElement(part.body);
|
2882
|
-
if (isReactComponent) {
|
2883
|
-
partIsReactComponent = true;
|
2884
|
-
}
|
2885
|
-
}
|
2886
|
-
}
|
2887
|
-
if (!partIsReactComponent) {
|
2888
|
-
validate('var', {
|
2889
|
-
node,
|
2890
|
-
name: varName
|
2891
|
-
});
|
2892
|
-
}
|
2893
|
-
} else if (node.id) {
|
2894
|
-
const varName = node.id.name;
|
2895
|
-
for (const excludeRegex of excludeNames) {
|
2896
|
-
if (new RegExp(excludeRegex).test(varName)) {
|
2897
|
-
return;
|
2898
|
-
}
|
2899
|
-
}
|
2900
|
-
const typeName = getTypeReference(node);
|
2901
|
-
if (typeName) {
|
2902
|
-
for (const excludeRegex of excludeTypes) {
|
2903
|
-
if (new RegExp(excludeRegex).test(typeName)) {
|
2904
|
-
return;
|
2905
|
-
}
|
2906
|
-
}
|
2907
|
-
}
|
2908
|
-
if (node.id.parent && node.id.parent.init) {
|
2909
|
-
let calleeName;
|
2910
|
-
let shouldCheckReact = false;
|
2911
|
-
let initNode;
|
2912
|
-
if (node.id.parent.init.type === 'CallExpression') {
|
2913
|
-
initNode = node.id.parent.init;
|
2914
|
-
} else if (node.id.parent.init.type === 'TSAsExpression' && node.id.parent.init.expression && node.id.parent.init.expression.callee) {
|
2915
|
-
initNode = node.id.parent.init.expression;
|
2916
|
-
}
|
2917
|
-
if (initNode) {
|
2918
|
-
shouldCheckReact = true;
|
2919
|
-
if (initNode.callee.type === 'Identifier') {
|
2920
|
-
calleeName = initNode.callee.name;
|
2921
|
-
} else if (initNode.callee.type === 'MemberExpression') {
|
2922
|
-
calleeName = initNode.callee.property.name;
|
2923
|
-
}
|
2924
|
-
}
|
2925
|
-
if (calleeName) {
|
2926
|
-
for (const excludeRegex of excludeFuncs) {
|
2927
|
-
if (new RegExp(excludeRegex).test(calleeName)) {
|
2928
|
-
return;
|
2929
|
-
}
|
2930
|
-
}
|
2931
|
-
}
|
2932
|
-
if (shouldCheckReact) {
|
2933
|
-
if (!calleeName) {
|
2934
|
-
return;
|
2935
|
-
}
|
2936
|
-
if (reactGlobalFuncs.has(calleeName) || reactGlobalFuncs.has(calleeName.split('.').pop())) {
|
2937
|
-
return;
|
2938
|
-
}
|
2939
|
-
}
|
2940
|
-
}
|
2941
|
-
validate('var', {
|
2942
|
-
node,
|
2943
|
-
name: varName
|
2944
|
-
});
|
2945
|
-
}
|
2946
|
-
}
|
2947
|
-
};
|
2948
|
-
}
|
2949
|
-
});
|
2950
|
-
|
2951
2618
|
var ruleFiles = /*#__PURE__*/Object.freeze({
|
2952
2619
|
__proto__: null,
|
2953
2620
|
rules_enforce_mui_icon_alias: enforceMuiIconAlias,
|
@@ -2964,13 +2631,11 @@ var ruleFiles = /*#__PURE__*/Object.freeze({
|
|
2964
2631
|
rules_no_unnecessary_template_literals: noUnnecessaryTemplateLiterals,
|
2965
2632
|
rules_react_better_exhaustive_deps: reactBetterExhaustiveDeps,
|
2966
2633
|
rules_react_hook_use_ref: reactHookUseRef,
|
2967
|
-
rules_react_prefer_named_property_access: reactPreferNamedPropertyAccess,
|
2968
2634
|
rules_react_prefer_sx_prop: reactPreferSxProp,
|
2969
2635
|
rules_tss_class_naming: tssClassNaming,
|
2970
2636
|
rules_tss_no_color_name: tssNoColorName,
|
2971
2637
|
rules_tss_no_color_value: tssNoColorValue,
|
2972
|
-
rules_tss_unused_classes: tssUnusedClasses
|
2973
|
-
rules_var_naming: varNaming
|
2638
|
+
rules_tss_unused_classes: tssUnusedClasses
|
2974
2639
|
});
|
2975
2640
|
|
2976
2641
|
const plugin = {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@agilebot/eslint-plugin",
|
3
|
-
"version": "0.8.
|
3
|
+
"version": "0.8.1",
|
4
4
|
"description": "Agilebot's ESLint plugin",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -18,10 +18,9 @@
|
|
18
18
|
"node": "^18.18.0 || >=20.0.0"
|
19
19
|
},
|
20
20
|
"dependencies": {
|
21
|
-
"@eslint/compat": "^1.2.7",
|
22
21
|
"@typescript-eslint/utils": "~8.25.0",
|
23
22
|
"eslint-plugin-react": "^7.37.2",
|
24
|
-
"@agilebot/eslint-utils": "0.8.
|
23
|
+
"@agilebot/eslint-utils": "0.8.1"
|
25
24
|
},
|
26
25
|
"peerDependencies": {
|
27
26
|
"eslint": "^8.57.0 || ^9.0.0"
|
@@ -33,7 +32,7 @@
|
|
33
32
|
"@types/color-name": "^1.1.4",
|
34
33
|
"@types/estree": "^1.0.5",
|
35
34
|
"color-name": "^2.0.0",
|
36
|
-
"eslint-vitest-rule-tester": "^
|
35
|
+
"eslint-vitest-rule-tester": "^2.2.0",
|
37
36
|
"typescript-eslint": "~8.25.0"
|
38
37
|
},
|
39
38
|
"scripts": {
|