-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: remove tslint and use typescript-eslint #159
Conversation
feat: remove tslint and eslint to lint typescript chore: better eslint setting
package.json
Outdated
"lint": "eslint \"packages/!(docs)/**/*.js\" \"scripts/**/*.js\"", | ||
"tslint": "npm run tslint:once && onchange 'packages/**/*.ts' -- npm run tslint:once", | ||
"tslint:once": "tslint --fix --project ./ ", | ||
"lint": "eslint --ext .js,.ts,.tsx \"packages/!(docs)/**/*.@(ts|tsx|js)\" \"scripts/**/*.@(ts|tsx|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.
要不要结合 lint-staged 只检测修改的文件哦?感觉每次执行 lint 有点慢
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.
是的,可以加上
scripts/.eslintrc
Outdated
"ecmaFeatures": { | ||
"jsx": 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.
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.
多了一个逗号,这个.eslintrc是单独配置这个目录下的eslint规则。因为下面都是一些编译的脚本规则应该是不一样的,比如说允许使用require,env应该是node等
.eslintrc
Outdated
// allow specifying true explicitly for boolean props | ||
"react/jsx-boolean-value": 0, | ||
"react-hooks/rules-of-hooks": "error", | ||
"react/no-did-update-set-state": 0, | ||
"jsx-quotes":"off" | ||
// maybe we should no-public | ||
"@typescript-eslint/explicit-member-accessibility": "off", |
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.
保持队列,用 0 ?
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.
嗯嗯,还是统一用数字吧
.eslintrc
Outdated
// maybe we should no-public | ||
"@typescript-eslint/explicit-member-accessibility": "off", | ||
"@typescript-eslint/indent": ["error", 2], | ||
"@typescript-eslint/interface-name-prefix": 0, |
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
开头的哈
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
开头,不关掉就各种错误了
.eslintrc
Outdated
"@typescript-eslint/explicit-function-return-type": 0, | ||
"@typescript-eslint/no-parameter-properties": 0, | ||
"@typescript-eslint/no-use-before-define": 0, | ||
// "@typescript-eslint/no-var-requires": 1, |
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.
不要注释吧?直接 remove 掉?
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.
对。。。
.eslintrc
Outdated
"@typescript-eslint/no-explicit-any": 0, | ||
"@typescript-eslint/explicit-function-return-type": 0, | ||
"@typescript-eslint/no-parameter-properties": 0, | ||
"@typescript-eslint/no-use-before-define": 0, |
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.
这个为啥要关呢?
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.
js文件里面违反这条规则的代码有点多。要不先不管js文件吧。。。
.eslintrc
Outdated
"@typescript-eslint/no-parameter-properties": 0, | ||
"@typescript-eslint/no-use-before-define": 0, | ||
// "@typescript-eslint/no-var-requires": 1, | ||
"@typescript-eslint/array-type":0, |
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.
nit:加上空格
.eslintrc
Outdated
"@typescript-eslint/no-use-before-define": 0, | ||
// "@typescript-eslint/no-var-requires": 1, | ||
"@typescript-eslint/array-type":0, | ||
"@typescript-eslint/class-name-casing": 0, |
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.
这个为啥要关呢?
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.
因为代码里面很多违反这条规则的情况,比如:fileSetting,defaultValueCascader之类的。不过都是js文件。要不我们先不管这些 js文件,因为反正都会用ts重构掉
@@ -65,8 +65,12 @@ export class Row extends Component<IRowProps> { | |||
...(others.style || {}) | |||
} | |||
newChildren = Children.map(children, (child: React.ReactElement) => { | |||
// @ts-ignore | |||
if (child && child.type && typeof child.type === 'function' && child.type.isNextCol) { |
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.
这个改动好像会报 typescript 错误吧?因为这个 isNextCol 太随意了,但是又不能去掉
@janryWang 以后我自己来merge吧,感觉每个pr提交次数太多,squash一下会比较好 |
他就是用 squash 的吧 |
@monkindey 好吧,merge squash也行 |
* chore: remove tslint and use typescript-eslint feat: remove tslint and eslint to lint typescript chore: better eslint setting * chore: integrate prettier into eslint * chore: downgrade lint-staged version * fix: child.type.isNextCol error * chore: better eslint config
使用typescript-eslint来代替tslint
PS: 很多还没用ts重构的项目文件被eslint给autofix了,不过应该不影响。