Removing duplicates breaks in TypeScript when "type" is being used
bennycode opened this issue · comments
Benny Neugebauer commented
In my current ESLint config I have set up eslint-plugin-import v2.29.1 in the following way:
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"env": {
"browser": true,
"node": true
},
"extends": ["prettier", "plugin:import/typescript"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 8,
"project": "./tsconfig.json",
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "prettier", "sort-keys-fix", "import"],
"rules": {
"import/no-commonjs": ["error"],
"import/no-duplicates": [
"error",
{
"prefer-inline": true
}
],
},
"settings": {
"import/resolver": {
"node": true,
"typescript": true
}
}
}
Unfortunately, the import/no-duplicates
rule breaks my TS code.
Initial code:
import type {
AxiosDefaults,
AxiosInterceptorManager,
AxiosRequestConfig,
AxiosResponse,
AxiosInstance,
AxiosError,
} from 'axios';
import axios, {isAxiosError} from 'axios';
Broken code after formatting:
import axios, type {
AxiosDefaults,
AxiosInterceptorManager,
AxiosRequestConfig,
AxiosResponse,
AxiosInstance,
AxiosError,
isAxiosError} from 'axios';