Skip to content
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

Rules for Linting TypeScript #15

Open
gaurav21r opened this issue Mar 7, 2016 · 6 comments
Open

Rules for Linting TypeScript #15

gaurav21r opened this issue Mar 7, 2016 · 6 comments
Assignees
Labels

Comments

@gaurav21r
Copy link
Member

I've done some research on what .tslintrc should look like. Here are my notes:

  1. We already have a very extensive ruleset for JavaScript / ECMAScript with AirBNB Linting Rules for JS #6 .
  2. Unfortunately eslint currently does not work with TypeScript (https://github.com/eslint/typescript-eslint-parser). Its in the works but the autor @nzakas recommends to not use it in production.
  3. TSLint is currently the de facto standard for linting TypeScript.
  4. There is no comprehensive (and maintained) ruleset for tslint like AirBNB.
  5. Large projects in TypeScript have disparate rules for tslint:

In my opinion the long term view is to wait for ESLint to be compatible with TSLint so that all existing .eslintrc files are compatible with TypeScript on Day Zero. For this, I think whoever is reading this issue now or later should help @nzakas with https://github.com/eslint/typescript-eslint-parser

For now, we should use TSLint and find a ruleset which adheres to AirBNB for ES.

@gaurav21r gaurav21r self-assigned this Mar 7, 2016
@gaurav21r
Copy link
Member Author

@riteshe63 For now Lets go with this (https://github.com/Microsoft/tslint-microsoft-contrib/blob/master/tslint.json) Looks the most comprehensive and is Microsoft supported!

@riteshe63
Copy link
Contributor

#27
Solve this issue

@gaurav21r gaurav21r reopened this Sep 20, 2016
@gaurav21r
Copy link
Member Author

We need the final configuration file like so:

{
  "rulesDirectory": "node_modules/tslint-microsoft-contrib",
  "extends": "tslint-microsoft-contrib",
  "rules": {
    "no-for-in-array": false,
    "restrict-plus-operands": false
  }
}

Please note the following points:

  1. We need to add rules because those rules which require typechecking is not supported by https://github.com/AtomLinter/linter-tslint Tracking Enable type-checking for rules that needs it AtomLinter/linter-tslint#109.
  2. extends won't work until Will allow us to use extends in our tslint.json microsoft/tslint-microsoft-contrib#263 is merged.

@HamletDRC
Copy link

There are some angular rules here: https://github.com/mgechev/codelyzer

I have no idea if they are high quality or not.

@gaurav21r
Copy link
Member Author

Great @HamletDRC Will check it out 👍 Do checkout the rest of this repo (although its highly work in progress) and any feedback would be appreciated :)

@gaurav21r
Copy link
Member Author

extends is now done in because of microsoft/tslint-microsoft-contrib#263 thanks to @HamletDRC

We still need to follow up on AtomLinter/linter-tslint#109

gaurav21r added a commit that referenced this issue Sep 23, 2016
@riteshe63 riteshe63 mentioned this issue Nov 8, 2016
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants