Typescript eslint - Missing file extension "ts" import/extensions Typescript eslint - Missing file extension "ts" import/extensions typescript typescript

Typescript eslint - Missing file extension "ts" import/extensions


Add the following code to rules:

"rules": {   "import/extensions": [      "error",      "ignorePackages",      {        "js": "never",        "jsx": "never",        "ts": "never",        "tsx": "never"      }   ]}

airbnb ESLint config leads the problem.


I know this is late, but if you're extending the Airbnb rules you can use eslint-config-airbnb-typescript. You should be able to follow the instructions in the project README on github.



STOP: Prior to August 2021, you would need to also do the following tasks. These instructions are remaining here for historical reference only. You should not need to do this any more.

First uninstall the old one and add the new one:

# uninstall whichever one you're usingnpm uninstall eslint-config-airbnbnpm uninstall eslint-config-airbnb-base# install the typescript onenpm install -D eslint-config-airbnb-typescript

Then update your ESlint config, remove the old Airbnb from the "extends" section and add the new one:

extends: ["airbnb-typescript"]


got this working by bundling all answers I found on internet:

this is the end result for me:

{  "settings": {    "import/extensions": [".js", ".jsx", ".ts", ".tsx"],    "import/parsers": {      "@typescript-eslint/parser": [".ts", ".tsx"]    },    "import/resolver": {      "node": {        "extensions": [".js", ".jsx", ".ts", ".tsx"]      }    }  },  "env": {    "browser": true,    "es2021": true  },  "extends": ["plugin:react/recommended", "airbnb"],  "parser": "@typescript-eslint/parser",  "parserOptions": {    "ecmaFeatures": {      "jsx": true    },    "ecmaVersion": 12,    "sourceType": "module"  },  "plugins": ["import", "react", "@typescript-eslint"],  "rules": {    "no-console": 1,    "import/extensions": [      "error",      "ignorePackages",      {        "js": "never",        "jsx": "never",        "ts": "never",        "tsx": "never",        "mjs": "never"      }    ]  }}

im using react native btw. if u're using something different just removing react related should be enough