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): [keyword-spacing] unexpected space before/after inimport type#6095

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

Conversation

@omril1
Copy link
Contributor

@omril1omril1 commentedNov 26, 2022
edited
Loading

PR Checklist

Overview

This is very hard to define correctly as the type keyword sits between already supported tokens from the base rule that have their own defined before/after.
For now, this is how I think the defining cases should be but I'm open to changing them or add more as you see fit

  • I'm not sure if I should add support for an overrides option for type, and how to do it with extending the base rule

summersk reacted with heart emoji
@nx-cloud
Copy link

nx-cloudbot commentedNov 26, 2022
edited
Loading

☁️ Nx Cloud Report

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

Sent with 💌 fromNxCloud.

@typescript-eslint
Copy link
Contributor

Thanks for the PR,@omril1!

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.

@netlify
Copy link

netlifybot commentedNov 26, 2022
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commite8d5efc
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/6388fa61a7e44c000986d84d
😎 Deploy Previewhttps://deploy-preview-6095--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.

@omril1omril1 changed the titlefix(eslint-plugin)keyword-spacing unexpected space before/after in import typefix(eslint-plugin):keyword-spacing unexpected space before/after in import typeNov 26, 2022
@omril1omril1 changed the titlefix(eslint-plugin):keyword-spacing unexpected space before/after in import typefix(eslint-plugin): [keyword-spacing] unexpected space before/after in import typeNov 26, 2022
@codecov
Copy link

codecovbot commentedNov 26, 2022
edited
Loading

Codecov Report

Merging#6095 (e8d5efc) intomain (1dba257) willdecrease coverage by0.00%.
The diff coverage is91.66%.

Additional details and impacted files
@@            Coverage Diff             @@##             main    #6095      +/-   ##==========================================- Coverage   91.27%   91.26%   -0.01%==========================================  Files         366      366                Lines       12419    12427       +8       Branches     3632     3638       +6     ==========================================+ Hits        11335    11342       +7  Misses        774      774- Partials      310      311       +1
FlagCoverage Δ
unittest91.26% <91.66%> (-0.01%)⬇️

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

Impacted FilesCoverage Δ
...ackages/eslint-plugin/src/rules/keyword-spacing.ts96.77% <91.66%> (-3.23%)⬇️

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.

Did you mean to put this as a draft? Since it doesn't yet address the original issue, I'll convert it. Let me know if anything's unclear. And thanks for working on this!

node.specifiers?.[0]?.type===AST_NODE_TYPES.ImportDefaultSpecifier
){
return;
}

Choose a reason for hiding this comment

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

I'm confused. The preview deploy's playground still shows an unexpected space for one of the three issue's sample cases:https://deploy-preview-6095--typescript-eslint.netlify.app/play/#ts=4.9.3&sourceType=module&code=FASwtgDg9gTgLgAjgTwgUwQbwQZQIYBuaAJgIoCuaMIaAzggL4IBmMUYCARAHQD0+RMpWp1uAK1qcA3KEixEKdAgAWcOBABMLNh04A7KMTQAuVeo3TZ0eElQYzEbey4GjptREtA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Aa0UIHcB7aACa1kxAIZlmAc3RgA2uGw5uo6E0gAaBYqyLskAEaIAZv0Qz8cRJt17RR-Imgyjo+MitbdkXgDdHVARQZHRscRDczDBDQnDsHJwwLWERPGwBfaxioaER8WFVg1NDIOMdzSyLFDMq9C0JCrNt7MsSKxurGyDJRfDIACwbGqFKEsBcImogOrK7Rd0HOkfLkybBpmK7eJmR8BZml1pX2zI38Puhebj2Ng7AklOPVyCRdqNXY5tH71fXigV5rsVbt9Hp1eEZATYSp9lg8sr8oXNIV5gW14SdikZmK54PU3kNhjDDnCYgivEYLgBbZGKaHxWE-DFQyiU4j8V6Yd6E+nExlPRAADzZ0A50RuRLuaNJTK8gRcCFFXLpLUlR3hNTSRU1igAugpNWkgA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA. Am I missing something?

importtype{SavedQueries}from"./SavedQueries.js";

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I thought draft means you won't review it (Sorry, I guess it meant something else to me).

I opened it for review because I can't think of a way to solve it without adding an override option for thetype keyword or should it use the existing option for theimport keyword.

Choose a reason for hiding this comment

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

Oh I just didn't realize there was a question associated with this! Sorry, i misinterpreted the discussion. Will think on it 🙂

Choose a reason for hiding this comment

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

Or, actually, definitely yes. Since thetype option doesn't exist in ESLint core and is TypeScript-specific, we should add in a feature for it. Yes please 😄

Copy link
ContributorAuthor

@omril1omril1Nov 26, 2022
edited
Loading

Choose a reason for hiding this comment

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

Any example I can look at how to do that? The types seem looser than the schema validation (typed asoverrides?: Record<string, { before?: boolean; after?: boolean;}> but addingtype: { after: true } to object breaks the schema validation

OK, I found something similar to theno-magic-numbers rule

JoshuaKGoldberg reacted with thumbs up emoji
@JoshuaKGoldbergJoshuaKGoldberg marked this pull request as draftNovember 26, 2022 20:37
@omril1omril1 marked this pull request as ready for reviewDecember 1, 2022 19:46
Copy link
Member

@bradzacherbradzacher left a comment

Choose a reason for hiding this comment

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

strange_bugfix

thanks so much for following up to fix this!

omril1 and summersk reacted with heart emoji
@bradzacherbradzacher changed the titlefix(eslint-plugin): [keyword-spacing] unexpected space before/after in import typefix(eslint-plugin): [keyword-spacing] unexpected space before/after inimport typeDec 2, 2022
@bradzacherbradzacher merged commit98caa92 intotypescript-eslint:mainDec 2, 2022
@omril1omril1 deleted the fix/issue6063-keyword-spacing-unexpected-space-before branchDecember 2, 2022 04:42
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsDec 10, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@JoshuaKGoldbergJoshuaKGoldbergJoshuaKGoldberg left review comments

@bradzacherbradzacherbradzacher approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Bug: [@typescript-eslint/keyword-spacing] Unexpected space(s) before "{" in import type

3 participants

@omril1@JoshuaKGoldberg@bradzacher

[8]ページ先頭

©2009-2025 Movatter.jp