Skip to content

[lint] tslint.json could extend tslint:recommended #6179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cexbrayat opened this issue May 4, 2017 · 9 comments · Fixed by #13213
Closed

[lint] tslint.json could extend tslint:recommended #6179

cexbrayat opened this issue May 4, 2017 · 9 comments · Fixed by #13213
Labels
effort1: easy (hours) feature Issue that requests a new feature help wanted P5 The team acknowledges the request but does not plan to address it, it remains open for discussion

Comments

@cexbrayat
Copy link
Member

cexbrayat commented May 4, 2017

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.

@filipesilva
Copy link
Contributor

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

@filipesilva filipesilva self-assigned this May 8, 2017
@filipesilva filipesilva added help wanted effort1: easy (hours) P5 The team acknowledges the request but does not plan to address it, it remains open for discussion type: enhancement labels May 8, 2017
@laumair
Copy link
Contributor

laumair commented May 9, 2017

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

@cexbrayat
Copy link
Member Author

@laumair I already have a PR nearly ready :)

@laumair
Copy link
Contributor

laumair commented May 9, 2017

@cexbrayat Ah! 👍

ValeryVS added a commit to ValeryVS/angular-cli that referenced this issue May 30, 2017
no need to duplicate rules
new rules can be applied without updating, when new tslint is used

Fixes: angular#6179
ValeryVS added a commit to ValeryVS/angular-cli that referenced this issue May 30, 2017
no need to duplicate rules
new rules can be applied without updating, when new tslint is used

Fixes: angular#6179
ValeryVS added a commit to ValeryVS/angular-cli that referenced this issue May 31, 2017
no need to duplicate rules
new rules can be applied without updating, when new tslint is used

Fixes: angular#6179
ValeryVS added a commit to ValeryVS/angular-cli that referenced this issue Jun 2, 2017
no need to duplicate rules
new rules can be applied without updating, when new tslint is used

Fixes: angular#6179
ValeryVS added a commit to ValeryVS/angular-cli that referenced this issue Jun 2, 2017
no need to duplicate rules
new rules can be applied without updating, when new tslint is used

Fixes: angular#6179
ValeryVS added a commit to ValeryVS/angular-cli that referenced this issue Jun 2, 2017
no need to duplicate rules
new rules can be applied without updating, when new tslint is used

Fixes: angular#6179
ValeryVS added a commit to ValeryVS/angular-cli that referenced this issue Jun 2, 2017
no need to duplicate rules
new rules can be applied without updating, when new tslint is used

Fixes: angular#6179
ValeryVS added a commit to ValeryVS/angular-cli that referenced this issue Jun 8, 2017
no need to duplicate rules
new rules can be applied without updating, when new tslint is used

Fixes: angular#6179
ValeryVS added a commit to ValeryVS/angular-cli that referenced this issue Jul 26, 2017
no need to duplicate rules
new rules can be applied without updating, when new tslint is used

Fixes: angular#6179
@hansl hansl added feature Issue that requests a new feature and removed type: enhancement labels Jan 30, 2018
@fetis
Copy link

fetis commented Sep 28, 2018

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.

@mgechev
Copy link
Member

mgechev commented Dec 18, 2018

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.

@cexbrayat
Copy link
Member Author

@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?

@mgechev
Copy link
Member

mgechev commented Dec 18, 2018

@cexbrayat yes, this would be ideal.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort1: easy (hours) feature Issue that requests a new feature help wanted P5 The team acknowledges the request but does not plan to address it, it remains open for discussion
Projects
None yet
6 participants