@agilebot/eslint-plugin 0.3.2 → 0.3.3
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 +86 -86
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license @agilebot/eslint-plugin v0.3.
|
2
|
+
* @license @agilebot/eslint-plugin v0.3.3
|
3
3
|
*
|
4
4
|
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
5
|
*
|
@@ -766,6 +766,91 @@ var unusedClasses = {
|
|
766
766
|
}
|
767
767
|
};
|
768
768
|
|
769
|
+
var noAsyncArrayMethods = {
|
770
|
+
meta: {
|
771
|
+
docs: {
|
772
|
+
description:
|
773
|
+
'No async callback for Array methods forEach, map, filter, reduce, some, every, etc.',
|
774
|
+
category: 'Array',
|
775
|
+
recommended: true
|
776
|
+
},
|
777
|
+
fixable: undefined,
|
778
|
+
schema: []
|
779
|
+
},
|
780
|
+
create: function (context) {
|
781
|
+
return {
|
782
|
+
ExpressionStatement: function (node) {
|
783
|
+
const notAllowedArrayMethods = [
|
784
|
+
'forEach',
|
785
|
+
'filter',
|
786
|
+
'some',
|
787
|
+
'every',
|
788
|
+
'map',
|
789
|
+
'reduce',
|
790
|
+
'reduceRight',
|
791
|
+
'flatMap',
|
792
|
+
'find',
|
793
|
+
'findIndex',
|
794
|
+
'findLast',
|
795
|
+
'findLastIndex'
|
796
|
+
];
|
797
|
+
const { callee } = node.expression;
|
798
|
+
if (!callee || !callee.property || !callee.property.name) {
|
799
|
+
return;
|
800
|
+
}
|
801
|
+
if (notAllowedArrayMethods.includes(callee.property.name)) {
|
802
|
+
const functionArguments = node.expression.arguments.find(n => {
|
803
|
+
return ['ArrowFunctionExpression', 'FunctionExpression'].includes(
|
804
|
+
n.type
|
805
|
+
);
|
806
|
+
});
|
807
|
+
if (functionArguments && functionArguments.async) {
|
808
|
+
context.report({
|
809
|
+
node,
|
810
|
+
message: `No async function in method '${callee.property.name}'`
|
811
|
+
});
|
812
|
+
}
|
813
|
+
}
|
814
|
+
}
|
815
|
+
};
|
816
|
+
}
|
817
|
+
};
|
818
|
+
|
819
|
+
var noUnnecessaryTemplateLiterals = {
|
820
|
+
meta: {
|
821
|
+
type: 'problem',
|
822
|
+
docs: {
|
823
|
+
description: 'Check if a template string contains only one ${}',
|
824
|
+
recommended: true
|
825
|
+
},
|
826
|
+
fixable: 'code',
|
827
|
+
schema: []
|
828
|
+
},
|
829
|
+
create(context) {
|
830
|
+
return {
|
831
|
+
TemplateLiteral(node) {
|
832
|
+
const code = context.sourceCode.getText(node);
|
833
|
+
if (
|
834
|
+
code.startsWith('`${') &&
|
835
|
+
code.endsWith('}`') &&
|
836
|
+
code.split('${').length === 2
|
837
|
+
) {
|
838
|
+
context.report({
|
839
|
+
node,
|
840
|
+
message: 'Unnecessary template string with only one ${}.',
|
841
|
+
fix(fixer) {
|
842
|
+
return fixer.replaceText(
|
843
|
+
node,
|
844
|
+
code.substring(3, code.length - 2)
|
845
|
+
);
|
846
|
+
}
|
847
|
+
});
|
848
|
+
}
|
849
|
+
}
|
850
|
+
};
|
851
|
+
}
|
852
|
+
};
|
853
|
+
|
769
854
|
var betterExhaustiveDeps = {
|
770
855
|
meta: {
|
771
856
|
type: 'suggestion',
|
@@ -2497,91 +2582,6 @@ var preferSxProp = {
|
|
2497
2582
|
}
|
2498
2583
|
};
|
2499
2584
|
|
2500
|
-
var noAsyncArrayMethods = {
|
2501
|
-
meta: {
|
2502
|
-
docs: {
|
2503
|
-
description:
|
2504
|
-
'No async callback for Array methods forEach, map, filter, reduce, some, every, etc.',
|
2505
|
-
category: 'Array',
|
2506
|
-
recommended: true
|
2507
|
-
},
|
2508
|
-
fixable: undefined,
|
2509
|
-
schema: []
|
2510
|
-
},
|
2511
|
-
create: function (context) {
|
2512
|
-
return {
|
2513
|
-
ExpressionStatement: function (node) {
|
2514
|
-
const notAllowedArrayMethods = [
|
2515
|
-
'forEach',
|
2516
|
-
'filter',
|
2517
|
-
'some',
|
2518
|
-
'every',
|
2519
|
-
'map',
|
2520
|
-
'reduce',
|
2521
|
-
'reduceRight',
|
2522
|
-
'flatMap',
|
2523
|
-
'find',
|
2524
|
-
'findIndex',
|
2525
|
-
'findLast',
|
2526
|
-
'findLastIndex'
|
2527
|
-
];
|
2528
|
-
const { callee } = node.expression;
|
2529
|
-
if (!callee || !callee.property || !callee.property.name) {
|
2530
|
-
return;
|
2531
|
-
}
|
2532
|
-
if (notAllowedArrayMethods.includes(callee.property.name)) {
|
2533
|
-
const functionArguments = node.expression.arguments.find(n => {
|
2534
|
-
return ['ArrowFunctionExpression', 'FunctionExpression'].includes(
|
2535
|
-
n.type
|
2536
|
-
);
|
2537
|
-
});
|
2538
|
-
if (functionArguments && functionArguments.async) {
|
2539
|
-
context.report({
|
2540
|
-
node,
|
2541
|
-
message: `No async function in method '${callee.property.name}'`
|
2542
|
-
});
|
2543
|
-
}
|
2544
|
-
}
|
2545
|
-
}
|
2546
|
-
};
|
2547
|
-
}
|
2548
|
-
};
|
2549
|
-
|
2550
|
-
var noUnnecessaryTemplateLiterals = {
|
2551
|
-
meta: {
|
2552
|
-
type: 'problem',
|
2553
|
-
docs: {
|
2554
|
-
description: 'Check if a template string contains only one ${}',
|
2555
|
-
recommended: true
|
2556
|
-
},
|
2557
|
-
fixable: 'code',
|
2558
|
-
schema: []
|
2559
|
-
},
|
2560
|
-
create(context) {
|
2561
|
-
return {
|
2562
|
-
TemplateLiteral(node) {
|
2563
|
-
const code = context.sourceCode.getText(node);
|
2564
|
-
if (
|
2565
|
-
code.startsWith('`${') &&
|
2566
|
-
code.endsWith('}`') &&
|
2567
|
-
code.split('${').length === 2
|
2568
|
-
) {
|
2569
|
-
context.report({
|
2570
|
-
node,
|
2571
|
-
message: 'Unnecessary template string with only one ${}.',
|
2572
|
-
fix(fixer) {
|
2573
|
-
return fixer.replaceText(
|
2574
|
-
node,
|
2575
|
-
code.substring(3, code.length - 2)
|
2576
|
-
);
|
2577
|
-
}
|
2578
|
-
});
|
2579
|
-
}
|
2580
|
-
}
|
2581
|
-
};
|
2582
|
-
}
|
2583
|
-
};
|
2584
|
-
|
2585
2585
|
var ruleFiles = /*#__PURE__*/Object.freeze({
|
2586
2586
|
__proto__: null,
|
2587
2587
|
rules_import_enforce_icon_alias: enforceIconAlias,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@agilebot/eslint-plugin",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.3",
|
4
4
|
"description": "Agilebot's ESLint plugin",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -20,7 +20,7 @@
|
|
20
20
|
"dependencies": {
|
21
21
|
"@typescript-eslint/utils": "~7.7.0",
|
22
22
|
"eslint-plugin-react": "^7.34.1",
|
23
|
-
"@agilebot/eslint-utils": "0.3.
|
23
|
+
"@agilebot/eslint-utils": "0.3.3"
|
24
24
|
},
|
25
25
|
"peerDependencies": {
|
26
26
|
"eslint": "^7.0.0 || ^8.0.0"
|