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?

11 comments
Comment actions Permalink

Hi Tor-Ivar Valåmo,

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

5
Comment actions Permalink

Thanks! That fixed it.

0
Comment actions Permalink

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
Comment actions Permalink

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

0
Comment actions Permalink

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

0
Comment actions Permalink

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
Comment actions Permalink

@Rutenisturcinas

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

3
Comment actions Permalink

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

0
Comment actions Permalink

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

1
Comment actions Permalink

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

Please sign in to leave a comment.