Complaining about missing semicolon when I don't want it!

Answered

Hi,

I'm programming in JavaScript and I prefer not to use semicolons at the end of statements. I've switched off the "Use semicolon to terminate statements" option, but it still complains that a semicolon is missing at EVERY STATEMENT. It's getting a bit annoying. How do I make it stop complaining?

4
13 comments

Hi Tor-Ivar Valåmo,

Settings | Inspections | JavaScript | Code style issues | Unterminated statement

5
Avatar
Tor-Ivar Valåmo

Thanks! That fixed it.

0

Also for other similar problems try pressing Alt+Enter on highlighted code. Context menu will be shown with suggested solutions, including disabling the inspection.

3

Still broken with typescript, even though the tslint.json says "never" for semicolons. WebStorm is increasingly unreliable. 

0

Please can you elaborate on this? what errors do you see?

0

How to prevent IntelliJ from adding semicolons?

I have simple TypeScript class (file name is: Test.ts):

class Test {

method = () => {
} // In this line semicolon will be added! I don't want that!
}

I have turned off warnings (Settings | Inspections | JavaScript | Code style issues | Unterminated statement) but it doesn't help because semicolon appears.

I'm formatting the code: ctrl + alt + l

And semicolon appears! I want to disable that because of TSLint rules. Is it possible?

3

@Rutenisturcinas

"Settings/Preferences | Editor | Code Style | TypeScript --> Punctuation tab" -- it has settings for quotes, semicolon and other stuff when generating/formatting the code.

3

Yes, it is what I was looking for. Thank you for help!

0

For some reason when I format code it removes all the semicolons. I want to have semicolons. 

1

The full way for JavaScript is:

File | Settings | Editor | Inspections | JavaScript | Code style issues | Unterminated statement (must be disabled)

for Typescript:

File | Settings | Editor | Code Style | TypeScript > Punctuation tab > chose "Don't use semicolon to terminate statement"

0

I can't see to turn off this warning. I've done/turn off all settings. Still eslint complaining there's no semi-colon. Why O why is this so hard?

 

0

If the error comes from ESLint (if it has ESLint prefix) then you should edit ESLint configuration. Changing just IDE code style settings wouldn't affect ESLint.

1

Please sign in to leave a comment.