@agilebot/eslint-plugin 0.3.1 → 0.3.2
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.d.ts +2 -1
- package/dist/index.js +58 -6
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
@@ -4,6 +4,8 @@ declare namespace _default {
|
|
4
4
|
namespace recommended {
|
5
5
|
export let plugins: string[];
|
6
6
|
let rules_1: {
|
7
|
+
'@agilebot/no-unnecessary-template-literals': string;
|
8
|
+
'@agilebot/no-async-array-methods': string;
|
7
9
|
'@agilebot/react-prefer-named-property-access': string;
|
8
10
|
'@agilebot/react-hook-use-ref': string;
|
9
11
|
'@agilebot/react-prefer-sx-prop': string;
|
@@ -12,7 +14,6 @@ declare namespace _default {
|
|
12
14
|
'@agilebot/tss-class-naming': string;
|
13
15
|
'@agilebot/import-enforce-icon-alias': string;
|
14
16
|
'@agilebot/import-monorepo': string;
|
15
|
-
'@agilebot/stylistic-no-unnecessary-template-literals': string;
|
16
17
|
};
|
17
18
|
export { rules_1 as rules };
|
18
19
|
export namespace settings {
|
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.2
|
3
3
|
*
|
4
4
|
* Copyright (c) Agilebot, Inc. and its affiliates.
|
5
5
|
*
|
@@ -2497,6 +2497,56 @@ var preferSxProp = {
|
|
2497
2497
|
}
|
2498
2498
|
};
|
2499
2499
|
|
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
|
+
|
2500
2550
|
var noUnnecessaryTemplateLiterals = {
|
2501
2551
|
meta: {
|
2502
2552
|
type: 'problem',
|
@@ -2544,15 +2594,16 @@ var ruleFiles = /*#__PURE__*/Object.freeze({
|
|
2544
2594
|
rules_react_hook_use_ref: hookUseRef,
|
2545
2595
|
rules_react_prefer_named_property_access: preferNamedPropertyAccess,
|
2546
2596
|
rules_react_prefer_sx_prop: preferSxProp,
|
2547
|
-
rules_stylistic_no_unnecessary_template_literals: noUnnecessaryTemplateLiterals,
|
2548
2597
|
rules_tss_class_naming: classNaming,
|
2549
2598
|
rules_tss_no_color_value: noColorValue,
|
2550
|
-
rules_tss_unused_classes: unusedClasses
|
2599
|
+
rules_tss_unused_classes: unusedClasses,
|
2600
|
+
rules_unprefixed_no_async_array_methods: noAsyncArrayMethods,
|
2601
|
+
rules_unprefixed_no_unnecessary_template_literals: noUnnecessaryTemplateLiterals
|
2551
2602
|
});
|
2552
2603
|
|
2553
2604
|
const rules = {};
|
2554
2605
|
Object.keys(ruleFiles).forEach(key => {
|
2555
|
-
const ruleKey = key.replace(/^rules_/, '');
|
2606
|
+
const ruleKey = key.replace(/^rules_/, '').replace(/^unprefixed_/, '');
|
2556
2607
|
const finalKey = ruleKey.replace(/_/g, '-');
|
2557
2608
|
rules[finalKey] = ruleFiles[key];
|
2558
2609
|
});
|
@@ -2562,6 +2613,8 @@ var index = {
|
|
2562
2613
|
recommended: {
|
2563
2614
|
plugins: ['@agilebot'],
|
2564
2615
|
rules: {
|
2616
|
+
'@agilebot/no-unnecessary-template-literals': 'error',
|
2617
|
+
'@agilebot/no-async-array-methods': 'error',
|
2565
2618
|
'@agilebot/react-prefer-named-property-access': 'error',
|
2566
2619
|
'@agilebot/react-hook-use-ref': 'warn',
|
2567
2620
|
'@agilebot/react-prefer-sx-prop': 'error',
|
@@ -2569,8 +2622,7 @@ var index = {
|
|
2569
2622
|
'@agilebot/tss-no-color-value': 'error',
|
2570
2623
|
'@agilebot/tss-class-naming': 'error',
|
2571
2624
|
'@agilebot/import-enforce-icon-alias': 'error',
|
2572
|
-
'@agilebot/import-monorepo': 'error'
|
2573
|
-
'@agilebot/stylistic-no-unnecessary-template-literals': 'error'
|
2625
|
+
'@agilebot/import-monorepo': 'error'
|
2574
2626
|
},
|
2575
2627
|
settings: {
|
2576
2628
|
react: {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@agilebot/eslint-plugin",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.2",
|
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.2"
|
24
24
|
},
|
25
25
|
"peerDependencies": {
|
26
26
|
"eslint": "^7.0.0 || ^8.0.0"
|