Vscode-eslint: Infer `eslint.validate` from plugins configuration.

Created on 6 Mar 2019  路  10Comments  路  Source: microsoft/vscode-eslint

demo repo:
https://github.com/clock157/bug-vscode-eslint-typescript

run command can found error but not report in vscode.

set setting.json not work too.

+"eslint.options": {
+        "extensions": [".ts", ".tsx"]
+},
feature-request

Most helpful comment

The same. My config:

{
    "eslint.autoFixOnSave": true,
    "eslint.validate": [ 
        "javascript", 
        "javascriptreact", 
        { "language": "typescript", "autoFix": true },
        { "language": "typescriptreact", "autoFix": true } 
    ],
    "eslint.options": {
        "extensinons": [".ts", ".js", ".tsx", ".jsx"]
    },
}

All 10 comments

The same. My config:

{
    "eslint.autoFixOnSave": true,
    "eslint.validate": [ 
        "javascript", 
        "javascriptreact", 
        { "language": "typescript", "autoFix": true },
        { "language": "typescriptreact", "autoFix": true } 
    ],
    "eslint.options": {
        "extensinons": [".ts", ".js", ".tsx", ".jsx"]
    },
}

Strange. This works for me using the repository from https://github.com/Microsoft/vscode-eslint/issues/642#issue-417763561 and adding the following setting.

{
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        { "language": "typescript", "autoFix": true }
    ]
}

capture

Any additional information how to reproduce what you are seeing.

vscode verison: 1.30.2 (1.30.2)

Eslint extension info:

Name: ESLint
Id: dbaeumer.vscode-eslint
Description: Integrates ESLint JavaScript into VS Code.
Version: 1.8.1
Publisher: Dirk Baeumer
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint

.eslintrc

{
    "parser": "@typescript-eslint/parser",
    "plugins": ["@typescript-eslint"],
    "rules": {
        "@typescript-eslint/no-unused-vars": "error"
    }
}

Work!!! After update to latest vscode

@Sujimoshi this was a problem on my end not treating versions correctly. I fixed this and releases 1.8.2 which now prereqs the right VS Code version. Sorry for that.

@clock157 any additional information. Are you still seeing this ?

hi @dbaeumer, thanks for your help, It works.

+"eslint.validate": [
+    { "language": "typescript" }
+]

can you set this option to default that tslint will deprecated?

The problem here is that eslint (the npm module) out of the box only validates JS files. Everything else comes in as a configuration. What I can look into is whether I am able to infer this from the plugins section.

Any progress? I still need to config eslint.validate to make typescript eslint work. But in the doc

Improved TypeScript detection - As soon as TypeScript is correctly configured inside ESLint, you no longer need additional configuration through VS Code's eslint.validate setting. The same is true for HTML and Vue.js files.

Actually that got fix for 2.x version of ESLint. TypeScript should work out of the box without providing an eslint.validate setting.

@LeoEatle does the validation happen correctly when you use eslint in the terminal. If this is the case can you please provide me with a GitHub repository I can clone that demos what you are experiencing.

Was this page helpful?
0 / 5 - 0 ratings