microsoft / TypeScript-Babel-Starter

A sample setup using Babel CLI to build TypeScript code, and using TypeScript for type-checking.
MIT License
2k stars 229 forks source link

Supporting eslint #31

Closed chetnashah closed 5 years ago

chetnashah commented 5 years ago

ESLint would expect ESTree compliant input to accurately report ESLint errors. so parser used is typescript-eslint-parser.

The eslint command works fine but VSCode stops showing ESLint errors with following config:

{
    "extends": [
        "eslint:recommended",
        "plugin:react/recommended"
    ],
    "env": {
        "browser": true
    },
    "parser": "typescript-eslint-parser",
    "parserOptions": {
        "ecmaVersion": 6,
        "ecmaFeatures": {
            "jsx": true
        },
        "sourceType": "module"
    },
    "plugins": [
        "react"
    ],
    "rules": {
        "linebreak-style":"off"
    },
    "settings": {
      "import/resolver": "webpack"
    },
    "overrides": [
        {
            "files": ["**/*.ts", "**/*.tsx"],
            "parser": "typescript-eslint-parser",
            "rules": {
              "no-undef": "off",
              "react/prop-types": "off"
            }
        }
    ]
}

Repo for reproducibility: https://github.com/chetnashah/formik-app

DanielRosenwasser commented 5 years ago

Weird, but that sounds like an issue with the ESLint plugin for VS Code, doesn't it?

chetnashah commented 5 years ago

i'll try to dig deeper and get back

chetnashah commented 5 years ago

Adding setting for vscode-eslint did the trick. https://github.com/Microsoft/vscode-eslint/issues/227#issuecomment-297118310