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

feat(rules): omit arrow function parens unless they are necessary #11

Merged
merged 1 commit into from
Aug 22, 2018

Commits on Aug 22, 2018

  1. feat(rules): omit arrow function parens unless they are necessary

    Remove `requireForBlockBody` option of `arrow-parens` rule.
    
    BREAKING CHANGE: previously, only arrow functions consisting of a single
    expression were allowed to omit parentheses around the parameter list
    (and required to, if there's only one parameter in the list).  After
    this change, the parens are only allowed when they are required
    syntactically.
    
    Before:
    
    ```js
    const f = x => x;
    
    const g = (x, y) => x + y;
    
    const h = (x) => {
      console.log(x);
    };
    
    const i = (x, f) => {
      f(x);
    };
    ```
    
    After:
    
    ```js
    // Not affected
    const f = x => x;
    
    // Not affected
    const g = (x, y) => x + y;
    
    // AFFECTED
    const h = x => {
      console.log(x);
    };
    
    // Not affected
    const i = (x, f) => {
      f(x);
    };
    ```
    
    This rule is fixable via `eslint --fix`.
    
    Refs: metarhia/Metarhia#22
    aqrln committed Aug 22, 2018
    Configuration menu
    Copy the full SHA
    9e8999d View commit details
    Browse the repository at this point in the history