Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix: Ignore unknown nodes for Indent rule (fixes #8440) * Refactor logic to only ignore lines of outermost unknown nodes - Remove extra traversal of AST - Create list of outermost unknown nodes - Ignore lines of outermost unknown nodes only * Refactor known nodes and clean up comments - Convert KNOWN_NODES into Set - Add AwaitExpression to list of KNOWN_NODES - Update comments to clarify logic * Refactor - Do not store unknown nodes in array - Ignore unknown node on estraverse exit of node - If offset dependency is outside of unknown node then ignore line - Small fixups * Refactor dependent line logic - Only handle dependent lines when the first dependency is within the unknown node - Start from the first dependency when calculating the last token dependency - Add an if statement to ensure the first token of a dependent line does not equal the last token dependency - Change if statement in node listener to only branch when the node is unknown - Move finding last dependency check to its own function - Update and add more JSDoc comments * Refactor - Remove the need to traverse all token dependencies - Update getDesiredIndent function to use the first token of the line's offset when there is dependency - Remove the need to traverse all token depencies inside of an unknown node * Fix how we get tokens of line * Refactor Variable Declarator * Fix code style for arrow function * Use new ignore logic on each token on Unknown Node - Add tests for variable declarator with unknown node - Use new logic for ignoring nodes * Remove modification to getDesiredIndent - fix tests - do not use first token of line to get desired indent of token without dependnecy * Fix code style of getDesiredIndent to match original
- Loading branch information