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 eslint typescript support #305

Merged
merged 23 commits into from
Jul 12, 2019
Merged

add eslint typescript support #305

merged 23 commits into from
Jul 12, 2019

Conversation

johnnyreilly
Copy link
Member

@johnnyreilly johnnyreilly commented Jun 30, 2019

This PR is intended to start the journey towards adding eslint TypeScript support: #203

I'm not sure how long it will take to do this as I'm somewhat time poor right now, so all help is appreciated ❤️ 😄

So, what's happened so far? This:

  1. Disabled tslint --fix during commits - in future we should consider using eslint --fix, but I'd rather do that in a subsequent PR to make this one less noisy.
  2. Added a new test project called project_eslint. This contains some simple eslint errors which are visible in VS Code with the ESLint VS Code plugin.
  3. Added an eslint option to the plugin and put the mechanism in place in service.ts to call it.
  4. Added a basic implementation to both IncrementalChecker (for Vue users) and ApiIncrementalChecker.
  5. Added a first test
  6. Tested it on a simple project. All looks good!

You can see what usage of this looks like by looking at this PR: TypeStrong/ts-loader#960

The plan to deprecate tslint support and remove it in future still stands. However, before we get to that point I'd like to ship eslint support and ensure it's doing what we need.

Having looked at the code around tslint support, it looks like removing tslint support will be a nice simplification of the codebase.

@phryneas
Copy link
Contributor

phryneas commented Jul 2, 2019

Heyo, I'll try to take a look at this at the weekend - I'm very preoccupied right now. But I'm watching :)

@johnnyreilly
Copy link
Member Author

johnnyreilly commented Jul 2, 2019

Cool - I'll see if I can take it for a test drive on a real codebase in the meantime. That said, busy week, might have to wait - just wanted to give a heads up that it was happening 😁

Oh side question:

I noticed that rpc.js triggers some errors in the console in vs code sometimes. It doesn't seem to stop tests working but it did get me wondering:

  1. Could / should this file be TypeScript instead of js?
  2. worker-rpc has received updates - should we update fork-ts-checker-webpack-plugin to accommodate at some point?

https://github.com/Realytics/fork-ts-checker-webpack-plugin/blob/master/test/integration/helpers/rpc.js

@johnnyreilly johnnyreilly changed the title Work in progress: add eslint typescript support add eslint typescript support Jul 3, 2019
README.md Outdated Show resolved Hide resolved
@johnnyreilly
Copy link
Member Author

Tested this on a large codebase. It works fine, however it's subject to the performance issues that typescript-eslint seems to have; see here: typescript-eslint/typescript-eslint#389

@johnnyreilly
Copy link
Member Author

Would someone be able to review this PR please? I think we're ready to go!

@phryneas
Copy link
Contributor

phryneas commented Jul 7, 2019

Skimmed it so far, looks good but I might have some suggestions.
I'll try to set aside some time this evening for a thorough review.

@johnnyreilly
Copy link
Member Author

The promise of a review made me do some of the mini refactorings I hadn't yet got round to 😁

@phryneas
Copy link
Contributor

phryneas commented Jul 7, 2019

Yeah, sorry, I'm quite tired today and not really up for the task. I commented what I could see right of the bat, not everything might be correct and most of it definitely debatable. I'll give it a second look tomorrow.

Props for the "share eslint between checkers" commit, I was definitely going to suggest that after having read it this morning :)

@johnnyreilly
Copy link
Member Author

Yeah, sorry, I'm quite tired today and not really up for the task. I commented what I could see right of the bat, not everything might be correct and most of it definitely debatable. I'll give it a second look tomorrow.

Dude, take your time! I appreciate you looking at all. There's no rush; nothing is on fire 😁

Props for the "share eslint between checkers" commit, I was definitely going to suggest that after having read it this morning :)

Yeah, my DRY-sense was tingling there; had to deal with it. Went slightly further in my last commit to share the logic for using ESLint as well. Felt better about myself after 😉

Copy link
Collaborator

@piotr-oles piotr-oles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! Just a few comments from me :)

src/ApiIncrementalChecker.ts Show resolved Hide resolved
src/ApiIncrementalChecker.ts Outdated Show resolved Hide resolved
src/FilesRegister.ts Outdated Show resolved Hide resolved
src/IncrementalChecker.ts Outdated Show resolved Hide resolved
src/makeEslinter.ts Outdated Show resolved Hide resolved
src/makeEslinter.ts Outdated Show resolved Hide resolved
@johnnyreilly
Copy link
Member Author

Thanks for the review @piotr-oles - I've made changes 😄

Copy link
Contributor

@phryneas phryneas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So apparently my comments from yesterday were held back by me not "finishing" my review (argh).

So here's what I had written yesterday, I'll come check around in the next few days with a more thorough review.

.gitignore Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
src/IncrementalChecker.ts Show resolved Hide resolved
src/service.ts Outdated Show resolved Hide resolved
@johnnyreilly
Copy link
Member Author

johnnyreilly commented Jul 9, 2019

Thanks for the review @phryneas - I've made changes in line with your suggestions

piotr-oles
piotr-oles previously approved these changes Jul 9, 2019
@johnnyreilly
Copy link
Member Author

johnnyreilly commented Jul 10, 2019

I've just fixed up the merge conflict; so I think this means I technically need another approval 😄

@johnnyreilly
Copy link
Member Author

Hey @piotr-oles / @phryneas,

Are either of you good to approve this PR? I'd like to ship and make sure our release infrastructure is still good now we've moved

Copy link
Collaborator

@piotr-oles piotr-oles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just did another round as there are a lot of changes :)

package.json Show resolved Hide resolved
src/ApiIncrementalChecker.ts Outdated Show resolved Hide resolved
test/integration/incrementalApi.spec.ts Outdated Show resolved Hide resolved
test/fixtures/project_eslint/src/lib/func.ts Show resolved Hide resolved
@johnnyreilly
Copy link
Member Author

I've addressed the review comments!

@piotr-oles
Copy link
Collaborator

What about CancellationToken? :)

@johnnyreilly
Copy link
Member Author

I replied!

@johnnyreilly
Copy link
Member Author

Fixed!

Copy link
Collaborator

@piotr-oles piotr-oles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@johnnyreilly johnnyreilly merged commit 544f205 into TypeStrong:master Jul 12, 2019
@johnnyreilly
Copy link
Member Author

Okay - merged.... Let's see if we get a new version published!

@piotr-oles
Copy link
Collaborator

🎉 This PR is included in version 1.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@johnnyreilly
Copy link
Member Author

Amazing!

@johnnyreilly
Copy link
Member Author

See how to use this here: https://blog.johnnyreilly.com/2019/07/typescript-and-eslint-meet-fork-ts-checker-webpack-plugin.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants