-
Notifications
You must be signed in to change notification settings - Fork 32
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
fix: Formatting Rule Doesn't use default set by user #1547
Conversation
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.
Some questions for Don, and make sure we don't screw up line endings.
packages/eslint-config/index.js
Outdated
{ | ||
endOfLine: 'auto', | ||
}, |
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.
We shouldn't be changing the endOfLine
default, we want to keep it to lf
instead of crlf
. Might need to configure something on Windows so that line endings are handled correctly in git.
@@ -617,7 +617,7 @@ export class FormattingSectionContent extends PureComponent< | |||
checked={truncateNumbersWithPound ?? null} | |||
onChange={this.handleTruncateNumbersWithPoundChange} | |||
> | |||
Truncate numbers with # | |||
Show truncated numbers as ### |
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.
A contextual help bubble could be useful here... I think the phrase "Mask truncated numbers with ###" may be better as well, @dsmmcken any opinion?
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 am fine with this suggestion. Using the word show is more consistent wit the other labels, like "Show T seperator", and I like the multiple hashtags in the label. It's a bit long now is my only complaint.
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.
what about Show truncation as ###
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.
It only applies to numbers though
defaultFormatString ?? IntegerColumnFormatter.DEFAULT_FORMAT_STRING | ||
} | ||
onKeyDown={e => { | ||
if (e.key === 'Enter' && value === '') { |
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 not sure I like this - it's kind of hidden functionality that is difficult for the user to find. Granted, I don't know a better way to start with the default/edit it, other than copying pasting from above.
@dsmmcken Do you have any ideas for creating a new rule based off the default but edited slightly?
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.
We could just set it to the initial value instead of a placeholder.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1547 +/- ##
==========================================
- Coverage 46.42% 46.38% -0.05%
==========================================
Files 558 564 +6
Lines 35714 35810 +96
Branches 8916 8969 +53
==========================================
+ Hits 16582 16612 +30
- Misses 19082 19146 +64
- Partials 50 52 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
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 good overall. Just a very minor cleanup.
@@ -221,7 +212,7 @@ export class ColumnSpecificSectionContent extends PureComponent< | |||
let resetKeys = {}; | |||
if (key === 'columnType') { | |||
resetKeys = { | |||
format: '', | |||
format: this.makeDefaultFormatterItemByType(value as string), |
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 wonder if there's a way using function overloading and/or generics to correct this so you don't need to cast it: https://www.typescriptlang.org/docs/handbook/2/functions.html#function-overloads
Figuring that out isn't really necessary for this though.
const onTypeChange = (e: ChangeEvent<HTMLSelectElement>): void => { | ||
this.handleFormatRuleChange(i, 'columnType', e.target.value); | ||
}; |
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.
Not sure why you added these here - handleFormatRuleChange
doesn't return anything, so you can keep the shorthand. Or update the onNameChange
and onNameBlur
declarations to match for consistency.
@Zhou-Ziheng good work. We need to port the same fix over to Enterprise as well (Settings menu isn't shared currently - that would be another task that would be sweet). |
* Pressingenter
on empty formatting string input fields should fill the input with the default string* Updated eslint config to handle lines ending in CRLF correctly