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] allow relative type imports with patterns configured #4494

Merged

Conversation

Josh-Cena
Copy link
Member

PR Checklist

Overview

This is in line with how the ESLint base rule is configured:

https://github.com/eslint/eslint/blob/b6f2bd8879176cd774f253ba437963f2fa1c493d/lib/rules/no-restricted-imports.js#L163

I'm surprised that we never had the caseSensitive option in our typedef, so I added that as well.

@nx-cloud
Copy link

nx-cloud bot commented Jan 30, 2022

☁️ Nx Cloud Report

CI ran the following commands for commit 73ef8a2. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 46 targets

Sent with 💌 from NxCloud.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @Josh-Cena!

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.

@netlify
Copy link

netlify bot commented Jan 30, 2022

❌ Deploy Preview for typescript-eslint failed.

🔨 Explore the source changes: 8651c89

🔍 Inspect the deploy log: https://app.netlify.com/sites/typescript-eslint/deploys/61f63686bc25dd0007197e1a

@netlify
Copy link

netlify bot commented Jan 30, 2022

✔️ Deploy Preview for typescript-eslint ready!

🔨 Explore the source changes: 73ef8a2

🔍 Inspect the deploy log: https://app.netlify.com/sites/typescript-eslint/deploys/61f6368c9f593d0008a95aea

😎 Browse the preview: https://deploy-preview-4494--typescript-eslint.netlify.app

@codecov
Copy link

codecov bot commented Jan 30, 2022

Codecov Report

Merging #4494 (73ef8a2) into main (d4768c0) will increase coverage by 7.57%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #4494      +/-   ##
==========================================
+ Coverage   86.97%   94.54%   +7.57%     
==========================================
  Files           5      147     +142     
  Lines         215     7851    +7636     
  Branches       60     2516    +2456     
==========================================
+ Hits          187     7423    +7236     
- Misses         22      234     +212     
- Partials        6      194     +188     
Flag Coverage Δ
unittest 94.54% <100.00%> (+7.57%) ⬆️

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

Impacted Files Coverage Δ
...s/eslint-plugin/src/rules/no-restricted-imports.ts 96.49% <100.00%> (ø)
...gin-internal/src/rules/no-poorly-typed-ts-props.ts
...plugin-internal/src/rules/prefer-ast-types-enum.ts
...internal/src/rules/no-typescript-default-import.ts
...lugin-internal/src/rules/plugin-test-formatting.ts
...-internal/src/rules/no-typescript-estree-import.ts
.../eslint-plugin/src/rules/prefer-ts-expect-error.ts 100.00% <0.00%> (ø)
...ackages/eslint-plugin/src/rules/keyword-spacing.ts 100.00% <0.00%> (ø)
packages/eslint-plugin/src/util/objectIterators.ts 66.66% <0.00%> (ø)
...ackages/eslint-plugin/src/rules/prefer-as-const.ts 100.00% <0.00%> (ø)
... and 143 more

@Josh-Cena Josh-Cena changed the title fix(eslint-plugin): [no-restricted-imports] allow relative type imports fix(eslint-plugin): [no-restricted-imports] allow relative type imports with patterns configured Jan 30, 2022
@Josh-Cena
Copy link
Member Author

I was about to send another PR to fix the Netlify build, but suddenly it works😅 Too weird...

@JoshuaKGoldberg
Copy link
Member

@Josh-Cena I'd still be very interested in seeing that PR 😅, it's nondeterministically flaking and none of us have had time to really dig in and figure out what's going on.

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Super, that was fast! Thanks @Josh-Cena! 💯

