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

Error when using ESLint Airbnb config #3799

Closed
joshas opened this issue Apr 13, 2019 · 9 comments
Closed

Error when using ESLint Airbnb config #3799

joshas opened this issue Apr 13, 2019 · 9 comments

Comments

@joshas
Copy link

joshas commented Apr 13, 2019

Version

3.5.5

Environment info

Environment Info:

  System:
    OS: Windows 7
    CPU: (4) x64 Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz
  Binaries:
    Node: 11.14.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.7.0 - C:\Program Files\nodejs\npm.CMD
  npmGlobalPackages:
    @vue/cli: Not Found
  

Steps to reproduce

  1. Run in command line: vue create vue-test
  2. Manually select features
  3. Make sure "Linter / Formatter" is selected
  4. Pick "ESLint Airbnb config"
  5. "Lint on save"
  6. Select to place config "In dedicated config files"
  7. Do not save preset for future use

What is expected?

Project will be created without errors.

What is actually happening?

 ERROR  TypeError: (0 , _ignore.getFileExtensions) is not a function
Occurred while linting d:\temp\vue-test\src\App.vue:9
TypeError: (0 , _ignore.getFileExtensions) is not a function
Occurred while linting d:\temp\vue-test\src\App.vue:9
    at checkSourceValue (d:\temp\vue-test\node_modules\eslint-plugin-import\lib\
rules\no-useless-path-segments.js:103:60)
    at checkSourceValue (d:\temp\vue-test\node_modules\eslint-module-utils\modul
eVisitor.js:29:5)
    at checkSource (d:\temp\vue-test\node_modules\eslint-module-utils\moduleVisi
tor.js:34:5)
    at listeners.(anonymous function).forEach.listener (d:\temp\vue-test\node_mo
dules\eslint\lib\util\safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (d:\temp\vue-test\node_modules\eslint\lib\util\safe-emitter.j
s:45:38)
    at NodeEventGenerator.applySelector (d:\temp\vue-test\node_modules\eslint\li
b\util\node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (d:\temp\vue-test\node_modules\eslint\l
ib\util\node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (d:\temp\vue-test\node_modules\eslint\lib\ut
il\node-event-generator.js:294:14)
    at CodePathAnalyzer.enterNode (d:\temp\vue-test\node_modules\eslint\lib\code
-path-analysis\code-path-analyzer.js:632:23)

Using "ESLint with error prevention only" or "ESLint Standard config" works correctly without errors. Earlier vue-cli versions did not have this problem, but I didn't have time to find exact version where this issue started.

@deanpienaar
Copy link

Same on version 3.4.1

@gitpash
Copy link

gitpash commented Apr 13, 2019

same with macos, setup eslint for the react-project with ./node_modules/.bin/eslint --init
TypeError: (0 , _ignore.getFileExtensions) is not a function Occurred while linting /Users/user/Dev/FrontEnd-Dev-projects_fcc/Advanced_Front-End/react-toe/src/app.js:3 at checkSourceValue (/Users/user/Dev/FrontEnd-Dev-projects_fcc/Advanced_Front-End/react-toe/node_modules/eslint-plugin-import/lib/rules/no-useless-path-segments.js:103:60) at checkSourceValue (/Users/user/Dev/FrontEnd-Dev-projects_fcc/Advanced_Front-End/react-toe/node_modules/eslint-module-utils/moduleVisitor.js:29:5) at checkSource (/Users/user/Dev/FrontEnd-Dev-projects_fcc/Advanced_Front-End/react-toe/node_modules/eslint-module-utils/moduleVisitor.js:34:5) at listeners.(anonymous function).forEach.listener (/Users/user/Dev/FrontEnd-Dev-projects_fcc/Advanced_Front-End/react-toe/node_modules/eslint/lib/util/safe-emitter.js:45:58) at Array.forEach (<anonymous>) at Object.emit (/Users/user/Dev/FrontEnd-Dev-projects_fcc/Advanced_Front-End/react-toe/node_modules/eslint/lib/util/safe-emitter.js:45:38) at NodeEventGenerator.applySelector (/Users/user/Dev/FrontEnd-Dev-projects_fcc/Advanced_Front-End/react-toe/node_modules/eslint/lib/util/node-event-generator.js:251:26) at NodeEventGenerator.applySelectors (/Users/user/Dev/FrontEnd-Dev-projects_fcc/Advanced_Front-End/react-toe/node_modules/eslint/lib/util/node-event-generator.js:280:22) at NodeEventGenerator.enterNode (/Users/user/Dev/FrontEnd-Dev-projects_fcc/Advanced_Front-End/react-toe/node_modules/eslint/lib/util/node-event-generator.js:294:14) at CodePathAnalyzer.enterNode (/Users/user/Dev/FrontEnd-Dev-projects_fcc/Advanced_Front-End/react-toe/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:632:23)

@LinusBorg
Copy link
Member

LinusBorg commented Apr 13, 2019

Seems to be an upstream issue in eslint-plugin-import, see import-js/eslint-plugin-import#1322

I assume a viable workaround would be to disable this plugin's rule that throws this error for the time being, until the bug has been fixed upstream:

// .eslintrc.js
module.exports = {
  // ...stuff...
  rules: {
+    "import/no-useless-path-segments": "off",
    "no-console": process.env.NODE_ENV === "production" ? "error" : "off",
    "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
  },
  // ..stuff....
};

Maybe the bug affects other rules as well - disable them accordingly.

@ghost
Copy link

ghost commented Apr 13, 2019

I have the same bug, but I'm using React rather than Vue.

I'm going to assume you're using eslint-plugin-import@2.17.0? This appears to be solely related to eslint-plugin-import rather than the Airbnb config, which is what I'm using. I did the following to fix the issue;

npm install eslint-plugin-import@2.16.0

EDIT1: I use the Airbnb config too, and downgrading fixed the problem for me.

@gitpash
Copy link

gitpash commented Apr 13, 2019

if anyone still curios, this helps me to get rid of this error, thanks @LinusBorg

 .eslintrc.js
module.exports = {
  rules: {
   "import/no-useless-path-segments": "off", 

@smorimoto
Copy link

This should be fixed in v2.17.1 according to
import-js/eslint-plugin-import#1322 (comment)

@LinusBorg
Copy link
Member

If someone affected can confirm that reinstalling dependencies (remove lock file!) solves the issue I can close this.

@joshas
Copy link
Author

joshas commented Apr 13, 2019

Updated to vue-cli 3.6.0 . Creating new project with ESLint Airbnb config completes without errors.

@joshas joshas closed this as completed Apr 13, 2019
@LinusBorg LinusBorg unpinned this issue Apr 13, 2019
@LinusBorg LinusBorg pinned this issue Apr 13, 2019
@rvvergara
Copy link

Seems to be an upstream issue in eslint-plugin-import, see benmosher/eslint-plugin-import#1322

I assume a viable workaround would be to disable this plugin's rule that throws this error for the time being, until the bug has been fixed upstream:

// .eslintrc.js
module.exports = {
  // ...stuff...
  rules: {
+    "import/no-useless-path-segments": "off",
    "no-console": process.env.NODE_ENV === "production" ? "error" : "off",
    "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
  },
  // ..stuff....
};

Maybe the bug affects other rules as well - disable them accordingly.

This solution worked for me! Thanks! :)

@sodatea sodatea unpinned this issue Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants