Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(eslint-plugin): [consistent-type-imports] support fixing to inline types#5050

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

snewcomer
Copy link
Contributor

@snewcomersnewcomer commentedMay 23, 2022
edited
Loading

PR Checklist

Overview

This PR adds a configuration optioninline-type-imports that users can utilize to inline their type imports.

Previously, as on Typescript 3.8, we had the ability toimport type. This import would be elided from the build deterministically.

import A, { CType } from 'foo';import type { AType } from 'foo';import { BType } from 'foo';

As of 4.5, we can inline that type, making it easier to manage top level imports.

import A, { type CType } from 'foo';import type { AType } from 'foo';import { type BType } from 'foo';

The summation of the discussion and work is as follows.

  1. fixes aType import toInline Type -[New]consistent-type-specifier-style: add rule import-js/eslint-plugin-import#2473.
  2. (this PR) fixes aValue import toInline Type
  3. adds support for resolving duplicateType imports toInline Types to existing import source[New]no-duplicates: support inline type import withprefer-inline option import-js/eslint-plugin-import#2475

JounQin, Niznikr, ryzr, tusbar, dbasilio, c-harding, BennoDev, betocantu93, u3u, sadeghbarati, and 2 more reacted with thumbs up emojiJosh-Cena, razh, simmo, JounQin, shian15810, jgoux, zyhou, Niznikr, BennoDev, and u3u reacted with hooray emojiitsMapleLeaf and SpiderSeb reacted with heart emojiJosh-Cena, razh, simmo, JounQin, shian15810, jgoux, Niznikr, dbasilio, BennoDev, and u3u reacted with rocket emoji
@nx-cloud
Copy link

nx-cloudbot commentedMay 23, 2022
edited
Loading

☁️ Nx Cloud Report

CI is running/has finished running commands for commitf92cefd. 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


✅ Successfully ran 46 targets

Sent with 💌 fromNxCloud.

@typescript-eslint
Copy link
Contributor

Thanks for the PR,@snewcomer!

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 onhttps://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitorsper day.

@netlify
Copy link

netlifybot commentedMay 23, 2022
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commitf92cefd
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/6369892a4ef328000850035b
😎 Deploy Previewhttps://deploy-preview-5050--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to yourNetlify site settings.

@snewcomersnewcomer changed the titlefeat: inline typesfeat(eslint-plugin): inline typesMay 23, 2022
@snewcomersnewcomerforce-pushed thesn/inline-type branch 5 times, most recently from6386e8f toc050a8fCompareMay 23, 2022 14:53
@bradzacherbradzacher changed the titlefeat(eslint-plugin): inline typesfeat(eslint-plugin): [consistent-type-imports] support fixing to inline typesMay 23, 2022
@bradzacherbradzacher added the enhancement: plugin rule optionNew rule option for an existing eslint-plugin rule labelMay 23, 2022
@snewcomersnewcomerforce-pushed thesn/inline-type branch 4 times, most recently from1b8e40e to19c73d2CompareMay 25, 2022 14:57
@snewcomer
Copy link
ContributorAuthor

Fixing a bug with inlining to a value ImportDefaultSpecifier....leaving in draft

@snewcomersnewcomerforce-pushed thesn/inline-type branch 4 times, most recently fromd54fbf9 to3d525afCompareMay 26, 2022 13:10
@snewcomersnewcomerforce-pushed thesn/inline-type branch 5 times, most recently from3cdb01f tofe407d4CompareMay 28, 2022 20:09
@snewcomersnewcomer marked this pull request as ready for reviewMay 28, 2022 20:17
@snewcomer
Copy link
ContributorAuthor

Just a small fYI. Looks like the ember.js repo with this fixer ran on it works.

emberjs/ember.js#20101

chriskrycho and razh reacted with laugh emojichriskrycho, armano2, JoshuaKGoldberg, razh, jgoux, and zyhou reacted with hooray emoji

Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

This PR looks very snazzy and great at first glance, thanks for sending it! I just want to confirm with@bradzacher that it's not doing more than it should? (I suspect the part of the fixer that merges imports together is not needed)

snewcomer reacted with thumbs up emoji
snewcomerand others added17 commitsNovember 7, 2022 16:39
Co-authored-by: Josh Goldberg <me@joshuakgoldberg.com>
Co-authored-by: Josh Goldberg <me@joshuakgoldberg.com>
Co-authored-by: Josh Goldberg <me@joshuakgoldberg.com>
Co-authored-by: Josh Goldberg <me@joshuakgoldberg.com>
Co-authored-by: Josh Goldberg <me@joshuakgoldberg.com>
Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
…t.tsCo-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
…t.tsCo-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Awesome - thanks so much for iterating on this with us@snewcomer! I'm pumped to get this shipped 😄

