Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
nx-cloudbot commentedNov 26, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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. |
netlifybot commentedNov 26, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
✅ Deploy Preview fortypescript-eslint ready!
To edit notification comments on pull requests, go to yourNetlify site settings. |
keyword-spacing unexpected space before/after in import typekeyword-spacing unexpected space before/after in import typekeyword-spacing unexpected space before/after in import typecodecovbot commentedNov 26, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
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
Flags with carried forward coverage won't be shown.Click here to find out more.
|
JoshuaKGoldberg left a comment
There was a problem hiding this 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; | ||
| } |
There was a problem hiding this comment.
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";
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 🙂
There was a problem hiding this comment.
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 😄
There was a problem hiding this comment.
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
…rd-spacing-unexpected-space-before
…rd-spacing-unexpected-space-before
…rd-spacing-unexpected-space-before
bradzacher left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
import type
Uh oh!
There was an error while loading.Please reload this page.
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