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

Enhance padding-line-between-statements with "iife" statement type #10853

Closed
platinumazure opened this issue Sep 11, 2018 · 2 comments

Comments

@platinumazure
Copy link
Member

commented Sep 11, 2018

What rule do you want to change?

padding-line-between-statements

Does this change cause the rule to produce more or fewer warnings?

Either way, depending on configuration. Does not produce more warnings by default as it is a new option.

How will the change be implemented? (New option, new default behavior, etc.)?

New statement type option: "iife".

Please provide some example code that this change will affect:

/* eslint padding-line-between-statements: [error, [{ blankLine: "always", prev: "iife", next: "*" }]] */

// IIFE example:

(function() {
}());
foo();

// Other block-like:

if (true) {
}
foo();

What does the rule currently do for this code?

Nothing (well, schema error).

Currently, it is possible to use the "block-like" statement type, but that will also cover IfStatement, WhileStatement, DoWhileStatement, ForStatement, other function declarations, etc., meaning the second example would also be enforced. It is not possible to target just IIFEs.

What will the rule do after it's changed?

Users can target IIFEs as previous or next statements in the rule.

N.B. The rule already detects IIFEs as part of "block-like", so this addition will be pretty trivial-- the new statement type's "test" would simply be to call the internal IIFE checker.


Inspired by #10843.

I'll champion this.

@platinumazure

This comment has been minimized.

Copy link
Member Author

commented Oct 3, 2018

Working on this.

platinumazure added a commit that referenced this issue Oct 3, 2018

platinumazure added a commit that referenced this issue Oct 3, 2018

@kaicataldo kaicataldo added accepted and removed evaluating labels Oct 4, 2018

@kaicataldo

This comment has been minimized.

Copy link
Member

commented Oct 4, 2018

This has now been accepted.

@eslint eslint bot locked and limited conversation to collaborators Apr 11, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.