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

Update: add enforceForFunctionPrototypeMethods option to no-extra-parens #12895

Merged
merged 1 commit into from Jun 5, 2020

Conversation

mdjermanovic
Copy link
Member

Prerequisites checklist

  • I have read the contributing guidelines.
  • The team has reached consensus on the changes proposed in this pull request. If not, I understand that the evaluation process will begin with this pull request and won't be merged until the team has reached consensus.

What is the purpose of this pull request? (put an "X" next to an item)

[X] Bug fix
[X] Changes an existing rule

Fixes #12870

This PR adds enforceForFunctionPrototypeMethods option to the no-extra-parens rule in order to avoid conflicts with wrap-iife "functionPrototypeMethods": true.

Examples of correct code:

/* eslint no-extra-parens: ["error", "all", { "enforceForFunctionPrototypeMethods": false }] */

const foo = (function () {}).call();

const bar = (function () {}).apply();

const baz = (function () {}.call());

const quux = (function () {}.apply());

What changes did you make? (Give an overview)

  • Added the option.
  • Also fixed the wrong IIFE example in the docs.

Is there anything you'd like reviewers to focus on?

Yes! Should we add this option to "functions" schema, too? It doesn't have any options at the moment. That used to be a separate rule, but got merged in no-extra-parens at some point?

This is also a conflict:

/* eslint wrap-iife: ["error", "inside", { functionPrototypeMethods: true }] */
/* eslint no-extra-parens: ["error", "functions"] */

var foo = function () {}.call(); // wrap-iife error

var foo = (function () {}).call(); // no-extra-parens error

@mdjermanovic mdjermanovic added bug ESLint is working incorrectly enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion labels Feb 9, 2020
@kaicataldo kaicataldo merged commit b735a48 into master Jun 5, 2020
@kaicataldo kaicataldo deleted the issue12870 branch June 5, 2020 23:12
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Dec 3, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Dec 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no-extra-parens conflicts with wrap-iife
2 participants