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

Should ban side-effect imports #5

Open
jbreckmckye opened this issue Sep 10, 2023 · 0 comments
Open

Should ban side-effect imports #5

jbreckmckye opened this issue Sep 10, 2023 · 0 comments

Comments

@jbreckmckye
Copy link

Under the ES spec it's possible to do side-effect only imports:

import './something.types.ts'

The AST for such an import looks like

"type": "ImportDeclaration",
"source": {
  "type": "Literal",
  "value": "./whatever",
  "raw": "'./whatever'",
  "range": [...]
},
"specifiers": [],
"importKind": "value",
"assertions": [],
"range": [...]

These cases won't be discovered by the ESLint plugin here, as the import rule checks specifiers - e.g. require-type-only-import/index.ts:L43. But a side-effect only import has no specifiers.

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

No branches or pull requests

1 participant