Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing duplicates breaks in TypeScript when "type" is being used #3016

Open
bennycode opened this issue Jun 17, 2024 · 0 comments
Open

Removing duplicates breaks in TypeScript when "type" is being used #3016

bennycode opened this issue Jun 17, 2024 · 0 comments

Comments

@bennycode
Copy link

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';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants