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

fix(eslint-plugin): [array-type] --fix flag removes parentheses from type#5997

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

@mhnaeem
Copy link
Contributor

PR Checklist

Overview

Array type with intersection that has parentheses does not retain the parens. Remove an unnecessary check since the type node doesn't include parens.

maennchen reacted with heart emoji
Array type with intersection that has parentheses does not retain the parens.typescript-eslint#5941
@typescript-eslint
Copy link
Contributor

Thanks for the PR,@mhnaeem!

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.

@nx-cloud
Copy link

nx-cloudbot commentedNov 16, 2022
edited
Loading

☁️ Nx Cloud Report

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

@netlify
Copy link

netlifybot commentedNov 16, 2022
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commit2fe9b96
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/6374760ffd2f40000802d890
😎 Deploy Previewhttps://deploy-preview-5997--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.

@codecov
Copy link

codecovbot commentedNov 16, 2022
edited
Loading

Codecov Report

Merging#5997 (2fe9b96) intomain (2778ff0) willnot change coverage.
The diff coverage is100.00%.

Additional details and impacted files
@@           Coverage Diff           @@##             main    #5997   +/-   ##=======================================  Coverage   91.42%   91.42%           =======================================  Files         365      365             Lines       12339    12339             Branches     3609     3608    -1     =======================================  Hits        11281    11281             Misses        753      753             Partials      305      305
FlagCoverage Δ
unittest91.42% <100.00%> (ø)

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

Impacted FilesCoverage Δ
packages/eslint-plugin/src/rules/array-type.ts97.14% <100.00%> (ø)

Copy link
Member

@Josh-CenaJosh-Cena left a comment

Choose a reason for hiding this comment

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

Interesting—the fixer looks a bit hacky to me overall, but if there are no regressions, I like how simple the fix is.

Comment on lines +2010 to +2034
testOutput(
'array',
`
type WorkingArray = {
outerProperty: Array<
{ innerPropertyOne: string } & { innerPropertyTwo: string }
>;
}
type BrokenArray = {
outerProperty: Array<
({ innerPropertyOne: string } & { innerPropertyTwo: string })
>;
}
`,
`
type WorkingArray = {
outerProperty: ({ innerPropertyOne: string } & { innerPropertyTwo: string })[];
}
type BrokenArray = {
outerProperty: ({ innerPropertyOne: string } & { innerPropertyTwo: string })[];
}
`,
);
Copy link
Member

Choose a reason for hiding this comment

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

This test case looks identical to the one above?

Copy link
ContributorAuthor

@mhnaeemmhnaeemNov 16, 2022
edited
Loading

Choose a reason for hiding this comment

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

@Josh-Cena One is with type and the other one is with interface, I wanted to be sure it doesn't affect the code different on either keyword. I can modify it a bit if you like@Josh-Cena

Maybe something like
type BrokenArray = Array<({ a: number } & { b: string })>

@mhnaeem
Copy link
ContributorAuthor

Interesting—the fixer looks a bit hacky to me overall, but if there are no regressions, I like how simple the fix is.

@Josh-Cena I could not think of any regressions and the tests passed as well, if you have any other test cases you would like me to include I will be happy to.

@bradzacherbradzacher added the bugSomething isn't working labelNov 16, 2022
Copy link
Member

@Josh-CenaJosh-Cena left a comment

Choose a reason for hiding this comment

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

Thanks, it seems to work 👍

mhnaeem reacted with thumbs up emoji
@Josh-Cena
Copy link
Member

For the record, the code was changed in#3340

@bradzacherbradzacher merged commit5e2f852 intotypescript-eslint:mainNov 23, 2022
@bradzacherbradzacher changed the titlefix(eslint-plugin) [array-type] --fix flag removes parentheses from typefix(eslint-plugin): [array-type] --fix flag removes parentheses from typeNov 23, 2022
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsDec 1, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@bradzacherbradzacherbradzacher approved these changes

@Josh-CenaJosh-CenaJosh-Cena approved these changes

Assignees

@Josh-CenaJosh-Cena

Labels

bugSomething isn't working

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Bug: [array-type]--fix removes neccesary brackets leading to a type with a different meaning

3 participants

@mhnaeem@Josh-Cena@bradzacher

[8]ページ先頭

©2009-2025 Movatter.jp