Comments (31)
It works like a charm for me (VS Code 1.7.2, Win10). Using in .vue files, as easy as adding .vue extension to eslint.validate (had eslint-plugin-html installed previously):
"eslint.validate": [
"javascript",
"javascriptreact",
"html",
"vue"
]
Thank you @dbaeumer ! 😄
from vscode-eslint.
Would love to have this in .vue files
from vscode-eslint.
OK. This was quite some work and basically required to change a lot of things in the LSP as well as the implementation of the ESLint extension. So I would like to find volunteers to test this before I publish this in the market place.
Attached a zip that can be installed using vscode command line installer. For example to install the version in VS Code stable download the attached file and rename it to vscode-eslint-1.2.0.vsix
(it is currently named zip since github doesn't handle vsix files) and run from a terminal:
code-insiders --install-extension ./vscode-eslint-1.2.0.vsix
to install it in VS Code stable use
code --install-extension ./vscode-eslint-1.2.0.vsix
To control the file types to be validated use the new settings eslint.validate
. For example to validate JS and HTML use the following value:
"eslint.validate": [
"javascript", "javascriptreact", "html"
]
Please note that you need to configure ESLint accordingly as well to make this work. The extension will not automatically install eslint plugins. So you need to have a
"plugins": [
"html"
]
section in the ESLint configuration file and need to install eslint-plugin-html
as well.
from vscode-eslint.
@codeofsumit Hi,
"eslint.validate": [
"javascript",
"javascriptreact",
{ "language": "vue", "autoFix": true },
{ "language": "html", "autoFix": true }
]
refered here #185
from vscode-eslint.
Solved! My settings.json was incorrect. Updated to be like this now:
// Place your settings in this file to overwrite the default settings
{
"[javascript]": {
"editor.tabSize": 2,
"editor.insertSpaces": true
},
"[vue]": {
"editor.tabSize": 2,
"editor.insertSpaces": true
},
"eslint.options": {
"extensions": [".html", ".js", ".vue", ".jsx"]
},
"eslint.validate": [
{
"language": "html",
"autoFix": true
},
{
"language": "vue",
"autoFix": true
},
{
"language": "javascript",
"autoFix": true
},
{
"language": "javascriptreact",
"autoFix": true
}
]
}
Works beautifully!
from vscode-eslint.
+1. I would like to use this extension with typescript .ts
files now that there is a typescript eslint parser.
from vscode-eslint.
Tested on VSC 1.7.2 OSX Sierra, works on .vue files 👍
from vscode-eslint.
@molant it should work with the latest version, however you need to configure this. Please see: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
from vscode-eslint.
Same issue here, anyone will help?
vuejs/vetur#115
from vscode-eslint.
Linting for vue started working for me with setup from the comment above: #42 (comment)
Thanks, @prograhammer.
from vscode-eslint.
webcomponents like vue, riot, or polymer, their comp files all includes javascript. FYI.
from vscode-eslint.
I've created a PR that addresses the .ts
and .tsx
issue, if the approach I provided gets approved, I'll update the PR to support .html
too (in the same way). Are there any other formats that are missing?
from vscode-eslint.
One additional note: due to BenoitZugmeyer/eslint-plugin-html#38 auto fix is not available for files other than JS.
from vscode-eslint.
Actually dups #21.
from vscode-eslint.
Gave it a spin on VSC 1.7.2, OSX Sierra, works like a charm!
from vscode-eslint.
I tested here on VSC 1.7.2, Linux Debian 64 bits, works perfectly!!! Thanks a lot!!! Great job!!!
from vscode-eslint.
Tested on VSC 1.7.2, Windows 7 64 bit, works on .html files. When can we expect an official plugin update?
from vscode-eslint.
Having issues with the no-console
rule though, it always highlights the everything before the line that contains the error (this in is a .vue
file)
from vscode-eslint.
@sz332 in the next days.
@sebastiandedeyne what errors do you get when executing this n the terminal. The ESLint extension simply takes the error range it receives from ESLint and the corresponding plugin.
from vscode-eslint.
Running eslint:
13:9 error Unexpected console statement no-console
In the editor:
from vscode-eslint.
Tested on VSC 1.7.2 OSX Sierra, with the graphql plugin and it worked well. Only requirement was that a language service for graphql needed to be installed so that the language id could be picked up.
from vscode-eslint.
@sebastiandedeyne That might be a bug in vscode
.
from vscode-eslint.
@sebastiandedeyne very strange. Do you have a project / sample you can share. Helps understanding what is going wrong
@sz332 release eslint 1.2.1 today.
from vscode-eslint.
For those that helped me testing please uninstall and reinstall the eslint plugin since the plugin will not update itlsef anymore if directly installed from a vsix. For the details see microsoft/vscode#17290.
I apologize for the inconvenience this causes.
from vscode-eslint.
@dbaeumer testing on Windows 10 with insider 1.11 and TypeScript and seems to be working fine. What else is needed to have this in the official release?
from vscode-eslint.
@molant nothing. I simply forgot to close the issue.
from vscode-eslint.
It wasn't working with the latest version of the plugin and that's how I end up in this issue. Is it going to be available in the next one or is there something broken with my current configuration?
Thanks!
from vscode-eslint.
ESlint autofix doesn't seem to work for me.
from vscode-eslint.
Hey guys,
With the latest version of VS Code, I'm still not able to lint Vue files. If you pull down this simple example here: https://github.com/prograhammer/hello
Then npm install
and you'll see linting works perfectly for .js but not for .vue. For example, add some extra spaces after a brace {
in doc.js
. Works perfectly. Now try the same in app.vue
. No error.
Here's my settings.json:
// Place your settings in this file to overwrite the default settings
{
"[javascript]": {
"editor.tabSize": 2,
"editor.insertSpaces": true,
"eslint.options": {
"extensions": [".html", ".js", ".vue", ".jsx"]
},
"eslint.validate": [
{
"language": "html",
"autoFix": true
},
{
"language": "vue",
"autoFix": true
},
{
"language": "javascript",
"autoFix": true
},
{
"language": "javascriptreact",
"autoFix": true
}
]
}
}
from vscode-eslint.
I'm still experiencing this problem. Is any official solution?
from vscode-eslint.
Please note that eslint.validate
accept all types in vscode, including "typescript"
and "typescriptreact"
You can add settings below to support typescript-eslint-parser
"eslint.validate": [
"javascript",
"javascriptreact",
"html",
"typescript",
"typescriptreact"
]
from vscode-eslint.
Related Issues (20)
- Error when clicking on file tab in VS Code Editor HOT 1
- VS Code eslint using outdated error for non-existent rule configuration HOT 1
- Consistent creation of zombie processes by vscode-eslint extension
- vscode-eslint extension not working on latest version of VSCode, v1.90.0 HOT 18
- Is it possible to pass parameters to the format? HOT 1
- Files are not analized when opened HOT 2
- When the user provides eslint.options, remove the requirement for a eslint.config.js file HOT 1
- "eslint.options.fixTypes" Not Working in "Format Document with: ESLint"
- No ESLint configuration (e.g .eslintrc) found for file
- `eslint.packageManager` deprecated but error message says to use it
- How Can I Display All ESLint Errors and Warnings for All Files in VSCode? HOT 1
- "eslint.onIgnoredFiles" seems not working on v3.0.10
- Issues with Rules and Prettier Integration in Versions 3.0.10 and 3.0.8 HOT 6
- Bug: In VSCode, when an incorrect config breaks the ESLint server, the "Restart ESLint Server" command does not work
- After upgrade to version 3.x, json files are broken HOT 19
- 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
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.