Rule Proposal: lines-around-commonjs-default-exports
See original GitHub issueFrom requirePaddingNewLinesBeforeExport and disallowPaddingNewLinesBeforeExport.
This rule will require/disallow blank lines before/after the assignment of module.exports
.
{
"lines-around-commonjs-default-exports": ["error", "always" or "never"],
// or
"lines-around-commonjs-default-exports": ["error", {
"after": "always" or "never",
"before": "always" or "never"
}]
}
Valid:
/*eslint lines-around-commonjs-default-exports: ["error", "always"]*/
var a = 2;
module.exports = a;
if (cond) {
module.exports = a; // ignore at the first/last of a block. this is warned by padded-blocks
}
/*eslint lines-around-commonjs-default-exports: ["error", "never"]*/
var a = 2;
module.exports = a;
if (cond) {
module.exports = a; // ignore at the first/last of a block. this is warned by padded-blocks
}
Invalid:
/*eslint lines-around-commonjs-default-exports: ["error", "always"]*/
var a = 2;
module.exports = a;
foo();
/*eslint lines-around-commonjs-default-exports: ["error", "never"]*/
var a = 2;
module.exports = a;
foo();
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:37 (37 by maintainers)
Top Results From Across the Web
Proposed rule: Order Competition Rule - SEC.gov
proposed rule would prohibit a restricted competition trading center from internally executing certain orders of individual investors at a ...
Read more >Federal Register/Vol. 87, No. 46/Wednesday, March 9, 2022 ...
ACTION: Proposed rule. SUMMARY: The Securities and Exchange. Commission is proposing new rules under the Investment Advisers Act of.
Read more >SEC Proposes New Rules on Adviser Oversight of Service ...
The SEC's objective in proposing the outsourcing rule is to establish “minimum and consistent” requirements for the oversight of outsourcing by ...
Read more >SEC Proposes Amendments to the Shareholder Proposal Rules
The SEC proposed modifying certain bases for excluding shareholder proposals from company proxy statements. If adopted, these amendments are ...
Read more >SEC proposes rules impacting private funds and advisers
The SEC proposed rules to enhance private fund reporting on Form PF and aimed at enhancing investor protection.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
imo, it’s fine to ship without it being fixable. Adding that in the future should be a reasonable thing to do.
If it handles
exports
, I remove-default
from the rule name and imagine options: