Skip to content
This repository has been archived by the owner on Sep 28, 2020. It is now read-only.

 respect userOptions.eslintPath #195

Merged
merged 1 commit into from
Feb 26, 2018
Merged

 respect userOptions.eslintPath #195

merged 1 commit into from
Feb 26, 2018

Conversation

lmnsg
Copy link
Contributor

@lmnsg lmnsg commented Aug 23, 2017

#user should not depend eslint/lib/formatters/stylish if he appoint an eslintPath.

@MoOx
Copy link
Contributor

MoOx commented Oct 11, 2017

Can you fix failing test please?

@lmnsg
Copy link
Contributor Author

lmnsg commented Oct 19, 2017

@MoOx I edited the test/eslint-path to fix some test check。but still has one test faild.
I don't know why..

@MoOx
Copy link
Contributor

MoOx commented Oct 24, 2017

It's related to a specific version of node/npm with webpack one. You need to check here https://travis-ci.org/MoOx/eslint-loader/builds/289800514

@MoOx
Copy link
Contributor

MoOx commented Oct 30, 2017

@lmnsg I think I fixed CI on master branch. Can you rebase your branch on master? Should help :)

@lmnsg
Copy link
Contributor Author

lmnsg commented Oct 30, 2017

@MoOx It's ok. 😆

t.true(
stats.hasErrors(),
!stats.hasErrors(),
"a file that does not contains error but mock eslint instance " +
"returned error"
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably update this comment then?

"a file that does not contains error but mock eslint instance " +
"returned error"
)
t.true(
(stats.compilation.errors[0].message + "").indexOf("Fake error") > -1
stats.compilation.errors.length === 0 || (stats.compilation.errors[0].message + "").indexOf("Fake error") > -1
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about this test now :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact, I do not understand this two test too much..😂
especially the last one.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, test/mock/eslint-mock.js is returning some fake errors. We first check that we have errors via webpack stats api, then we check that the error is indeed our "Fake error" defined in the eslint-mock.
So we should not have to change this tests, otherwise, that mean the mock is unused.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well, I see.
I will check my code again.

if them specify an eslintPath option, and it like a officer eslint folder. he dont have to install the eslint.
@lmnsg
Copy link
Contributor Author

lmnsg commented Nov 1, 2017

@MoOx I re-pushed my code, please review it again...

Copy link
Contributor

@MoOx MoOx left a comment

Choose a reason for hiding this comment

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

Awesome change! I would just like to get a proper comment in the README and I would merge and release!

@@ -159,7 +159,8 @@ module.exports = {

#### `eslintPath` (default: "eslint")

Path to `eslint` instance that will be used for linting.
Path to `eslint` instance that will be used for linting.
If the `eslintPath` is a folder like a official eslint, or specify a `formatter` option. now you dont have to install `eslint` .
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what you are trying to explain here. Can you help me to understand so we can put a better explanation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, when someone specify the eslintPath,often means he want use another version of eslint or the eslint under other node_modules.
so he doesn't want to install eslint again in current project/node_modules

@MoOx MoOx merged commit 3c1c296 into webpack-contrib:master Feb 26, 2018
@MoOx
Copy link
Contributor

MoOx commented Feb 26, 2018

Released in 2.0.0

@@ -150,13 +150,25 @@ module.exports = function(input, map) {
loaderUtils.getOptions(this)
)

var userEslintPath = userOptions.eslintPath
var formatter = require("eslint/lib/formatters/stylish")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this require("eslint/lib/formatters/stylish") redundant given the one in the try-catch below?

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

Successfully merging this pull request may close these issues.

3 participants