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

feat(eslint-plugin): add new extended rule no-restricted-imports #3775

Merged

Conversation

sosukesuzuki
Copy link
Contributor

@sosukesuzuki sosukesuzuki commented Aug 22, 2021

Adds new extended rule no-restricted-imports. The new rule allows to specify new option allowTypeImport for path or pattern. See the doc for more details.

Closes #2661.
This PR does not address #2563.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @sosukesuzuki!

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. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@codecov
Copy link

codecov bot commented Aug 22, 2021

Codecov Report

Merging #3775 (25fafe5) into master (b01a699) will decrease coverage by 0.82%.
The diff coverage is 91.52%.

@@            Coverage Diff             @@
##           master    #3775      +/-   ##
==========================================
- Coverage   93.52%   92.69%   -0.83%     
==========================================
  Files         150      331     +181     
  Lines        8066    11616    +3550     
  Branches     2557     3282     +725     
==========================================
+ Hits         7544    10768    +3224     
- Misses        165      371     +206     
- Partials      357      477     +120     
Flag Coverage Δ
unittest 92.69% <91.52%> (-0.83%) ⬇️

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

Impacted Files Coverage Δ
packages/eslint-plugin/src/configs/all.ts 100.00% <ø> (ø)
...s/eslint-plugin/src/rules/no-restricted-imports.ts 91.52% <91.52%> (ø)
packages/scope-manager/src/lib/esnext.weakref.ts 100.00% <0.00%> (ø)
packages/typescript-estree/src/ts-estree/index.ts 100.00% <0.00%> (ø)
...cope-manager/src/definition/ParameterDefinition.ts 100.00% <0.00%> (ø)
...src/definition/ImplicitGlobalVariableDefinition.ts 100.00% <0.00%> (ø)
packages/scope-manager/src/lib/es2019.string.ts 100.00% <0.00%> (ø)
packages/scope-manager/src/lib/es6.ts 100.00% <0.00%> (ø)
packages/scope-manager/src/lib/esnext.symbol.ts 100.00% <0.00%> (ø)
...-estree/src/create-program/createProjectProgram.ts 94.11% <0.00%> (ø)
... and 173 more

@bradzacher bradzacher added the enhancement: new plugin rule New rule request for eslint-plugin label Aug 23, 2021
@bradzacher bradzacher added enhancement: new base rule extension New base rule extension required to handle a TS specific case and removed enhancement: new plugin rule New rule request for eslint-plugin labels Sep 3, 2021
@bradzacher bradzacher changed the title feat(eslint-plugin): add new extended rule no-restricted-imports feat(eslint-plugin): add new extended rule no-restricted-imports Sep 20, 2021
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.

almost there! a few comments
thanks for your work!

packages/eslint-plugin/docs/rules/no-restricted-imports.md Outdated Show resolved Hide resolved
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 20, 2021
@sosukesuzuki
Copy link
Contributor Author

@bradzacher Thank you for review! I've addressed reviewed points!

@bradzacher bradzacher removed the awaiting response Issues waiting for a reply from the OP or another party label Sep 20, 2021
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.

LGTM - thanks for doing this!

@bradzacher bradzacher merged commit ec5d506 into typescript-eslint:master Sep 20, 2021
@sosukesuzuki sosukesuzuki deleted the extend-no-restricted-imports branch September 20, 2021 21:34
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement: new base rule extension New base rule extension required to handle a TS specific case
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[no-restricted-imports] extend to support type-only imports
2 participants