@JoshuaKGoldberg JoshuaKGoldberg merged commit 4a6d217 into typescript-eslint:main Jan 30, 2022
@bradzacher bradzacher added the bug Something isn't working label Jan 30, 2022
@Josh-Cena Josh-Cena deleted the no-restricted-import-ignore branch January 31, 2022 02:07
lonyele pushed a commit to lonyele/typescript-eslint that referenced this pull request Feb 12, 2022
…ts with patterns configured (typescript-eslint#4494)

* fix(eslint-plugin): [no-restricted-imports] allow relative type imports

* refactor: add caseSensitive typedef
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Feb 16, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | minor | [`5.10.2` -> `5.12.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/5.10.2/5.12.0) |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | minor | [`5.10.2` -> `5.12.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/5.10.2/5.12.0) |

---

### Release Notes

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>

### [`v5.12.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#&#8203;5120-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5110v5120-2022-02-14)

[Compare Source](typescript-eslint/typescript-eslint@v5.11.0...v5.12.0)

##### Bug Fixes

-   **eslint-plugin:** \[init-declarations] fix nested namespace ([#&#8203;4544](typescript-eslint/typescript-eslint#4544)) ([fe910e6](typescript-eslint/typescript-eslint@fe910e6))
-   **eslint-plugin:** \[no-unnecessary-type-arguments] Use Symbol to check if it's the same type ([#&#8203;4543](typescript-eslint/typescript-eslint#4543)) ([5b7d8df](typescript-eslint/typescript-eslint@5b7d8df))
-   support nested object deconstructuring with type annotation ([#&#8203;4548](typescript-eslint/typescript-eslint#4548)) ([4da9278](typescript-eslint/typescript-eslint@4da9278))

##### Features

-   add checking property definition for allowNames option ([#&#8203;4542](typescript-eslint/typescript-eslint#4542)) ([e32bef6](typescript-eslint/typescript-eslint@e32bef6))

### [`v5.11.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#&#8203;5110-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5102v5110-2022-02-07)

[Compare Source](typescript-eslint/typescript-eslint@v5.10.2...v5.11.0)

##### Bug Fixes

-   **eslint-plugin:** \[no-magic-numbers] fix invalid schema merging ([#&#8203;4517](typescript-eslint/typescript-eslint#4517)) ([b95f796](typescript-eslint/typescript-eslint@b95f796))
-   **eslint-plugin:** \[non-nullable-type-assertion-style] fix false positive when asserting to a generic type that might be nullish ([#&#8203;4509](typescript-eslint/typescript-eslint#4509)) ([4209362](typescript-eslint/typescript-eslint@4209362))

##### Features

-   **eslint-plugin:** \[explicit-function-return-type] add allowedNames ([#&#8203;4440](typescript-eslint/typescript-eslint#4440)) ([936e252](typescript-eslint/typescript-eslint@936e252))

#### [5.10.2](typescript-eslint/typescript-eslint@v5.10.1...v5.10.2) (2022-01-31)

##### Bug Fixes

-   **eslint-plugin:** \[no-restricted-imports] allow relative type imports with patterns configured ([#&#8203;4494](typescript-eslint/typescript-eslint#4494)) ([4a6d217](typescript-eslint/typescript-eslint@4a6d217))

#### [5.10.1](typescript-eslint/typescript-eslint@v5.10.0...v5.10.1) (2022-01-24)

**Note:** Version bump only for package [@&#8203;typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/eslint-plugin)

</details>

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>

### [`v5.12.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#&#8203;5120-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5110v5120-2022-02-14)

[Compare Source](typescript-eslint/typescript-eslint@v5.11.0...v5.12.0)

**Note:** Version bump only for package [@&#8203;typescript-eslint/parser](https://github.com/typescript-eslint/parser)

### [`v5.11.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#&#8203;5110-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5102v5110-2022-02-07)

[Compare Source](typescript-eslint/typescript-eslint@v5.10.2...v5.11.0)

**Note:** Version bump only for package [@&#8203;typescript-eslint/parser](https://github.com/typescript-eslint/parser)

#### [5.10.2](typescript-eslint/typescript-eslint@v5.10.1...v5.10.2) (2022-01-31)

**Note:** Version bump only for package [@&#8203;typescript-eslint/parser](https://github.com/typescript-eslint/parser)

#### [5.10.1](typescript-eslint/typescript-eslint@v5.10.0...v5.10.1) (2022-01-24)

**Note:** Version bump only for package [@&#8203;typescript-eslint/parser](https://github.com/typescript-eslint/parser)

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Co-authored-by: crapStone <crapstone@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1157
Reviewed-by: crapStone <crapstone@noreply.codeberg.org>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2022
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.

[no-restricted-imports] path should be a path.relative()d string, but got "./types"
3 participants