-
Notifications
You must be signed in to change notification settings - Fork 341
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
How to lint all files in project? #91
Comments
Currently not. However we were thinking about adding that support. |
Is the challenge reducing the overhead in constantly linting all files in the solution? We can always run eslint from the command line but of course it would be ideal if all files were automatically linted as we work through a solution. |
Would be nice for Python too. For example if I change the name of a module, nothing re-lints, etc until some code is changed and a file is re-saved. |
I need this badly (I come from standard and the plugin for vscode does this by default) |
Willing to help if someone can give direction on where to even start. |
I understand that linting the whole project all the time could damage the performance. A dedicated action that could be run on demand would still be great. |
Here is an example for how to do this for eslint using Tasks /~https://github.com/Microsoft/vscode-eslint/blob/master/eslint/README.md#using-the-extension-with-vs-codes-task-running |
the link is broken... can you please check? |
This answer here on Stack Overflow might also be helpful: https://stackoverflow.com/q/41702815/37147. |
Just to verify, the proposed "task" solution is it from vscode client side (an ability to run tasks in vscode editor)? |
I created PR #323 for prviding a new project level diagnostics mode. |
I'm using a custom task to extract the eslint errors/warnings but the default $eslint-stylish problemMatcher doesn't add the "eslint" owner to the problems, so the [eslint] prefix is only added after I open a file, and when I close it the eslint problems are removed. I understand that the errors are currently being cleared on close (#306) but is there a current workaround to both situations? EDIT: I just checked and it's using the eslint owner but for some reason all messages are missing the prefix. |
This is a bug on the VS Code side we are aware of. |
Hi guys. Any plans on making this available? Is it in the roadmap? |
I started to work on this last week but nothing finished yet. The branch is /~https://github.com/Microsoft/vscode/tree/dbaeumer/47386 |
Hi, is there any progress on this issue? Thanks in advance!! |
No, nothing has happened. The original bug in VS Code microsoft/vscode#47386 got fixed for TS but ESLint doesn't profit from this. I gave feedback on the PR however I am not sure if this should really be built into the extension or better be handled as a task. |
shouldn't it be on a different issue than microsoft/vscode#47386? |
Any news on this? |
Do you have a GitHub repository I can clone? |
Here ya go /~https://github.com/baconcheese113/god-help-me-lint |
Can you please provide additional steps to reproduce the problem. If I try to lint the client in the terminal
|
@dbaeumer Sorry, didn't try to run it through the terminal since I could already tell eslint was working on some files (but not the exhaustive-deps rule).... I think my issue is actually due to this #814 (comment) Currently I use eslint-plugin-react-hooks@2.3.0 at work and wasn't aware of the big change between it and 2.5.1 which prevents auto-fixing of the rule I was hoping for. Do you know any ways to enable auto fixing for suggestions? |
Suggestions by definition can't be autofix. But they will show up as a possible fix in the code action menu (when you click on the light bulb). Requires the latest version of the ESLint extension. |
So @dbaeumer to get the original discussion back on track - what are your thoughts on a full-project-lint going forward? Do you think the caching feature would work/help? |
@mika76 from the experiments I did I got the impression that they caching feature will not help a lot since you still need to validate all files in the project. I still think that a task triggered by a user is currently the right approach for this. |
|
Does this mean we're not likely to see this automatic whole workspace linting anytime soon? I was trying to migrate from tslint to eslint because I was getting warnings about it being deprecated, but just noticed I'm not seeing the errors anymore without files open. With tslint, I did get this (I'm not sure exactly through what mechanism - it might be that webpack is running onFolderOpen in watch mode and using |
To my knowledge the TSLint extension only validated the open files as well (@egamma can you confirm that). So if the whole workspace got linited it was very likley through a task which is also support in ESLint. |
I do have tasks that run on |
wow this was open 4 years ago and is not resolved O.o |
@daiky00 have you use the setting |
npx tsc --noEmit |
I want to lint all files of the project when opening the project folder, and then show errors on opened files. Is this possible using APIs provided? |
WorkaroundSince this is maybe low priority for the team for now, here is a possible workaround. While we cannot directly "add all problems in project to the
I ended up adding the 3 following "eslint": "npx eslint **/src/**/*.js",
"eslint:files": "npx eslint **/src/**/*.js | grep ^[\\w/].*\\.js",
"eslint:files:open": "code $(npx eslint **/src/**/*.js | grep ^[\\w/].*\\.js)" Hope that helps :) Update for WindowsSince FunctionDJ asked below - here are some (of many) choices as how to run this on Windows:
|
This code works if you don't want to repeat the same command three times.
|
This sounds great. How can i change it to run on Windows? (grep not available) |
My current solution: Tasks and problem matchers! {
"label": "lint all",
"script": "lint:all",
"problemMatcher": ["$eslint-stylish"]
}
|
@ooyyloo |
with auto fix:
|
@mudroljub that's unrelated to the VSCode extension. the extension is there so that errors get shown in the editor itself, not just the console. |
Workaround for Vue CLI {
"type": "npm",
"label": "lint",
"script": "lint",
"problemMatcher": [
{
"owner": "eslint",
"fileLocation": [
"relative",
"${workspaceFolder}"
],
"pattern": {
"regexp": "^(.+):\\s(.+)\\((.+)\\)\\sat\\s(.+):(\\d+):(\\d+):$",
"severity": 1,
"message": 2,
"code": 3,
"file": 4,
"line": 5,
"column": 6
}
}
],
"options": {
"cwd": "${workspaceFolder}"
},
}, |
Currently it is supported to do this using
You can substitute Got reference from this github issue. |
@soonsam123 that's not the same. |
This is my {
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"label": "lint",
"script": "lint",
"problemMatcher": [
{
"owner": "eslint",
"fileLocation": ["relative", "${workspaceFolder}"],
"pattern": [
{
"regexp": "\\.\\/(.+)",
"kind": "location",
"file": 1
},
{
"regexp": "^([0-9]+):([0-9]+) (.+?): (.+?)( (\\S+))?$",
"severity": 3,
"message": 4,
"code": 6,
"line": 1,
"column": 9
}
]
}
],
"options": {
"cwd": "${workspaceFolder}"
}
}
]
} |
I noticed ESLint only shows errors of files you've opened. Is there a way to force it to scan all files in the project?
The text was updated successfully, but these errors were encountered: