Uh oh!
There was an error while loading. Please reload this page.
Explicitly specify ESLint config path for editor plugins in package.json - #149
Conversation
mxstbr
commented
Jul 24, 2016
Awesome! 👍 |
| // explicitly specify ESLint config path for editor plugins | ||
| hostPackage.eslintConfig = { | ||
| extends: "./config/eslint.js", |
There was a problem hiding this comment.
I might be totally wrong, but is it safe to use / since it's possible to be \ on windows? I think path.resolve works cross platform.
There was a problem hiding this comment.
Thanks @eanplatter, I didn't notice that!
However, path.resolve produces an absolute path which is probably not what we want here (what if the user moves or renames the project folder?).
How about changing it to path.normalize('./') + path.normalize('config/eslint.js')? The first ./ (.\\ on windows) is required since Atom doesn't work without it.
There was a problem hiding this comment.
@insin could you help to confirm if this is an issue on windows? Thanks!
There was a problem hiding this comment.
I actually think it won't be, Node fs functions treat / in platform independent way. I wrote some unnecessary path.joins in the code before I learned this.
There was a problem hiding this comment.
Yeah, / is fine in Node.js as an input path like this.
You only get problems if you're doing path stuff manually with / and you might have a path which has been made "native" by converting it to absolute or relative with path (which is why checking an absolute path with a RegExp can be a gotcha - 🎵 Gotta [\\/] 'Em All, Pathémon 🎵)
There was a problem hiding this comment.
Awesome, thanks for clearing that up for me!
kevinastone
commented
Jul 24, 2016
Sublime Text works as well with the |
gaearon
commented
Jul 24, 2016
Let’s remove unnecessary |
keyz
commented
Jul 24, 2016
@gaearon haha i was just about to reply to you -- it doesn't work without |
gaearon
commented
Jul 24, 2016
Oh okay then. |
gaearon
commented
Jul 24, 2016
Thanks. |
mareksuscak
commented
Jul 25, 2016
FYI: I know this has already been merged but it only works when you install eslint and all the plugins globally. AFAIK it's a good rule of thumb to install all the dependencies locally per project. |
weisjohn
commented
Jul 27, 2016
I'm trying to use this, and even when installing globally as @mareksuscak mentioned, I get an error in Atom: |
weisjohn
commented
Jul 27, 2016
If I symlink then all is well. |
@mareksuscak sorry just saw this. Edit: sorry you're right! Please track #247. |
gaearon
commented
Jul 27, 2016
@weisjohn Are you using npm 3? The fix would only work with it. |
weisjohn
commented
Jul 28, 2016
|
added migration steps to v2.5.0
Fixes#124. Notice that we need to change the path in
package.jsonwhile ejecting since the config folder gets moved.Tested with Atom (Nuclide) and Visual Studio Code and it works both before and after ejection.
I'm not sure about Sublime Text -- seems likeSublimeLinter-eslintonly recognizes.eslintrcconfig. However, it could be fixed by configuring the linter plugin itself. Or even better, could someone who uses Sublime Text send a PR to let it recognize theeslintConfigfield inpackage.json? :)Edit: @kevinastone confirmed that Sublime Text works fine too.