Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefer-modern-dom-apis: Only fix when expression is not used #503

Merged

Commits on Feb 1, 2020

  1. fix(prefer-modern-dom-apis): Switch to whitelist for determining wh…

    …ere node return values are expected safe not to be used.
    
    For `prefer-modern-dom-apis`, the change will avoid fixers in more cases than just `VariableDeclarator` and `AssignmentExpression` parent types (as previously); will now avoid whenever parent is not an `ExpressionStatement` since many other parents, e.g., `ArrayExpression`, `IfStatement`, `'MemberExpression`,  `Property`, `ReturnStatement`, etc. can use a return value.
    
    For `prefer-node-*` rules, rather than blacklisting an albeit more extensive set of parents, will also switch to a whitelist, potentially avoiding fixers on other contexts not previously avoided, e.g., `AwaitExpression`.
    
    The previous avoidance by `prefer-node-*` of fixers with `ExpressionStatement` grandparents is not currently required.
    
    Also:
    1. provides minor optimization to avoid declaring fixer with value when not needed.
    2. fixes a test which made a fix which would break because of an inability of the replacement API to return a value.
    brettz9 committed Feb 1, 2020
    Copy the full SHA
    ff4a6ca View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    2a1efcd View commit details
    Browse the repository at this point in the history
  3. Refactor rules/utils/is-value-not-usable.js

    Co-Authored-By: fisker Cheung <lionkay@gmail.com>
    brettz9 and fisker committed Feb 1, 2020
    Copy the full SHA
    a5d5d53 View commit details
    Browse the repository at this point in the history