-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(eslint-plugin): add key-spacing
rule extension for interface & type declarations
#6211
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
Merged
JoshuaKGoldberg
merged 43 commits into
typescript-eslint:main
from
coyotte508:key-spacing
Jan 24, 2023
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
eb02b4d
🚧 key-spacing for interface on default settings
coyotte508 6d78fe8
🚧 Support type literals as welll
coyotte508 259a3ca
🚧 Add full typing for the options
coyotte508 8f32b5d
🚧 Add 'mode' param
coyotte508 34bb6d8
🐛 Fix index signatures
coyotte508 ecaafa7
✨ Support classes
coyotte508 b17665b
🩹 fixes
coyotte508 18bb8ab
✅ Add tests on mode, multiLine, singleLine
coyotte508 4113478
🏷️ Allow options.multiline.align to be an object
coyotte508 5e951ba
🎨 Use ast utils to locate last character before token
coyotte508 b12c530
✨ Support comments in-between properties
coyotte508 729e642
✅ Add test cases for nested type declarations & multiline type annota…
coyotte508 d93c1a7
✨ Autofix for non-aligned values
coyotte508 ee519e3
✨ Autofix for aligned values
coyotte508 bc3b5d2
✏️
coyotte508 eebb18f
🚨
coyotte508 179aca2
🐛 Support optional ? token
coyotte508 db2d1bd
✅ Add tests with class property assignments
coyotte508 dbe502d
📝 Add documentation on key-spacing
coyotte508 8d5d3dd
🎨 Use .at() to access last element of array
coyotte508 af0a489
✅ Fix tests
coyotte508 c18b929
fixup! ✅ Fix tests
coyotte508 37eecdc
✅ Add some coverage
coyotte508 75ac325
Merge branch 'main' into key-spacing
coyotte508 1b62445
🐛 Fix edge case in determining aligned groups
coyotte508 4b0759c
⚡️ Use Array.concat instead of .push(...)
coyotte508 6d61144
🎨 Improve readability
coyotte508 47156ec
🎨 Use tempate literals in tests
coyotte508 ae33b9b
✅ Add test with anonymous types
coyotte508 722e092
✅ Add test with quoted keys
coyotte508 301731b
➕ Add grapheme-splitter to deal with emojis
coyotte508 9eaebb2
✅ Add test case for multiline comments
coyotte508 ee6d9bc
🚨 Remove 'in' statements, reduce amount of null-assertions
coyotte508 dbc6a91
✅ Add test case for properties without type annotation or assignments
coyotte508 b1033ef
✅ Add wacky test cases
coyotte508 a7a5b2c
✅ Add coverage
coyotte508 cb5876e
✅ Add coverage, again
coyotte508 2787762
✅ Add coverage, again
coyotte508 79d8ec0
✅ Add coverage when align is an object, but align.on is missing
coyotte508 2092487
KeyTypeNodeWithTypeAnnotation
JoshuaKGoldberg 23036de
Merge branch 'main' into key-spacing
JoshuaKGoldberg e483407
Merge branch 'main' into key-spacing
JoshuaKGoldberg 0184de9
Extract to shared helper
JoshuaKGoldberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
description: 'Enforce consistent spacing between property names and type annotations in types and interfaces.' | ||
--- | ||
|
||
> 🛑 This file is source code, not the primary documentation location! 🛑 | ||
> | ||
> See **https://typescript-eslint.io/rules/key-spacing** for documentation. | ||
|
||
## Examples | ||
|
||
This rule extends the base [`eslint/keyword-spacing`](https://eslint.org/docs/rules/key-spacing) rule. | ||
This version adds support for type annotations on interfaces, classes and type literals properties. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
looks like a bad merge - added the entry twice!
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.
Eek.
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.
99c091e#r98752909