snewcomer, fregante, and jamiehaywood reacted with heart emoji
@ysulyma
Copy link

Can this be removed from the docs (https://typescript-eslint.io/rules/consistent-type-imports/#fixstyle) until it is released? I just spent several minutes troubleshooting

Error: .eslintrc.json:Configuration for rule "@typescript-eslint/consistent-type-imports" is invalid:Value {"fixStyle":"inline-type-imports"} should NOT have additional properties.

@JoshuaKGoldberg
Copy link
Member

@ysulyma sorry about that - please see#5939

crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull requestNov 15, 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.42.1` -> `5.43.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/5.42.1/5.43.0) || [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | minor | [`5.42.1` -> `5.43.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/5.42.1/5.43.0) |---### Release Notes<details><summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>### [`v5.43.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#&#8203;5430-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5421v5430-2022-11-14)[Compare Source](typescript-eslint/typescript-eslint@v5.42.1...v5.43.0)##### Bug Fixes-   **eslint-plugin:** \[no-shadow] handle false positives on generics and parameters ([#&#8203;5902](typescript-eslint/typescript-eslint#5902)) ([769e8c8](typescript-eslint/typescript-eslint@769e8c8))-   **eslint-plugin:** \[promise-function-async] handle keyword token ([#&#8203;5907](typescript-eslint/typescript-eslint#5907)) ([f25a94f](typescript-eslint/typescript-eslint@f25a94f))##### Features-   **eslint-plugin:** \[consistent-type-imports] support fixing to inline types ([#&#8203;5050](typescript-eslint/typescript-eslint#5050)) ([75dcdf1](typescript-eslint/typescript-eslint@75dcdf1))-   **eslint-plugin:** \[naming-convention] add support for "override" and "async" modifiers ([#&#8203;5310](typescript-eslint/typescript-eslint#5310)) ([#&#8203;5610](typescript-eslint/typescript-eslint#5610)) ([c759da1](typescript-eslint/typescript-eslint@c759da1))-   **eslint-plugin:** \[prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#&#8203;5594](typescript-eslint/typescript-eslint#5594)) ([923d486](typescript-eslint/typescript-eslint@923d486))#### [5.42.1](typescript-eslint/typescript-eslint@v5.42.0...v5.42.1) (2022-11-07)##### Bug Fixes-   **eslint-plugin:** isTypeReadonly stack overflow ([#&#8203;5875](typescript-eslint/typescript-eslint#5875)) ([#&#8203;5876](typescript-eslint/typescript-eslint#5876)) ([2d9a33c](typescript-eslint/typescript-eslint@2d9a33c))</details><details><summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>### [`v5.43.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#&#8203;5430-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5421v5430-2022-11-14)[Compare Source](typescript-eslint/typescript-eslint@v5.42.1...v5.43.0)**Note:** Version bump only for package [@&#8203;typescript-eslint/parser](https://github.com/typescript-eslint/parser)#### [5.42.1](typescript-eslint/typescript-eslint@v5.42.0...v5.42.1) (2022-11-07)**Note:** Version bump only for package [@&#8203;typescript-eslint/parser](https://github.com/typescript-eslint/parser)</details>---### Configuration📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.--- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box---This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMSJ9-->Co-authored-by: cabr2-bot <cabr2.help@gmail.com>Reviewed-on:https://codeberg.org/Calciumdibromid/CaBr2/pulls/1639Reviewed-by: Epsilon_02 <epsilon_02@noreply.codeberg.org>Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsNov 21, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@chriskrychochriskrychochriskrycho left review comments

@bradzacherbradzacherbradzacher left review comments

@JoshuaKGoldbergJoshuaKGoldbergJoshuaKGoldberg approved these changes

Assignees
No one assigned
Labels
awaiting responseIssues waiting for a reply from the OP or another partyenhancement: plugin rule optionNew rule option for an existing eslint-plugin rule
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[consistent-type-imports] prefer inline type import syntax
6 participants
@snewcomer@me4502@bradzacher@JoshuaKGoldberg@ysulyma@chriskrycho

[8]ページ先頭

©2009-2025 Movatter.jp