Comments (5)
@javier-garcia-meteologica thank you very much, I was struggling to figure out why coc-eslint was using my system eslint (v7.3.0, currently broken with import/no-cycle) instead of the local one (v7.2, works fine), and adding "eslint.nodePath": "./node_modules",
did the trick ❤️
from coc-eslint.
Sorry to kick in like this, but the proposed fix for this issue is the cause of the issue #77.
With all due respect, I'm not sure to understand the issue (and the commit supposed to fix it).
The variable directory will resolve to /home/user/project. The function call resolveModule('./eslint', '/home/user/project', undefined) will try to read the non-existing directory '/home/user/project/eslint', which will fail.
This is absolutely true, but then the .catch
will be invoked, and resolveModule('eslint', directory, nodePath)
should be used as a fallback. This fallback will be in charge of resolving the local or global eslint module to use.
I tried to reproduce the issue you are facing. But with the initial condition you are mentioning (empty configuration, local setup of eslint in /project/node_modules/eslint), coc-eslint
(before the proposed fix) is successfully resolving to the local eslint install (as shown in :CocInfo
). Did I miss something?
from coc-eslint.
If I use the code
promise = resolveModule('./eslint', directory, nodePath).catch(() => {
return resolveModule('eslint', directory, nodePath)
})
Then it resolves to /home/user/.config/yarn/global/node_modules/eslint/lib/api.js
instead of <project>/node_modules/eslint
from coc-eslint.
Thanks, I understand the issue now! I'll think of something.
from coc-eslint.
I noticed that reversing the priority order makes module resolution work as expected . It picks up <project>/node_modules/eslint
first.
promise = resolveModule('eslint', directory, nodePath).catch(() => {
return resolveModule('./eslint', directory, nodePath)
})
@BenoitZugmeyer, could this fix #77?
from coc-eslint.
Related Issues (20)
- Eslint 8 support HOT 1
- Coc-eslint doesn't work with eslint@8 HOT 10
- undeprecate `eslint.enable`
- coc-eslint does not detect eslintrc unless it is placed in the root folder HOT 4
- Connection to server got closed. Server will not be restarted. HOT 1
- Usage with XO
- Is there any configuration for easily opening a recommendation link? HOT 1
- The "initializing eslint" notification never disappears HOT 2
- [bug] Diagnostic level hard-coded to Unnecessary/Warning/1 for no-unused-vars rule HOT 3
- UnhandledRejection opening markdown files HOT 22
- Stuck as "Initializing eslint" popup
- ESLint 8 flat config support HOT 3
- Parsing error: ESLint was configured to run on .... However that TSConfig does not include this file HOT 1
- how does eslint work
- shoudFix parameter was false HOT 4
- Need some clarification
- Coc-eslint not working with yarn Plug'n'Play HOT 2
- Setting `useFlatConfig` to true breaks ESLint integration for projects that use the older config style HOT 1
- when autoFixOnSave fails, the file can't be saved HOT 2
- is coc-eslint still maintained? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coc-eslint.