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

fix(eslint-plugin): [no-restricted-imports] disallow side effect imports when allowTypeImports is enabled #7560

Merged
merged 3 commits into from Sep 8, 2023
Merged

Conversation

joshkel
Copy link
Contributor

@joshkel joshkel commented Aug 29, 2023

PR Checklist

Overview

Fixes #7559 by changing the logic from #7379 from "allow imports if all specifiers are types (or if no specifiers exist)" to "allow imports if specifiers exist and all specifiers are types."

@netlify
Copy link

netlify bot commented Aug 29, 2023

Deploy Preview for typescript-eslint failed.

Name Link
🔨 Latest commit b61759b
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/64fa703738bf8800085f4afd

@nx-cloud
Copy link

nx-cloud bot commented Aug 29, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit b61759b. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


🟥 Failed Commands
nx build website
✅ Successfully ran 39 targets

Sent with 💌 from NxCloud.

@joshkel joshkel changed the title Disallow side effect imports when allowTypeImports is enabled fix(eslint-plugin): Disallow side effect imports when allowTypeImports is enabled Aug 29, 2023
@joshkel joshkel changed the title fix(eslint-plugin): Disallow side effect imports when allowTypeImports is enabled fix(eslint-plugin): [no-restricted-imports] disallow side effect imports when allowTypeImports is enabled Aug 29, 2023
@codecov
Copy link

codecov bot commented Aug 29, 2023

Codecov Report

Merging #7560 (b61759b) into main (4f34d0b) will not change coverage.
Report is 34 commits behind head on main.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7560   +/-   ##
=======================================
  Coverage   87.23%   87.23%           
=======================================
  Files         387      387           
  Lines       13401    13401           
  Branches     3962     3962           
=======================================
  Hits        11690    11690           
  Misses       1327     1327           
  Partials      384      384           
Flag Coverage Δ
unittest 87.23% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...s/eslint-plugin/src/rules/no-restricted-imports.ts 95.71% <100.00%> (ø)

... and 1 file with indirect coverage changes

📢 Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=typescript-eslint).

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @joshkel!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

@bradzacher bradzacher added the bug Something isn't working label Sep 8, 2023
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for completeness - could we also get a valid test case for import 'foo' with no banning config just to sanity-check that it still continues to pass?

otherwise looking good to me! great work!

packages/eslint-plugin/src/rules/no-restricted-imports.ts Outdated Show resolved Hide resolved
packages/eslint-plugin/src/rules/no-restricted-imports.ts Outdated Show resolved Hide resolved
@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Sep 8, 2023
joshkel and others added 2 commits September 7, 2023 20:46
@joshkel
Copy link
Contributor Author

joshkel commented Sep 8, 2023

for completeness - could we also get a valid test case for import 'foo' with no banning config just to sanity-check that it still continues to pass?

@bradzacher Done (if I've understood correctly). Thanks for the review!

@bradzacher bradzacher removed the awaiting response Issues waiting for a reply from the OP or another party label Sep 8, 2023
@bradzacher
Copy link
Member

thanks for fixing this!

@bradzacher bradzacher merged commit 4908905 into typescript-eslint:main Sep 8, 2023
44 of 50 checks passed
@joshkel joshkel deleted the restricted-side-effect-imports branch September 8, 2023 01:26
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: [no-restricted-imports] allowTypeImports allows side effect imports
2 participants