tslint complains about single quotes in karma.conf.js

I have an Angular project thar I created recently with the CLI using ng new.

If I run "npm run lint" everything passes and I'm good to go.  However, if I'm in WebStorm and I go to Code > Inspect Code and run it then I am getting errors on "karma.conf.js" and "protractor.conf.js":  "TSLInt: ' should be " (quotemark)".

I am using single quotes everywhere and WebStorm is happy that all the typescript files are properly (single) quoted.  But just not these files.

In my ts

"quotemark": [
true,
"single"
],

lint.json in the root dir, it has:

There is another tslint.json file in the "src" directory that extends it but doesn't change this setting.  (These are the default angular tslint files).

If I go to File > Settings > Editor > Code Style > Javascript > Punctuation it is setup to use single quotes always.  This is both my default and also setup in the Project.  This is also the same for Typescript.

My TSLint settings are setup to use Automatic TSLint configuration.  I'm using WebStorm 2019.1 on Windows10.

What do I have to do to stop WebStorm complaining about this?

2 comments

In 2019.1 .js files are linted if "jsRules" is present in tslint.json (WEB-36890, extended configs are checked as well)

Your tslint.json extends "tslint:recommended" that, in turn, has with the following rule in its jsRules:

quotemark: {
options: ["double", "avoid-escape"],

},

see https://github.com/palantir/tslint/blob/master/src/configs/recommended.ts#L232

jsRules are applied to javascript when linting - thus the errors.

You can add your .js files to exclude option in tslint.json if you don't want them to be linted:

"linterOptions": {
"exclude": ["**/*.js"]
}

 

This change will be reverted in 2019.1.1 - there will be the checkbox that existed in previous versions - Process JS files, off by default

2

Ah that's exactly what I needed!  Thank you very much!!

0

Please sign in to leave a comment.