Angular-cli: [lint] tslint.json could extend tslint:recommended

Created on 4 May 2017  路  9Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [X] feature request

Versions.

@angular/cli: 1.1.0-beta.0
node: 7.4.0

Desired functionality.

TSLint has introduced tslint:recommended (and tslint:latest) for a while, allowing a config to extend the recommended default, and just override a few rules.

It means we could simplify the configuration, and just keep a few overrides that are common in the Angular community.

Mention any other details that might be useful.

See the recommended set of rules: https://github.com/palantir/tslint/blob/master/src/configs/recommended.ts

I gave it a naive first try, this is how the tslint.json would look like (to keep the configuration really close to the one we have right now):

{
  "rulesDirectory": [
    "node_modules/codelyzer"
  ],
  "extends": "tslint:recommended",
  "rules": {
    "array-type": false,
    "arrow-parens": false,
    "interface-name": false,
    "import-blacklist": [true, "rxjs"],
    "max-line-length": [
      true,
      140
    ],
    "member-access": false,
    "member-ordering": [
      true,
      "static-before-instance",
      "variables-before-functions"
    ],
    "no-console": [
      true,
      "debug",
      "info",
      "time",
      "timeEnd",
      "trace"
    ],
    "no-empty": false,
    "no-inferrable-types": [true, "ignore-params"],
    "no-non-null-assertion": true,
    "no-string-literal": false,
    "no-switch-case-fall-through": true,
    "object-literal-sort-keys": false,
    "ordered-imports": false,
    "one-line": [
      true,
      "check-open-brace",
      "check-catch",
      "check-else",
      "check-whitespace"
    ],
    "quotemark": [
      true,
      "single"
    ],
    "trailing-comma": false,
    "variable-name": false,

    "directive-selector": [true, "attribute", "pr", "camelCase"],
    "component-selector": [true, "element", "pr", "kebab-case"],
    "use-input-property-decorator": true,
    "use-output-property-decorator": true,
    "use-host-property-decorator": true,
    "no-input-rename": true,
    "no-output-rename": true,
    "use-life-cycle-interface": true,
    "use-pipe-transform-interface": true,
    "component-class-suffix": true,
    "directive-class-suffix": true,
    "no-access-missing-member": true,
    "templates-use-public": true,
    "invoke-injectable": true
  }
}

If you think it is interesting, I can work on a PR.

easy (hours) help wanted 3 (nice to have) feature

Most helpful comment

I think this would be a nice addition, because it means less rules for us to keep up to date.

All 9 comments

I think this would be a nice addition, because it means less rules for us to keep up to date.

@filipesilva Are you working on this? If you aren't I'd like to pick this up.

@laumair I already have a PR nearly ready :)

@cexbrayat Ah! :+1:

Extremely upvote for this. I was very surprised that this's not turned on by default. Have to clean up some shitty code because of it now.

I see that the previous PR didn't make it to master. Does anyone want to give it a try? If there's still interest around this, we'll be happy to merge the PR. Just make sure that you preserve the same tslint.json config.

@mgechev I can give it a go. Do you mean that at first we need the exact same result as the current config, even if that means taking an opposite choice than the recommended set?

For example, we currently don't enforce adjacent-overload-signatures, whereas the recommended set does. That means we'll have to set adjacent-overload-signatures: false in the config if we extend the recommended set. What do you think?

@cexbrayat yes, this would be ideal.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rajjejosefsson picture rajjejosefsson  路  3Comments

MateenKadwaikar picture MateenKadwaikar  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments

daBishMan picture daBishMan  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments