no-extra-semi exception or new option
See original GitHub issuehttp://eslint.org/docs/rules/no-extra-semi
- ESLint 2.9.0
- being able to safely concatenate several JS files into one and use no-extra-semi at the same time
If the first character of the file—excluding the eventual preceding whitespace—is ;
it should be ignored.
cf http://stackoverflow.com/q/1873983/248058
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:22 (16 by maintainers)
Top Results From Across the Web
no-extra-semi - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >naming-convention | typescript-eslint
Options . This rule accepts an array of objects, with each object describing a different naming convention. Each property will be described in...
Read more >No-multi-spaces - ESLint - W3cubDocs
This option is an object that expects property names to be AST node types as defined by ESTree. The easiest way to determine...
Read more >Eslint custom rule live preview - javascript - Stack Overflow
... url: "https://eslint.org/docs/rules/no-extra-semi", }, fixable: "code", schema: [], // no options messages: { suggestComment: "Test ...
Read more >JS Guidelines - cPanel Style Guide
ESLint Style Rules, Use this configuration with the --fix option to fix style ... (If you overwrite the exception, it loses the ability...
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
Let’s be careful not to mis-characterize each other’s comments.
@Mouvedia I think by “appeal to authority”, @michaelficarra was referring to the Stack Overflow link, but I don’t think you were actually trying to cite it as an authority (rather, you were more likely just using it as a reference). As much as possible, we should try to assume positive intent and assume that @michaelficarra was just trying to say we needed to test it ourselves.
And I think it’s good for all of us to understand that @michaelficarra and @Mouvedia are coming from different (but equally valid) places here. @Mouvedia is talking about the common experience of concatenation and left out a few subconscious assumptions. @michaelficarra is talking about corner cases that are still nonetheless worth considering. The challenge is to find some common ground. 😄
My personal take (bearing in mind I’m not on the core team) is that even if semicolon prefixing might not be sufficient, it is still commonly done and might deserve some consideration. I also don’t think that
no-extra-semi
was designed to flag for this particular anti-pattern, and so it doesn’t seem right that it should take on this extra responsibility. I could see a new rule for ensuring that the beginning of file allows for safe concatenation. At this point, though, I still think there is merit in a rule option to avoid a semicolon from being flagged at the beginning of the file by theno-extra-semi
rule specifically.Okay, there’s no consensus on the team so we can’t move forward with this.
@Mouvedia as @byk mentioned, you can always take the rule and modify it to do what you want for your own project.