Skip to content
This repository has been archived by the owner. It is now read-only.

Incorrect eslintPkgPath: .../api.js/package.json #282

Closed
rdhelms opened this issue Jul 3, 2019 · 7 comments · Fixed by #283
Closed

Incorrect eslintPkgPath: .../api.js/package.json #282

rdhelms opened this issue Jul 3, 2019 · 7 comments · Fixed by #283
Labels

Comments

@rdhelms
Copy link

@rdhelms rdhelms commented Jul 3, 2019

  • Operating System: Mac OS
  • Node Version: 10.15.1
  • NPM Version: 6.4.1
  • webpack Version: 4.28.4
  • eslint-loader Version: 2.2.0

Expected Behavior

Expecting regular Vue builds to succeed.

Actual Behavior

See vuejs/vue-cli#4231

Vue builds are failing due to an eslint-loader error.

Code

This addition seems to result in eslintPkgPath sometimes adding /package.json to the path in situations where it should not:

  var eslintPkgPath = "eslint/package.json";
  if (userEslintPath) {
    eslintPkgPath = userEslintPath + "/package.json";
  }

  var eslintVersion = require(eslintPkgPath).version;

How Do We Reproduce?

See vuejs/vue-cli#4231

@alexander-akait
Copy link
Member

@alexander-akait alexander-akait commented Jul 3, 2019

PR welcome

@genez

This comment was marked as off-topic.

@rdhelms
Copy link
Author

@rdhelms rdhelms commented Jul 3, 2019

There are some discussed workarounds in vuejs/vue-cli#4231:
vuejs/vue-cli#4231 (comment)

There is also a proposed fix for vue-cli to use the directory rather than the file path:
vuejs/vue-cli#4233

That PR should fix this issue for vue-cli cases, although I'm not sure if there are other instances where people may have been passing file paths to this module that would now be breaking.

@ricardogobbosouza ricardogobbosouza mentioned this issue Jul 3, 2019
6 tasks
@vision-qiu
Copy link

@vision-qiu vision-qiu commented Jul 3, 2019

I have this problem too.
And just comment like this then it work😄

  var eslintPkgPath = "eslint/package.json";
  //if (userEslintPath) {
  //  eslintPkgPath = userEslintPath + "/package.json";
  //}

  var eslintVersion = require(eslintPkgPath).version;

@alexander-akait
Copy link
Member

@alexander-akait alexander-akait commented Jul 3, 2019

Somebody can test #283?

@KnowledgeGarden
Copy link

@KnowledgeGarden KnowledgeGarden commented Jul 4, 2019

I liked that patch. I just went in and replaced the require with '5.6.0' and it works fine, but that's not a fix. Perhaps that patch will get us back on the road.

@alexander-akait
Copy link
Member

@alexander-akait alexander-akait commented Jul 4, 2019

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

Successfully merging a pull request may close this issue.

5 participants