-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Chore] Run ts-migrate on core package #286
Changes from all commits
7890066
6c329ea
70d7efb
311b069
1d1bd5c
4f81bb1
87acdb0
aac5774
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,18 +10,69 @@ plugins: [ | |
'@typescript-eslint' | ||
] | ||
|
||
"rules": | ||
"import/extensions": [ | ||
"error", | ||
"ignorePackages", | ||
{ | ||
rules: | ||
"import/extensions": [ | ||
"error", | ||
"ignorePackages", | ||
{ | ||
"js": "never", | ||
"jsx": "never", | ||
"ts": "never", | ||
"tsx": "never" | ||
} | ||
] | ||
|
||
} | ||
] | ||
"no-unused-vars": "off" | ||
"@typescript-eslint/no-unused-vars": ["error", { "ignoreRestSiblings": true }] | ||
# Temp turn off following rules because we're doing ts-migrate | ||
# Will turn them on after migration completed. | ||
"max-len": "warn" | ||
"no-use-before-define": "warn" | ||
Comment on lines
+26
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 這就是在 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 稍微補充說明一下 The 3.9 release of TypeScript introduced @ts-expect-error comments. When a line is prefixed with a @ts-expect-error comment, TypeScript will suppress that error from being reported. If there’s no error, TypeScript will report that @ts-expect-error wasn’t necessary. In the Airbnb codebase we switched to using the @ts-expect-error comment instead of @ts-ignore. 簡單講標上 |
||
# It's fix after upgrading eslint-plugin-react to v7.20.6 | ||
# to keep consistency with rule config in eslint-config-ichef. | ||
# just add `static-variables` in the first line. | ||
# Should remove after we upgrade eslint-plugin-react in eslint-config-ichef. | ||
'react/sort-comp': ['error', { | ||
Comment on lines
+30
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 這個是升了 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 這個加在 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 應該是要這樣,我想說暫時先讓它 pass,最後再來收尾 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 可以標個 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 感謝班尼建議,有另外開個 task 了 |
||
order: [ | ||
'static-variables', | ||
'static-methods', | ||
'instance-variables', | ||
'lifecycle', | ||
'getters', | ||
'setters', | ||
'/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/', | ||
'instance-methods', | ||
'everything-else', | ||
'/^(on|handle).+$/', | ||
'rendering', | ||
], | ||
groups: { | ||
lifecycle: [ | ||
'displayName', | ||
'propTypes', | ||
'contextTypes', | ||
'childContextTypes', | ||
'mixins', | ||
'statics', | ||
'defaultProps', | ||
'constructor', | ||
'getDefaultProps', | ||
'getInitialState', | ||
'state', | ||
'getChildContext', | ||
'componentWillMount', | ||
'componentDidMount', | ||
'componentWillReceiveProps', | ||
'shouldComponentUpdate', | ||
'componentWillUpdate', | ||
'componentDidUpdate', | ||
'componentWillUnmount', | ||
], | ||
rendering: [ | ||
'/^render.+$/', | ||
'render', | ||
], | ||
}, | ||
}] | ||
|
||
env: | ||
browser: true | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ const defaultConfigs = require('../../../configs/webpack.dist'); | |
const packageDirname = process.cwd(); | ||
|
||
module.exports = webpackMerge(defaultConfigs, { | ||
entry: './src/index.ts', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 對,因為現在是 index.ts 了。 |
||
|
||
module: { | ||
rules: [ | ||
{ | ||
|
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 的時候造成 no-unused-vars error:
https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
ignoreRestSiblings
是為了讓const { a, b, ...other } = props
不會出錯,有蠻多地方我們會這樣寫來濾掉不要的 props。