Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you disable semicolons in ESLint for Javascript?

I want to not allow semicolons to be placed at the end of lines in my Javascript code using ESLint. "semi" and "no-extra-semi" don't work, and I can't find any documentation on how to do this.

like image 868
Ken Mueller Avatar asked Mar 31 '19 21:03

Ken Mueller


People also ask

Do you require semicolons ESLint?

AFAIK the language grammar doesn't require a semicolon after export default . However, if it's required, ESLint should only add one semicolon. ESLint will add semicolons until it stops retrying (10 times) since it will always report a missing semicolon.

Do you not need semicolons in JavaScript?

Semicolons are not required for JavaScript programming, nevertheless I advice you to use it. It makes your code more readable and is actually a good practice, and almost all cool programming languages uses it. Take a stand and use it, it's up to you now!

How do I turn off ESLint rule?

If you want to disable an ESLint rule in a file or on a specific line, you can add a comment. On a single line: const message = 'foo'; console. log(message); // eslint-disable-line no-console // eslint-disable-next-line no-console console.


1 Answers

You want to set semi to ["error", "never"]. This will error when there is a semicolon. Documentation can be found here https://eslint.org/docs/rules/semi#never

like image 112
SebastiaanYN Avatar answered Oct 06 '22 21:10

SebastiaanYN