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

Improve set() detection logic in no-side-effects rule to avoid false positives, catch missed cases, and check imports #914

Merged
merged 1 commit into from Aug 14, 2020

Commits on Aug 14, 2020

  1. fix: improve set() detection logic in no-side-effects rule to check…

    … all imports, catch some missed cases, and avoid false positives
    
    This improves the logic for detecting `set()` and `setProperties()` inside computed properties, since there were a lot of problems with it before.
    
    Fixes some false positives including:
    
    ```js
    computed(function() { foo1.foo2.set('bar', 123); })
    ```
    
    ```js
    computed(function() { set('bar', 123); })
    ```
    
    Catches additional violations including:
    
    ```js
    computed(function() { this.foo.set('bar', 123); }) // only `this.set()` detected before
    ```
    
    ```js
    computed(function() { set(this.foo, 123); }) // only `set(this, ...)` detected before
    ```
    
    Also updates the rule to use the actual imported names for the `set` and `setProperties` functions.
    bmish committed Aug 14, 2020
    Configuration menu
    Copy the full SHA
    9e618c6 View commit details
    Browse the repository at this point in the history