Skip to content

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

@cexbrayat

Description

@cexbrayat

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P5The team acknowledges the request but does not plan to address it, it remains open for discussioneffort1: easy (hours)featureLabel used to distinguish feature request from other issueshelp wantedLabel noting an issue which the team is looking for contribution from the community to fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions