-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[webui] format code by eslint and prettier #2744
Conversation
@@ -41,7 +47,7 @@ class ChangeColumnComponent extends React.Component<ChangeColumnProps, ChangeCol | |||
} else { | |||
if (source.includes(label)) { | |||
// remove from source | |||
const result = source.filter((item) => item !== label); | |||
const result = source.filter(item => item !== label); |
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 think this is less clear to human. It's hard to figure out associative order at first glance to me.
I personally prefer item => (item !== label)
, but according to line 44 of App.tsx
maybe tslint doesn't like 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.
alwaysParens: avoid | always
;
default val is avoid, not add () for arrow function.
So we change it to always
?
src/webui/.editorconfig
Outdated
@@ -0,0 +1,12 @@ | |||
root = true |
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.
Is this file used by a specific text editor? If yes it should not be committed to code tree.
src/webui/.editorconfig
Outdated
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
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.
And I wonder why your files do not have trailing new line even though this is set to true
...
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.
but .tsx .scss
these files all have new line in last line.
src/webui/src/App.tsx
Outdated
item.errorWhere && <div key={key} className="warning"> | ||
<MessageInfo info={item.errorMessage} typeInfo="error" /> | ||
{errorList.map((item, key) => { | ||
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.
Is return
necessary here?
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 also think so. We can use arrow function rules to standardize it.
I think we should discuss the rules in a meeting, just like what we have done for pylint rules. |
stylelint reference
yarn stylelint --fix
could almost format css/scss codeprettier
add some eslint rule