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

Add .ts and .tsx support on ESLint #1734

Closed
brendanoffer opened this issue Aug 21, 2019 · 4 comments
Closed

Add .ts and .tsx support on ESLint #1734

brendanoffer opened this issue Aug 21, 2019 · 4 comments

Comments

@brendanoffer
Copy link
Contributor

Hi, our project is using ESLint to lint our .ts and .tsx files. We are doing this because TSLint is being deprecated and moved to @typescript-eslint.

Currently, the hound ESLint parser is configured to parse .js .es6 .jsx .vue files. Would you be open to either including .ts and .tsx files in the FILE_REGEXP or a PR to extend hound's configuration to accept more files extension types?

As an aside, eslint itself only lints js files by default. In order to lint your files an --ext=.ts,.tsx argument is necessary for ESlint to scan typescript files.

@gylaz
Copy link
Member

gylaz commented Aug 21, 2019

Yes, a PR for this would be welcome.

A few questions that I have regarding support of TS files with Hound and ESLint.

  • What happens when we run eslint foo/bar/baz.ts? (this is how Hound actually lints each file)
  • How do we know if a user wants their TS files linted with ESlint? Can we lint them anyway if typescript-eslint is not present?

@brendanoffer
Copy link
Contributor Author

brendanoffer commented Aug 22, 2019

  1. If hound passes a .ts file to eslint it will lint the file regardless of extension. The issue is that eslint (or hound) will not select or lint these files by default. For example something like eslint components/ would lint all js and jsx files but not ts. Conversely, if we ran eslint --ext=.ts,.tsx components/ it would run against the ts files.

  2. a. I believe you'd have to make the file types (extensions) configurable by the user.
    b. You can lint the ts files without typescript-eslint. The linter would run against the file based on the configured eslintrc file. I don't think you would want to prevent this from happening as its possible some users would want to customize which linters and rulesets they use.

@brendanoffer
Copy link
Contributor Author

brendanoffer commented Aug 26, 2019

I believe this PR will force Hound to scan the files. If users do not want the files scanned they can use eslint built in functionality with the eslintignore file

#1738

@gylaz
Copy link
Member

gylaz commented Sep 14, 2019

The related PR was merged.

@gylaz gylaz closed this as completed Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants