-
Notifications
You must be signed in to change notification settings - Fork 708
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 support for ESLint v2 #107
Conversation
Hopefully the npm package stuff is okay, I kept getting strange permission errors like this when running
It resolved itself if I ran the command again. I think it's just npm being glitchy and not an actual issue. (I've seen the same thing on Linux and on Windows so I don't think it's an OS-specific issue) |
@@ -0,0 +1,23 @@ | |||
import {defineRule, runRule} from '../../utils/eslintUtils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with this is that the transitive dependencies, babel-eslint
and babel-core
are now loaded on every page load, not only when someone uses the eslint transform.
You could simply load the utils dynamically as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good catch! I thought Webpack would automatically make a new bundle for every transformers/*/index.js
but maybe it doesn't work that way. How does the code splitting work? It is simply the require([..], cb)
that does it? I've never used that feature of Webpack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, the require([..], cb)
does the magic :)
Thank you so much for doing this! |
Updated the diff to also dynamically require |
I copied how Babel 6 is handled - Created "modules" under
packages
which export the correct version of ESLint. Moved shared code into aeslintUtils
file.Pretty much all the transform logic is identical across ESLint 1 and 2. I kept the transformers themselves (
eslint1/index.js
andeslint2/index.js
) separate rather than totally sharing them (eg. acreateESlintTransformer
factory method) so that it's easier for them to deviate if needed.