@agilebot/eslint-plugin 0.9.0 → 0.9.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/README.md +11 -11
 - package/dist/index.js +9 -21
 - package/package.json +2 -2
 
    
        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 
     | 
    
         
            -
            [](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 
     | 
    
         
            +
            [](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 
     | 
    
         
            +
            ```
         
     | 
    
        package/dist/index.js
    CHANGED
    
    | 
         @@ -308,8 +308,7 @@ var intl_id_naming_default = createRule({ 
     | 
|
| 
       308 
308 
     | 
    
         
             
            			report(node, node.value);
         
     | 
| 
       309 
309 
     | 
    
         
             
            		}
         
     | 
| 
       310 
310 
     | 
    
         
             
            		function processTemplateLiteral(node) {
         
     | 
| 
       311 
     | 
    
         
            -
            			 
     | 
| 
       312 
     | 
    
         
            -
            			report(node, displayStr);
         
     | 
| 
      
 311 
     | 
    
         
            +
            			report(node, templateLiteralDisplayStr(node));
         
     | 
| 
       313 
312 
     | 
    
         
             
            		}
         
     | 
| 
       314 
313 
     | 
    
         
             
            		function processAttrNode(node) {
         
     | 
| 
       315 
314 
     | 
    
         
             
            			if (node.value.type === AST_NODE_TYPES.Literal) return processLiteral(node.value);
         
     | 
| 
         @@ -362,8 +361,7 @@ var intl_id_prefix_default = createRule({ 
     | 
|
| 
       362 
361 
     | 
    
         
             
            			report(node, node.value);
         
     | 
| 
       363 
362 
     | 
    
         
             
            		}
         
     | 
| 
       364 
363 
     | 
    
         
             
            		function processTemplateLiteral(node) {
         
     | 
| 
       365 
     | 
    
         
            -
            			 
     | 
| 
       366 
     | 
    
         
            -
            			report(node, displayStr);
         
     | 
| 
      
 364 
     | 
    
         
            +
            			report(node, templateLiteralDisplayStr(node));
         
     | 
| 
       367 
365 
     | 
    
         
             
            		}
         
     | 
| 
       368 
366 
     | 
    
         
             
            		function processAttrNode(node) {
         
     | 
| 
       369 
367 
     | 
    
         
             
            			if (node.value.type === AST_NODE_TYPES.Literal) return processLiteral(node.value);
         
     | 
| 
         @@ -717,15 +715,12 @@ var react_better_exhaustive_deps_default = { 
     | 
|
| 
       717 
715 
     | 
    
         
             
            	create(context) {
         
     | 
| 
       718 
716 
     | 
    
         
             
            		const additionalHooks = context.options && context.options[0] && context.options[0].additionalHooks ? new RegExp(context.options[0].additionalHooks) : void 0;
         
     | 
| 
       719 
717 
     | 
    
         
             
            		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 
718 
     | 
    
         
             
            		const options = {
         
     | 
| 
       724 
719 
     | 
    
         
             
            			additionalHooks,
         
     | 
| 
       725 
720 
     | 
    
         
             
            			enableDangerousAutofixThisMayCauseInfiniteLoops,
         
     | 
| 
       726 
     | 
    
         
            -
            			customHooks,
         
     | 
| 
       727 
     | 
    
         
            -
            			staticHooks,
         
     | 
| 
       728 
     | 
    
         
            -
            			checkMemoizedVariableIsStatic
         
     | 
| 
      
 721 
     | 
    
         
            +
            			customHooks: context.options && context.options[0] && context.options[0].customHooks || {},
         
     | 
| 
      
 722 
     | 
    
         
            +
            			staticHooks: context.options && context.options[0] && context.options[0].staticHooks || {},
         
     | 
| 
      
 723 
     | 
    
         
            +
            			checkMemoizedVariableIsStatic: context.options && context.options[0] && context.options[0].checkMemoizedVariableIsStatic || false
         
     | 
| 
       729 
724 
     | 
    
         
             
            		};
         
     | 
| 
       730 
725 
     | 
    
         
             
            		function reportProblem(problem) {
         
     | 
| 
       731 
726 
     | 
    
         
             
            			if (enableDangerousAutofixThisMayCauseInfiniteLoops && Array.isArray(problem.suggest) && problem.suggest.length > 0) problem.fix = problem.suggest[0].fix;
         
     | 
| 
         @@ -909,8 +904,7 @@ var react_better_exhaustive_deps_default = { 
     | 
|
| 
       909 
904 
     | 
    
         
             
            				for (const reference of currentScope.references) {
         
     | 
| 
       910 
905 
     | 
    
         
             
            					if (!reference.resolved) continue;
         
     | 
| 
       911 
906 
     | 
    
         
             
            					if (!pureScopes.has(reference.resolved.scope)) continue;
         
     | 
| 
       912 
     | 
    
         
            -
            					const  
     | 
| 
       913 
     | 
    
         
            -
            					const dependencyNode = getDependency(referenceNode);
         
     | 
| 
      
 907 
     | 
    
         
            +
            					const dependencyNode = getDependency(fastFindReferenceWithParent(node, reference.identifier));
         
     | 
| 
       914 
908 
     | 
    
         
             
            					const dependency = analyzePropertyChain(dependencyNode, optionalChains);
         
     | 
| 
       915 
909 
     | 
    
         
             
            					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 
910 
     | 
    
         
             
            						reference,
         
     | 
| 
         @@ -1509,23 +1503,17 @@ function analyzePropertyChain(node, optionalChains) { 
     | 
|
| 
       1509 
1503 
     | 
    
         
             
            		if (optionalChains) optionalChains.set(result, false);
         
     | 
| 
       1510 
1504 
     | 
    
         
             
            		return result;
         
     | 
| 
       1511 
1505 
     | 
    
         
             
            	} else if (node.type === "MemberExpression" && !node.computed) {
         
     | 
| 
       1512 
     | 
    
         
            -
            		const  
     | 
| 
       1513 
     | 
    
         
            -
            		const property = analyzePropertyChain(node.property, null);
         
     | 
| 
       1514 
     | 
    
         
            -
            		const result = `${object}.${property}`;
         
     | 
| 
      
 1506 
     | 
    
         
            +
            		const result = `${analyzePropertyChain(node.object, optionalChains)}.${analyzePropertyChain(node.property, null)}`;
         
     | 
| 
       1515 
1507 
     | 
    
         
             
            		markNode(node, optionalChains, result);
         
     | 
| 
       1516 
1508 
     | 
    
         
             
            		return result;
         
     | 
| 
       1517 
1509 
     | 
    
         
             
            	} else if (node.type === "OptionalMemberExpression" && !node.computed) {
         
     | 
| 
       1518 
     | 
    
         
            -
            		const  
     | 
| 
       1519 
     | 
    
         
            -
            		const property = analyzePropertyChain(node.property, null);
         
     | 
| 
       1520 
     | 
    
         
            -
            		const result = `${object}.${property}`;
         
     | 
| 
      
 1510 
     | 
    
         
            +
            		const result = `${analyzePropertyChain(node.object, optionalChains)}.${analyzePropertyChain(node.property, null)}`;
         
     | 
| 
       1521 
1511 
     | 
    
         
             
            		markNode(node, optionalChains, result);
         
     | 
| 
       1522 
1512 
     | 
    
         
             
            		return result;
         
     | 
| 
       1523 
1513 
     | 
    
         
             
            	} else if (node.type === "ChainExpression" && !node.computed) {
         
     | 
| 
       1524 
1514 
     | 
    
         
             
            		const expression = node.expression;
         
     | 
| 
       1525 
1515 
     | 
    
         
             
            		if (expression.type === "CallExpression") throw new Error(`Unsupported node type: ${expression.type}`);
         
     | 
| 
       1526 
     | 
    
         
            -
            		const  
     | 
| 
       1527 
     | 
    
         
            -
            		const property = analyzePropertyChain(expression.property, null);
         
     | 
| 
       1528 
     | 
    
         
            -
            		const result = `${object}.${property}`;
         
     | 
| 
      
 1516 
     | 
    
         
            +
            		const result = `${analyzePropertyChain(expression.object, optionalChains)}.${analyzePropertyChain(expression.property, null)}`;
         
     | 
| 
       1529 
1517 
     | 
    
         
             
            		markNode(expression, optionalChains, result);
         
     | 
| 
       1530 
1518 
     | 
    
         
             
            		return result;
         
     | 
| 
       1531 
1519 
     | 
    
         
             
            	}
         
     | 
    
        package/package.json
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            {
         
     | 
| 
       2 
2 
     | 
    
         
             
              "name": "@agilebot/eslint-plugin",
         
     | 
| 
       3 
     | 
    
         
            -
              "version": "0.9. 
     | 
| 
      
 3 
     | 
    
         
            +
              "version": "0.9.1",
         
     | 
| 
       4 
4 
     | 
    
         
             
              "type": "module",
         
     | 
| 
       5 
5 
     | 
    
         
             
              "description": "Agilebot's ESLint plugin",
         
     | 
| 
       6 
6 
     | 
    
         
             
              "main": "./dist/index.js",
         
     | 
| 
         @@ -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. 
     | 
| 
      
 30 
     | 
    
         
            +
                "@agilebot/eslint-utils": "0.9.1"
         
     | 
| 
       31 
31 
     | 
    
         
             
              },
         
     | 
| 
       32 
32 
     | 
    
         
             
              "peerDependencies": {
         
     | 
| 
       33 
33 
     | 
    
         
             
                "eslint": "^9.0.0"
         
     |