@agilebot/eslint-plugin 0.9.0 → 0.9.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/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/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # @agilebot/eslint-plugin
2
-
3
- [![npm](https://img.shields.io/npm/v/@agilebot/eslint-plugin?color=444&label=)](https://npmjs.com/package/@agilebot/eslint-plugin)
4
-
5
- Agilebot extended ESLint rules. Designed for @agilebot/eslint-config.
6
-
7
- ## Usage
8
-
9
- ```bash
10
- npm install --save-dev eslint @agilebot/eslint-plugin
11
- ```
1
+ # @agilebot/eslint-plugin
2
+
3
+ [![npm](https://img.shields.io/npm/v/@agilebot/eslint-plugin?color=444&label=)](https://npmjs.com/package/@agilebot/eslint-plugin)
4
+
5
+ Agilebot extended ESLint rules. Designed for @agilebot/eslint-config.
6
+
7
+ ## Usage
8
+
9
+ ```bash
10
+ npm install --save-dev eslint @agilebot/eslint-plugin
11
+ ```
@@ -12,13 +12,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
12
12
  //#endregion
13
13
  //#region src/util/rule.js
14
14
  const docBaseUrl = "https://github.com/sh-agilebot/frontend-toolkit/blob/master/packages/eslint-plugin/src/rules/";
15
- const hasDocs = [
16
- "enforce-mui-icon-alias",
17
- "intl-id-missing",
18
- "intl-id-prefix",
19
- "intl-no-default",
20
- "react-better-exhaustive-deps"
21
- ];
15
+ const hasDocs = [];
22
16
  const createRule = ESLintUtils.RuleCreator((name) => hasDocs.includes(name) ? `${docBaseUrl}${name}.md` : `${docBaseUrl}${name}.test.js`);
23
17
 
24
18
  //#endregion
@@ -308,8 +302,7 @@ var intl_id_naming_default = createRule({
308
302
  report(node, node.value);
309
303
  }
310
304
  function processTemplateLiteral(node) {
311
- const displayStr = templateLiteralDisplayStr(node);
312
- report(node, displayStr);
305
+ report(node, templateLiteralDisplayStr(node));
313
306
  }
314
307
  function processAttrNode(node) {
315
308
  if (node.value.type === AST_NODE_TYPES.Literal) return processLiteral(node.value);
@@ -362,8 +355,7 @@ var intl_id_prefix_default = createRule({
362
355
  report(node, node.value);
363
356
  }
364
357
  function processTemplateLiteral(node) {
365
- const displayStr = templateLiteralDisplayStr(node);
366
- report(node, displayStr);
358
+ report(node, templateLiteralDisplayStr(node));
367
359
  }
368
360
  function processAttrNode(node) {
369
361
  if (node.value.type === AST_NODE_TYPES.Literal) return processLiteral(node.value);
@@ -717,15 +709,12 @@ var react_better_exhaustive_deps_default = {
717
709
  create(context) {
718
710
  const additionalHooks = context.options && context.options[0] && context.options[0].additionalHooks ? new RegExp(context.options[0].additionalHooks) : void 0;
719
711
  const enableDangerousAutofixThisMayCauseInfiniteLoops = context.options && context.options[0] && context.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops || false;
720
- const customHooks = context.options && context.options[0] && context.options[0].customHooks || {};
721
- const staticHooks = context.options && context.options[0] && context.options[0].staticHooks || {};
722
- const checkMemoizedVariableIsStatic = context.options && context.options[0] && context.options[0].checkMemoizedVariableIsStatic || false;
723
712
  const options = {
724
713
  additionalHooks,
725
714
  enableDangerousAutofixThisMayCauseInfiniteLoops,
726
- customHooks,
727
- staticHooks,
728
- checkMemoizedVariableIsStatic
715
+ customHooks: context.options && context.options[0] && context.options[0].customHooks || {},
716
+ staticHooks: context.options && context.options[0] && context.options[0].staticHooks || {},
717
+ checkMemoizedVariableIsStatic: context.options && context.options[0] && context.options[0].checkMemoizedVariableIsStatic || false
729
718
  };
730
719
  function reportProblem(problem) {
731
720
  if (enableDangerousAutofixThisMayCauseInfiniteLoops && Array.isArray(problem.suggest) && problem.suggest.length > 0) problem.fix = problem.suggest[0].fix;
@@ -909,8 +898,7 @@ var react_better_exhaustive_deps_default = {
909
898
  for (const reference of currentScope.references) {
910
899
  if (!reference.resolved) continue;
911
900
  if (!pureScopes.has(reference.resolved.scope)) continue;
912
- const referenceNode = fastFindReferenceWithParent(node, reference.identifier);
913
- const dependencyNode = getDependency(referenceNode);
901
+ const dependencyNode = getDependency(fastFindReferenceWithParent(node, reference.identifier));
914
902
  const dependency = analyzePropertyChain(dependencyNode, optionalChains);
915
903
  if (isEffect && dependencyNode.type === "Identifier" && (dependencyNode.parent.type === "MemberExpression" || dependencyNode.parent.type === "OptionalMemberExpression") && !dependencyNode.parent.computed && dependencyNode.parent.property.type === "Identifier" && dependencyNode.parent.property.name === "current" && isInsideEffectCleanup(reference)) currentRefsInEffectCleanup.set(dependency, {
916
904
  reference,
@@ -1509,23 +1497,17 @@ function analyzePropertyChain(node, optionalChains) {
1509
1497
  if (optionalChains) optionalChains.set(result, false);
1510
1498
  return result;
1511
1499
  } else if (node.type === "MemberExpression" && !node.computed) {
1512
- const object = analyzePropertyChain(node.object, optionalChains);
1513
- const property = analyzePropertyChain(node.property, null);
1514
- const result = `${object}.${property}`;
1500
+ const result = `${analyzePropertyChain(node.object, optionalChains)}.${analyzePropertyChain(node.property, null)}`;
1515
1501
  markNode(node, optionalChains, result);
1516
1502
  return result;
1517
1503
  } else if (node.type === "OptionalMemberExpression" && !node.computed) {
1518
- const object = analyzePropertyChain(node.object, optionalChains);
1519
- const property = analyzePropertyChain(node.property, null);
1520
- const result = `${object}.${property}`;
1504
+ const result = `${analyzePropertyChain(node.object, optionalChains)}.${analyzePropertyChain(node.property, null)}`;
1521
1505
  markNode(node, optionalChains, result);
1522
1506
  return result;
1523
1507
  } else if (node.type === "ChainExpression" && !node.computed) {
1524
1508
  const expression = node.expression;
1525
1509
  if (expression.type === "CallExpression") throw new Error(`Unsupported node type: ${expression.type}`);
1526
- const object = analyzePropertyChain(expression.object, optionalChains);
1527
- const property = analyzePropertyChain(expression.property, null);
1528
- const result = `${object}.${property}`;
1510
+ const result = `${analyzePropertyChain(expression.object, optionalChains)}.${analyzePropertyChain(expression.property, null)}`;
1529
1511
  markNode(expression, optionalChains, result);
1530
1512
  return result;
1531
1513
  }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@agilebot/eslint-plugin",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "type": "module",
5
5
  "description": "Agilebot's ESLint plugin",
6
- "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
6
+ "main": "./dist/index.mjs",
7
+ "types": "./dist/index.d.mts",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
10
+ "types": "./dist/index.d.mts",
11
+ "import": "./dist/index.mjs"
12
12
  }
13
13
  },
14
14
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "@typescript-eslint/utils": "~8.29.0",
29
29
  "eslint-plugin-react": "^7.37.2",
30
- "@agilebot/eslint-utils": "0.9.0"
30
+ "@agilebot/eslint-utils": "0.9.2"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "eslint": "^9.0.0"
File without changes