Comments (5)
Currently, I set up project-specific settings override as a workaround for this issue:
{
"folders":
[
{
"path": "."
}
],
"settings": {
"ESLint-Formatter": {
"eslint_path": {
"osx": "/Users/aleks/project/node_modules/.bin/eslint"
}
}
}
}
from eslint-formatter.
@ramiel, how should this be handled?
from eslint-formatter.
I'll look at this tomorrow. We should stop at the project root instead of the first package.json probably.
from eslint-formatter.
The problem can be a bit complex. At the moment we go up, starting from the current directory, and we stop at the first package.json we find. Then we suppose that is the point were eslint is installed. Setup like the one from @hudochenkov show that this is not always the case. We have so two possibilities.
- Look if the package.json reference eslint among its dependencies
- Look if a .eslint.* file is present
The latter is not affordable because eslint allow to have more than one file and do not enforce you to put "root": true
in the top one.
Reading the content of the package.json file instead is heavy, considering that the plugin has no cache system and that this operation is performed everytime a file if linted (easily at every save).
It looks to me that using a per-project configuration for cases like this is the most viable solution.
@TheSavior have you any other idea?
from eslint-formatter.
Another idea is to look for the first path where is present node_modules/eslint
. This rely on the structure of the node_modules folder itself, which should be reliable until npm change it again or another fancy package manager is used. But it's fast. I'll propose a PR and we continue to discuss there
from eslint-formatter.
Related Issues (20)
- Programmatically find Node and ESLint directory HOT 2
- Default eslint_path for Windows 10 Pro 64bit on Sublime Text 3 does not seem to work when there is a "whitespace" (aka a "space") inside profile user name. HOT 2
- Feature request - Exclude folders from formatting
- Files with starting dot in the name are ignored
- Support package.json eslintConfig
- Vue SFC doesn't format missing commas HOT 1
- reload on fix HOT 1
- Jumps to top of file randomly HOT 1
- eslint command-line options support HOT 2
- How to set NODE_ENV or BABEL_ENV in formatter config
- Global name 'data' is not defined HOT 5
- Error panel popping on save HOT 4
- Vue SFC Error HOT 1
- Performance HOT 4
- How to selectively run Eslint-Formatter ("On save" mode) on particular files HOT 1
- Babel 7 upgrade HOT 1
- Slow performance creating new file?
- `eslint_d` instance per Sublime Window causing performance issues
- spawn node ENOENT HOT 1
- Error: Failed to load plugin 'import'
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 eslint-formatter.