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

Lint TypeScript files #5638

Closed
TerribleDev opened this issue Oct 31, 2018 · 8 comments
Closed

Lint TypeScript files #5638

TerribleDev opened this issue Oct 31, 2018 · 8 comments
Milestone

Comments

@TerribleDev
Copy link

Is this a bug report?

No

The --typescript flag does not seem to use tslint to lint the files. This seems a bit odd to me, as the javascript version ships with an eslint config.

@Timer Timer added this to the 2.1.1 milestone Oct 31, 2018
@Timer
Copy link
Contributor

Timer commented Oct 31, 2018

Our ESLint configuration is strictly to catch errors, which TypeScript does by nature. Adding TSLint is unnecessary. If you'd like to add linting rules, you can do so in a separate linting process on commit.

@Timer Timer closed this as completed Oct 31, 2018
@TerribleDev
Copy link
Author

Our ESLint configuration is strictly to catch errors, which TypeScript does by nature

That's not really true, typescript does not stop you from falling through switch statements, accidentally using == instead of === or using let when you should really use const. Also, arguably allowing any types can easily cause errors which tslint can forbid.

@Timer
Copy link
Contributor

Timer commented Oct 31, 2018

Hmm, I'd be more than happy to turn on ESLint to catch some of these errors in TS files! We probably don't want to use TSLint.

Can you put together a PR?

@ianschmitz
Copy link
Contributor

Our ESLint configuration is strictly to catch errors, which TypeScript does by nature

That's not really true, typescript does not stop you from falling through switch statements, accidentally using == instead of === or using let when you should really use const. Also, arguably allowing any types can easily cause errors which tslint can forbid.

To clarify, typescript does actually support catching falling through switch statements by enabling noFallthroughCasesInSwitch, however i do agree with the rest of what you've said :)

@Timer Timer reopened this Oct 31, 2018
@Timer Timer changed the title typescript tslint? Lint TypeScript files Oct 31, 2018
@Timer Timer modified the milestones: 2.1.1, 3.0 Oct 31, 2018
@TerribleDev
Copy link
Author

@Timer how can eslint scan ts files? AFAIK it can't parse the ts syntax (although I could be mistaken). Also there are ts specific properties you want to catch such as forbidding any

@Timer
Copy link
Contributor

Timer commented Oct 31, 2018

Forbidding any is a style rule we won't support.

Also, you can use typescript-eslint-parser: https://github.com/eslint/typescript-eslint-parser

@TerribleDev
Copy link
Author

@Timer Fair enough

@Timer
Copy link
Contributor

Timer commented Oct 31, 2018

Created #5641 to track. Let's go with TSLint.

@Timer Timer closed this as completed Oct 31, 2018
@lock lock bot locked and limited conversation to collaborators Jan 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants