@agilebot/eslint-plugin 0.4.5 → 0.5.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/dist/index.js +69 -24
- package/package.json +4 -2
package/dist/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license @agilebot/eslint-plugin v0.
|
2
|
+
* @license @agilebot/eslint-plugin v0.5.0
|
3
3
|
*
|
4
4
|
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
5
|
*
|
@@ -8,9 +8,11 @@
|
|
8
8
|
*/
|
9
9
|
'use strict';
|
10
10
|
|
11
|
-
var
|
11
|
+
var compat = require('@eslint/compat');
|
12
|
+
var utils = require('@typescript-eslint/utils');
|
12
13
|
var fs = require('node:fs');
|
13
14
|
var path = require('node:path');
|
15
|
+
var eslintUtils = require('@agilebot/eslint-utils');
|
14
16
|
|
15
17
|
function _interopNamespaceDefault(e) {
|
16
18
|
var n = Object.create(null);
|
@@ -33,9 +35,16 @@ var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
|
|
33
35
|
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
34
36
|
|
35
37
|
const rule$1 = require('eslint-plugin-deprecation/dist/rules/deprecation')["default"];
|
36
|
-
const compatRule$1 =
|
38
|
+
const compatRule$1 = compat.fixupRule(rule$1);
|
39
|
+
|
40
|
+
const docBaseUrl = 'https://github.com/sh-agilebot/frontend-toolkit/blob/master/packages/eslint-plugin/src/rules/';
|
41
|
+
const hasDocs = typeof ["enforce-mui-icon-alias","intl-id-missing","intl-id-prefix","intl-no-default","react-better-exhaustive-deps"] !== 'undefined' ?
|
42
|
+
["enforce-mui-icon-alias","intl-id-missing","intl-id-prefix","intl-no-default","react-better-exhaustive-deps"] : [];
|
43
|
+
const createRule = utils.ESLintUtils.RuleCreator(name => hasDocs.includes(name) ? "".concat(docBaseUrl).concat(name, ".md") : "".concat(docBaseUrl).concat(name, ".test.ts"));
|
37
44
|
|
38
|
-
|
45
|
+
const RULE_NAME$i = 'enforce-mui-icon-alias';
|
46
|
+
var enforceMuiIconAlias = createRule({
|
47
|
+
name: RULE_NAME$i,
|
39
48
|
meta: {
|
40
49
|
type: 'problem',
|
41
50
|
docs: {
|
@@ -59,7 +68,7 @@ var enforceMuiIconAlias = eslintUtils.createESLintRule({
|
|
59
68
|
if (specifier.type !== 'ImportSpecifier') {
|
60
69
|
return;
|
61
70
|
}
|
62
|
-
if (specifier.imported.name === specifier.local.name) {
|
71
|
+
if (specifier.imported.name === specifier.local.name || !specifier.local.name.endsWith('Icon')) {
|
63
72
|
context.report({
|
64
73
|
node,
|
65
74
|
messageId: 'iconAlias',
|
@@ -88,7 +97,9 @@ function warnOnce(message) {
|
|
88
97
|
console.warn("Warning: ".concat(message));
|
89
98
|
}
|
90
99
|
|
91
|
-
|
100
|
+
const RULE_NAME$h = 'import-monorepo';
|
101
|
+
var importMonorepo = createRule({
|
102
|
+
name: RULE_NAME$h,
|
92
103
|
meta: {
|
93
104
|
type: 'problem',
|
94
105
|
docs: {
|
@@ -204,7 +215,9 @@ function getIntlIds(context) {
|
|
204
215
|
return results;
|
205
216
|
}
|
206
217
|
|
207
|
-
|
218
|
+
const RULE_NAME$g = 'intl-id-missing';
|
219
|
+
var intlIdMissing = createRule({
|
220
|
+
name: RULE_NAME$g,
|
208
221
|
meta: {
|
209
222
|
type: 'problem',
|
210
223
|
docs: {
|
@@ -292,7 +305,9 @@ var intlIdMissing = eslintUtils.createESLintRule({
|
|
292
305
|
}
|
293
306
|
});
|
294
307
|
|
295
|
-
|
308
|
+
const RULE_NAME$f = 'intl-id-naming';
|
309
|
+
var intlIdNaming = createRule({
|
310
|
+
name: RULE_NAME$f,
|
296
311
|
meta: {
|
297
312
|
type: 'problem',
|
298
313
|
docs: {
|
@@ -385,7 +400,9 @@ var intlIdNaming = eslintUtils.createESLintRule({
|
|
385
400
|
}
|
386
401
|
});
|
387
402
|
|
388
|
-
|
403
|
+
const RULE_NAME$e = 'intl-id-prefix';
|
404
|
+
var intlIdPrefix = createRule({
|
405
|
+
name: RULE_NAME$e,
|
389
406
|
meta: {
|
390
407
|
type: 'problem',
|
391
408
|
docs: {
|
@@ -459,8 +476,10 @@ var intlIdPrefix = eslintUtils.createESLintRule({
|
|
459
476
|
}
|
460
477
|
});
|
461
478
|
|
479
|
+
const RULE_NAME$d = 'intl-id-unused';
|
462
480
|
const usedIds = new Map();
|
463
|
-
var intlIdUnused =
|
481
|
+
var intlIdUnused = createRule({
|
482
|
+
name: RULE_NAME$d,
|
464
483
|
meta: {
|
465
484
|
type: 'problem',
|
466
485
|
docs: {
|
@@ -536,7 +555,9 @@ var intlIdUnused = eslintUtils.createESLintRule({
|
|
536
555
|
}
|
537
556
|
});
|
538
557
|
|
539
|
-
|
558
|
+
const RULE_NAME$c = 'intl-no-default';
|
559
|
+
var intlNoDefault = createRule({
|
560
|
+
name: RULE_NAME$c,
|
540
561
|
meta: {
|
541
562
|
type: 'problem',
|
542
563
|
docs: {
|
@@ -578,7 +599,9 @@ var intlNoDefault = eslintUtils.createESLintRule({
|
|
578
599
|
}
|
579
600
|
});
|
580
601
|
|
581
|
-
|
602
|
+
const RULE_NAME$b = 'no-async-array-methods';
|
603
|
+
var noAsyncArrayMethods = createRule({
|
604
|
+
name: RULE_NAME$b,
|
582
605
|
meta: {
|
583
606
|
type: 'problem',
|
584
607
|
docs: {
|
@@ -620,7 +643,9 @@ var noAsyncArrayMethods = eslintUtils.createESLintRule({
|
|
620
643
|
}
|
621
644
|
});
|
622
645
|
|
623
|
-
|
646
|
+
const RULE_NAME$a = 'no-import-css';
|
647
|
+
var noImportCss = createRule({
|
648
|
+
name: RULE_NAME$a,
|
624
649
|
meta: {
|
625
650
|
type: 'problem',
|
626
651
|
docs: {
|
@@ -651,7 +676,9 @@ var noImportCss = eslintUtils.createESLintRule({
|
|
651
676
|
}
|
652
677
|
});
|
653
678
|
|
654
|
-
|
679
|
+
const RULE_NAME$9 = 'no-then-catch-finally';
|
680
|
+
var noThenCatchFinally = createRule({
|
681
|
+
name: RULE_NAME$9,
|
655
682
|
meta: {
|
656
683
|
type: 'suggestion',
|
657
684
|
docs: {
|
@@ -711,7 +738,9 @@ var noThenCatchFinally = eslintUtils.createESLintRule({
|
|
711
738
|
}
|
712
739
|
});
|
713
740
|
|
714
|
-
|
741
|
+
const RULE_NAME$8 = 'no-unnecessary-template-literals';
|
742
|
+
var noUnnecessaryTemplateLiterals = createRule({
|
743
|
+
name: RULE_NAME$8,
|
715
744
|
meta: {
|
716
745
|
type: 'problem',
|
717
746
|
docs: {
|
@@ -1945,7 +1974,9 @@ function isAncestorNodeOf(a, b) {
|
|
1945
1974
|
}
|
1946
1975
|
|
1947
1976
|
const Components = require('eslint-plugin-react/lib/util/Components');
|
1948
|
-
|
1977
|
+
const RULE_NAME$7 = 'react-hook-use-ref';
|
1978
|
+
var reactHookUseRef = createRule({
|
1979
|
+
name: RULE_NAME$7,
|
1949
1980
|
meta: {
|
1950
1981
|
type: 'suggestion',
|
1951
1982
|
docs: {
|
@@ -1979,6 +2010,7 @@ var reactHookUseRef = eslintUtils.createESLintRule({
|
|
1979
2010
|
}))
|
1980
2011
|
});
|
1981
2012
|
|
2013
|
+
const RULE_NAME$6 = 'react-prefer-named-property-access';
|
1982
2014
|
function* updateImportStatement(context, fixer, key) {
|
1983
2015
|
const sourceCode = context.sourceCode;
|
1984
2016
|
const importNode = sourceCode.ast.body.find(node => node.type === 'ImportDeclaration' && node.source.value === 'react');
|
@@ -1996,7 +2028,8 @@ function* updateImportStatement(context, fixer, key) {
|
|
1996
2028
|
}
|
1997
2029
|
yield fixer.insertTextAfter([...importNode.specifiers].pop(), ", ".concat(key));
|
1998
2030
|
}
|
1999
|
-
var reactPreferNamedPropertyAccess =
|
2031
|
+
var reactPreferNamedPropertyAccess = createRule({
|
2032
|
+
name: RULE_NAME$6,
|
2000
2033
|
meta: {
|
2001
2034
|
type: 'problem',
|
2002
2035
|
fixable: 'code',
|
@@ -2062,7 +2095,9 @@ var reactPreferNamedPropertyAccess = eslintUtils.createESLintRule({
|
|
2062
2095
|
}
|
2063
2096
|
});
|
2064
2097
|
|
2065
|
-
|
2098
|
+
const RULE_NAME$5 = 'react-prefer-sx-prop';
|
2099
|
+
var reactPreferSxProp = createRule({
|
2100
|
+
name: RULE_NAME$5,
|
2066
2101
|
meta: {
|
2067
2102
|
type: 'problem',
|
2068
2103
|
docs: {
|
@@ -2134,7 +2169,7 @@ var reactPreferSxProp = eslintUtils.createESLintRule({
|
|
2134
2169
|
|
2135
2170
|
const pluginReactHooks = require('eslint-plugin-react-hooks');
|
2136
2171
|
const rule = pluginReactHooks.rules['rules-of-hooks'];
|
2137
|
-
const compatRule =
|
2172
|
+
const compatRule = compat.fixupRule(rule);
|
2138
2173
|
compatRule.meta.docs.recommended = false;
|
2139
2174
|
|
2140
2175
|
function getBasicIdentifier(node) {
|
@@ -2226,7 +2261,9 @@ function loopStylesObj(node, callback) {
|
|
2226
2261
|
}
|
2227
2262
|
}
|
2228
2263
|
|
2229
|
-
|
2264
|
+
const RULE_NAME$4 = 'tss-class-naming';
|
2265
|
+
var tssClassNaming = createRule({
|
2266
|
+
name: RULE_NAME$4,
|
2230
2267
|
meta: {
|
2231
2268
|
type: 'problem',
|
2232
2269
|
docs: {
|
@@ -2420,7 +2457,9 @@ var colors = {
|
|
2420
2457
|
yellowgreen: [154, 205, 50]
|
2421
2458
|
};
|
2422
2459
|
|
2423
|
-
|
2460
|
+
const RULE_NAME$3 = 'tss-no-color-name';
|
2461
|
+
var tssNoColorName = createRule({
|
2462
|
+
name: RULE_NAME$3,
|
2424
2463
|
meta: {
|
2425
2464
|
type: 'suggestion',
|
2426
2465
|
docs: {
|
@@ -2454,7 +2493,9 @@ var tssNoColorName = eslintUtils.createESLintRule({
|
|
2454
2493
|
}
|
2455
2494
|
});
|
2456
2495
|
|
2457
|
-
|
2496
|
+
const RULE_NAME$2 = 'tss-no-color-value';
|
2497
|
+
var tssNoColorValue = createRule({
|
2498
|
+
name: RULE_NAME$2,
|
2458
2499
|
meta: {
|
2459
2500
|
type: 'problem',
|
2460
2501
|
docs: {
|
@@ -2491,7 +2532,9 @@ var tssNoColorValue = eslintUtils.createESLintRule({
|
|
2491
2532
|
}
|
2492
2533
|
});
|
2493
2534
|
|
2494
|
-
|
2535
|
+
const RULE_NAME$1 = 'tss-unused-classes';
|
2536
|
+
var tssUnusedClasses = createRule({
|
2537
|
+
name: RULE_NAME$1,
|
2495
2538
|
meta: {
|
2496
2539
|
type: 'suggestion',
|
2497
2540
|
docs: {
|
@@ -2581,11 +2624,13 @@ var tssUnusedClasses = eslintUtils.createESLintRule({
|
|
2581
2624
|
}
|
2582
2625
|
});
|
2583
2626
|
|
2627
|
+
const RULE_NAME = 'var-naming';
|
2584
2628
|
const reactGlobalFuncs = new Set(['createContext', 'forwardRef', 'lazy', 'memo', 'combineProviders']);
|
2585
2629
|
const reactFCTypes = new Set(['FC', 'FunctionComponent', 'VFC', 'VoidFunctionComponent']);
|
2586
2630
|
const otherTypes = new Set(['StoryObj', 'StoryFn']);
|
2587
2631
|
const defaultExcludes = ['^(__dirname|__filename)$', '(.*)Event$'];
|
2588
|
-
var varNaming =
|
2632
|
+
var varNaming = createRule({
|
2633
|
+
name: RULE_NAME,
|
2589
2634
|
meta: {
|
2590
2635
|
type: 'problem',
|
2591
2636
|
docs: {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@agilebot/eslint-plugin",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.5.0",
|
4
4
|
"description": "Agilebot's ESLint plugin",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -18,10 +18,12 @@
|
|
18
18
|
"node": "^18.18.0 || >=20.0.0"
|
19
19
|
},
|
20
20
|
"dependencies": {
|
21
|
+
"@eslint/compat": "^1.1.1",
|
22
|
+
"@typescript-eslint/utils": "~8.5.0",
|
21
23
|
"eslint-plugin-deprecation": "^3.0.0",
|
22
24
|
"eslint-plugin-react": "^7.35.0",
|
23
25
|
"eslint-plugin-react-hooks": "^4.6.2",
|
24
|
-
"@agilebot/eslint-utils": "0.
|
26
|
+
"@agilebot/eslint-utils": "0.5.0"
|
25
27
|
},
|
26
28
|
"peerDependencies": {
|
27
29
|
"eslint": "^7.0.0 || ^8.0.0 || ^9.0.0"
|