Tslint: Relax 'recommended' rules or make them auto-fixable

Created on 20 Nov 2018  路  6Comments  路  Source: palantir/tslint

The recommended rules include some (imho) impossible rules to abide by. Sorting your object keys? Why would I want them alphabetic if they made more sense in some other ordering? Furthermore, it's not a fixable rule, it just complains. I am a huge fan of Typescript and consider linting a very important tool. However, rules like:

  • object-literal-sort-keys
  • ordered-imports
  • interface-name

are too opinionated and prove a burden on the programmer who already has lots of problems to solve while developing a project. The set of 'recommended' rules should, in my opinion, be much more lax than that to reduce the barrier of entry to Typescript and tslint. They should be guiding and helpful, not opinionated and pedantic.

I propose removing the more 'extreme' rules from the recommended ruleset.

Easy Accepting PRs Needs Proposal good first issue

Most helpful comment

Agreed that this is a breaking change and I agree that formatters should do formatting, not linters.

I recently started a new typescript project, took tslint:recommended and found myself setting this immediately:

    // Add rules
    "no-implicit-dependencies": true,

    // Disable recommended rules
    "interface-name": false,
    "object-literal-sort-keys": false,

Can we get a proposal for what the new set would be? We could put in a new preset for tslint:unsafe-and-unstable-recommended that would allow us to play with what the future would look like and get it in now without causing a breaking change.

All 6 comments

Strong +1 to this. It's been brought up before. Anything that's enabled in tslint-config-prettier is probably no longer necessary in the recommended ruleset, along with similar naming rules such as interface-name. Accepting PRs to fix this!

Taking another look at this - technically, this would be a breaking change. Still accepting PRs but they'll likely have to wait until 6.0.0 to be merged in.

Agreed that this is a breaking change and I agree that formatters should do formatting, not linters.

I recently started a new typescript project, took tslint:recommended and found myself setting this immediately:

    // Add rules
    "no-implicit-dependencies": true,

    // Disable recommended rules
    "interface-name": false,
    "object-literal-sort-keys": false,

Can we get a proposal for what the new set would be? We could put in a new preset for tslint:unsafe-and-unstable-recommended that would allow us to play with what the future would look like and get it in now without causing a breaking change.

I agree that formatters should do formatting, not linters.

@ericanderson Me too, but there _are_ fixable rules. Alphabetically sorting your keys is _cool_, but adding it to existing projects is suffering. A fixer would be really really nice, but I guess that would also go in a separate issue.

Any links you can gimme?

Removing the Type: Breaking Change label per #4811. Now accepting PRs!

馃 Beep boop! 馃憠 TSLint is deprecated 馃憟 and you should switch to typescript-eslint! 馃

馃敀 This issue is being locked to prevent further unnecessary discussions. Thank you! 馃憢

Was this page helpful?
0 / 5 - 0 ratings