Comments (11)
@ChuckPierce vscode does pick up the local eslint. The problem is that it only looks in the root of the project, but not in the nearest folder like atom does. This means that if my JS project is a child of a larger non-js (or non-eslint) project, then vscode doesn't even run eslint.
from vscode-eslint.
This is addressed in the upcoming 1.1.0 release of ESLint.
from vscode-eslint.
+1. This is another painful problem which is stopping me from using vscode in any serious way. Atom flawlessly picks up the correct eslintrc file and the nearest eslint
package.
from vscode-eslint.
I tested that the plugin uses the nearest .eslintrc file. However it doesn't pick up the nearest eslint module. I need to think about what the consequences are. Currently we keep the one eslint checker active to avoid starting it over and over again. When we start to pick the nearest eslint module we would need to manage different eslint instances.
from vscode-eslint.
Hmm, yeah I hadn't thought of that yet... Although, in majority of the scenarios, a project would have one node_modules
folder. I've not done any formal research, just applying my experience.
I myself have 2 more eslint instances nested within my project, but they are symlinked to the project-root-level, and also I required them only because my project has some fancy stuff with eslint (custom node-module for linting, etc).
Also, maybe taking a look at how Atom does it would be helpful.
from vscode-eslint.
Using the local eslint and the eslint plugins will solve a lot of the issues that are currently open on this extension. (anything that has the "Can't find eslint-plugin-")
With most editors out there, the eslint (as well as all of the eslint plugins such as eslint-plugin-react
) is taken from the locally installed project. This allows for the users to use different eslint versions across different projects. Having to use a globally installed eslint or the locally installed eslint in the extension folder will limit the user to only one version of eslint (and its corresponding extensions).
Having the editor do this for you automatically is a big win and cuts down on unwanted error messages
from vscode-eslint.
@kumarharsh ahhh I see....hmm okay. I mean I suppose as long as I remember that it isn't too bad... The scenarios that you run into with this cases is basically any project that has a non-JS backend though. You just have to work in the folder that has the node_modules
at its root
from vscode-eslint.
Yes, that is correct. And anyways, my project has grown too big to require a separate editor window for the frontend part, that's the reason why I'm not complaining loudly ;P
from vscode-eslint.
@dbaeumer any ideas about a fix for this? its one of the major pain points for me with using VS Code. Definitely willing to help.
from vscode-eslint.
@ChuckPierce finding the eslint npm module is currently static based on the workspace folder you have open and is done when the linter starts. Loading the closet eslint module would require the following changes:
- don't look up the eslint npm module on initialize
- when ask to validate a file, take the files path and try to locate the eslint npm module using the resolveModule function form the server npm module
- cache the result since the lookup is expensive.
- use the resolved eslint module
- come up with an error story when the resolving fails (e.g. the eslint module can't be resolved). Currently this is easy since we resolve statically at startup.
from vscode-eslint.
The code to look at is here: https://github.com/Microsoft/vscode-eslint/blob/master/eslint-server/src/server.ts
from vscode-eslint.
Related Issues (20)
- Not work of "source.fixAll.eslint": "explicit" on v3.0.10 HOT 3
- Tslint takes hours to process HOT 1
- Document behavior and defaults of useFlatConfig across ESLint v8, v9, v10 HOT 2
- [Suggestion] Mark `warn` eslint level as vscode `DiagnosticSeverity.Information` `info` level HOT 3
- `eslint.execArgv` Configuration is Not Working HOT 3
- JSON schema for useFlatConfig can be more specific HOT 1
- Should plugins still have `eslint.experimental.useFlatConfig` in their settings? HOT 1
- Support custom clickable links in eslint error tooltips HOT 1
- The extension does not show any errors anymore HOT 3
- Enfore validate list
- Error output (in flat config) causes problems not to appear in the output channel HOT 2
- Add support for ESLint feature flags HOT 4
- Restarting an extension when that extension's output is selected in the "Output" pane should not change which extension is selected in the "Output" pane. HOT 3
- ESLint with SafeQL crashes on Windows with error code 3221226505 HOT 5
- About eslint config,When user setting and workspace setting are conflict,how to override user settings config HOT 1
- ESLint is preventing my files from being saved HOT 7
- eslint autofix for multiple empty lines don't work HOT 1
- ESLint server only looks at first entry in `context.only` array sent along with `textDocument/codeAction` HOT 4
- Supervied Idenification Verification Profile HOT 2
- Setup ESLint with Deno runtime instead of node HOT 2
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 vscode-eslint.