ESLint issue: JSX not allowed in files in Typescript files

Viewed 2496

I have .tsx files with jsx inside, but I'm getting this error in VSCode:

JSX not allowed in files with extension '.tsx'eslintreact/jsx-filename-extension

I added this to my package.json to fix it:

Package.json:

"eslintConfig": {
    "rules": {
      "react/jsx-filename-extension": [
        1,
        {
          "extensions": [
            ".tsx",
            ".jsx"
          ]
        }
      ]
    }
  }

Does anyone know what I'm doing wrong?

1 Answers

Add this rule to your .eslintrc.json file:

"react/jsx-filename-extension": "off"
Related