Skip to content
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.

Multiple imports which include namespace can't be combined #877

Closed
antonovicha opened this issue Sep 26, 2019 · 2 comments
Closed

Multiple imports which include namespace can't be combined #877

antonovicha opened this issue Sep 26, 2019 · 2 comments

Comments

@antonovicha
Copy link

antonovicha commented Sep 26, 2019

I want to report a bug.

SonarTS version: 1.9 (build 3766)

Node.js version: 8.11

TypeScript version: 3.5.1

Rule key: S3863

Reproducer

import * as express from "express";
import { Request, Response} from "express"; // False-positive here

Expected behavior

No error is reported. It's not possible to merge namespace and named imports. See similar issue in tslint: palantir/tslint#3418

@quentin-jaquier-sonarsource
Copy link
Contributor

Hello @antonovicha,
thanks for the feedback and the clear description.

In SonarTS 2.0, we are going to change this rule, and base it on no-duplicate-imports, from ESLint.

The bad news is that this FP is also present in ESlint. Fixing it on our side does not make much sense, they could definitely benefits from this.
Therefore I advise you to report it to ESLint instead.

Best,
Quentin

@naingaungphyo
Copy link

naingaungphyo commented Oct 31, 2019

import * as express from "express";
import { Request, Response} from "express"; // False-positive here

@antonovicha
Why don't we access like express.Request , express.Response instead of importing 2nd line.
Is it something related with tree shaking or compiler(babel/webpack etc)/typescript version (before 2.7/after 2.7 etc) related case?

Updated:
AFAIK It is related with typescript version. I will leave the link so that everyone with the same type of question like mine can reference.
https://stackoverflow.com/a/54674521/943149
(for express)
https://stackoverflow.com/a/55523133/943149

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants