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

Allow specifying additional extensions to ESLint #214

Merged
merged 1 commit into from
Jan 17, 2020

Conversation

Tomtomgo
Copy link
Contributor

ESLint can be used for not just JS files, it can also be used for
TypeScript files. Currently Sputnik does not consider any other file
extension than .js for ESLint linting.

To make Sputnik pass TypeScript files to ESLint, we add an option to
consider additional file types: eslint.additionalExtensions. It expects
a comma-joined string of extensions, without "." in front. For example
"ts,tsx".

This configuration is injected into the ESLintProcessor from the
ESLintProcessorFactory. While we're at it, we also pull out
construction of the ESLintExecutor to ESLintProcessorFactory.

Closes #213.

@Tomtomgo Tomtomgo force-pushed the feature/eslint-additional-extensions branch from d288eb4 to df0f4bf Compare December 27, 2019 14:53
@codecov-io
Copy link

codecov-io commented Dec 27, 2019

Codecov Report

Merging #214 into master will decrease coverage by 0.07%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #214      +/-   ##
============================================
- Coverage     73.52%   73.45%   -0.08%     
  Complexity      612      612              
============================================
  Files           145      146       +1     
  Lines          1953     1955       +2     
  Branches        127      127              
============================================
  Hits           1436     1436              
- Misses          460      462       +2     
  Partials         57       57
Impacted Files Coverage Δ Complexity Δ
...utnik/processor/eslint/ESLintProcessorFactory.java 66.66% <ø> (ø) 2 <0> (ø) ⬇️
...va/pl/touk/sputnik/review/filter/ESLintFilter.java 0% <0%> (ø) 0 <0> (?)
...touk/sputnik/processor/eslint/ESLintProcessor.java 0% <0%> (ø) 0 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5bd6622...334a847. Read the comment docs.

@SpOOnman
Copy link
Collaborator

SpOOnman commented Jan 2, 2020

I like the idea of including more extensions for ESLint. Thanks!

Your implementation lacks tests and you modify JavaScriptFilter with empty array, which is used elsewhere. That should be fixed.

Although I think that you can simplify your implementation. If ESLint supports js, jsx, ts and tsx file just create ESLintFilter especially for it? Just take a look at PmdFilter. It would be trivial and it would cover all your needs I guess?

ESLint can be used for not just JS files, it can also be used for
TypeScript files. Currently Sputnik does not consider any other file
extension than .js for ESLint linting.

To make Sputnik pass TypeScript files to ESLint, we add a new
FileFilter: ESLintFilter. This will include JS, JSX, TS and TSX
files.

Closes TouK#213.
@Tomtomgo Tomtomgo force-pushed the feature/eslint-additional-extensions branch from df0f4bf to 334a847 Compare January 8, 2020 12:01
@Tomtomgo
Copy link
Contributor Author

Tomtomgo commented Jan 8, 2020

Thanks for the comments @SpOOnman!

Your implementation lacks tests and you modify JavaScriptFilter with empty array, which is used elsewhere. That should be fixed.

Does this still hold given we add ESLintFilter now? I wasn't able to spot existing tests to change/update.

Although I think that you can simplify your implementation. If ESLint supports js, jsx, ts and tsx file just create ESLintFilter especially for it? Just take a look at PmdFilter. It would be trivial and it would cover all your needs I guess?

Good call, what about the updated commit?

@SpOOnman SpOOnman merged commit 9fd3702 into TouK:master Jan 17, 2020
@SpOOnman
Copy link
Collaborator

Thanks @Tomtomgo !

rufuslevi pushed a commit to rufuslevi/sputnik that referenced this pull request Mar 12, 2024
ESLint can be used for not just JS files, it can also be used for
TypeScript files. Currently Sputnik does not consider any other file
extension than .js for ESLint linting.

To make Sputnik pass TypeScript files to ESLint, we add a new
FileFilter: ESLintFilter. This will include JS, JSX, TS and TSX
files.

Closes TouK#213.
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

Successfully merging this pull request may close these issues.

Feature Request - allow linting .ts and .tsx files with ESLint processor
3 participants