Tslint: The quotemark rule does not allow options and severity.

Created on 12 May 2017  ·  3Comments  ·  Source: palantir/tslint

Bug Report

  • __TSLint version__: 5.2.0
  • __TypeScript version__: 2.3.1
  • __Running TSLint via__: (pick one) CLI / Node.js API / VSCode / grunt-tslint / Atom / Visual Studio / etc

TypeScript code being linted

import { BottomSheetKey, BottomSheetService } from "bottomSheet";
import { INavItem, NavHeight } from 'core/services/nav.service';
import { Configuration } from './app.configuration';

with tslint.json configuration:

{
    "defaultSeverity": "error",
    "extends": [
        "tslint:recommended"
    ],
    "jsRules": {},
    "rules": {
        "quotemark": {
            "options": [ true, "single", "avoid-escape" ],
            "severity": "warning"
        }
    },
}

Actual behavior

The quotemark rule is ignored.

Expected behavior

There should be a warning reported from the quotemark rule on line 1 of the provided snippet at "bottomSheet".

Thoughts

This could be a larger issue with rules, but I've only observed it with quotemark.

Question

Most helpful comment

If you use the new config format with severity and options, you don't want
the first option to be true. If you remove it from the array, the rule
should work as expected.

Am 12.05.2017 18:07 schrieb "Jacob Robertson" notifications@github.com:

Bug Report

  • TSLint version: 5.2.0
  • TypeScript version: 2.3.1
  • Running TSLint via: (pick one) CLI / Node.js API / VSCode /
    grunt-tslint / Atom / Visual Studio / etc

TypeScript code being linted

import { BottomSheetKey, BottomSheetService } from "bottomSheet";import { INavItem, NavHeight } from 'core/services/nav.service';import { Configuration } from './app.configuration';

with tslint.json configuration:

{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {
"quotemark": {
"options": [ true, "single", "avoid-escape" ],
"severity": "warning"
}
},
}

Actual behavior

The quotemark rule is ignored.
Expected behavior

There should be a warning reported from the quotemark rule on line 1 of
the provided snippet at "bottomSheet".
Thoughts

This could be a larger issue with rules, but I've only observed it with
quotemark.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/palantir/tslint/issues/2746, or mute the thread
https://github.com/notifications/unsubscribe-auth/ALaeKN8MtJyisZmnL1SJfgTyAIcaUQPJks5r5IOlgaJpZM4NZfAU
.

All 3 comments

If you use the new config format with severity and options, you don't want
the first option to be true. If you remove it from the array, the rule
should work as expected.

Am 12.05.2017 18:07 schrieb "Jacob Robertson" notifications@github.com:

Bug Report

  • TSLint version: 5.2.0
  • TypeScript version: 2.3.1
  • Running TSLint via: (pick one) CLI / Node.js API / VSCode /
    grunt-tslint / Atom / Visual Studio / etc

TypeScript code being linted

import { BottomSheetKey, BottomSheetService } from "bottomSheet";import { INavItem, NavHeight } from 'core/services/nav.service';import { Configuration } from './app.configuration';

with tslint.json configuration:

{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {
"quotemark": {
"options": [ true, "single", "avoid-escape" ],
"severity": "warning"
}
},
}

Actual behavior

The quotemark rule is ignored.
Expected behavior

There should be a warning reported from the quotemark rule on line 1 of
the provided snippet at "bottomSheet".
Thoughts

This could be a larger issue with rules, but I've only observed it with
quotemark.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/palantir/tslint/issues/2746, or mute the thread
https://github.com/notifications/unsubscribe-auth/ALaeKN8MtJyisZmnL1SJfgTyAIcaUQPJks5r5IOlgaJpZM4NZfAU
.

Yeah, that works. Thanks!

I couldn't find a good example in the docs for how to go from

    "rules": {
         "quotemark": [ true, "single", "avoid-escape" ],
    }

to

    "rules": {
        "quotemark": {
            "options": [ "single", "avoid-escape" ],
            "severity": "warning"
        }
    }

Is this subtle difference mentioned anywhere?

@jacob-robertson yes, it's in the Notable features & enhancements section of the 5.0.0 release notes and the changelog.

Was this page helpful?
0 / 5 - 0 ratings