Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
升级 eslint, typescript-eslint, husky, rimraf
- Loading branch information
Showing
43 changed files
with
627 additions
and
221 deletions.
There are no files selected for viewing
This file contains 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,10 @@ | ||
module.exports = { | ||
rules: { | ||
/** | ||
* 禁止对没有 then 方法的对象使用 await | ||
* @category TypeScript | ||
* @requires-types-information | ||
*/ | ||
'@typescript-eslint/await-thenable': 'off' | ||
} | ||
}; |
This file contains 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 |
---|---|---|
@@ -1 +1 @@ | ||
<html><head><meta charset="utf-8"><meta http-equiv="x-ua-compatible" content="ie=edge"><title>AlloyTeam ESLint 规则</title><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="shortcut icon" type="image/png" href="alloy.f4abfc6f.png"><link rel="stylesheet" href="site.127e0b37.css"></head><body> <div id="app"></div> <script src="site.08fcf7bc.js"></script> </body></html> | ||
<html><head><meta charset="utf-8"><meta http-equiv="x-ua-compatible" content="ie=edge"><title>AlloyTeam ESLint 规则</title><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="shortcut icon" type="image/png" href="alloy.f4abfc6f.png"><link rel="stylesheet" href="site.127e0b37.css"></head><body> <div id="app"></div> <script src="site.8cf4e64e.js"></script> </body></html> |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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,10 @@ | ||
module.exports = { | ||
rules: { | ||
/** | ||
* 函数参数之间的换行模式必须保持一致 | ||
* @category Possible Errors | ||
* @fixable | ||
*/ | ||
'function-call-argument-newline': ['error', 'consistent'] | ||
} | ||
}; |
This file contains 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,2 @@ | ||
foo('one', 'two', | ||
'three'); |
This file contains 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,6 @@ | ||
foo('one', 'two', 'three'); | ||
bar( | ||
'one', | ||
'two', | ||
'three' | ||
); |
This file contains 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,16 @@ | ||
module.exports = { | ||
rules: { | ||
/** | ||
* 类型断言必须使用 as Type,禁止使用 <Type>,禁止对对象字面量进行类型断言(断言成 any 是允许的) | ||
* @category TypeScript | ||
* @reason <Type> 容易被理解为 jsx | ||
*/ | ||
'@typescript-eslint/consistent-type-assertions': [ | ||
'error', | ||
{ | ||
assertionStyle: 'as', | ||
objectLiteralTypeAssertions: 'never' | ||
} | ||
] | ||
} | ||
}; |
4 changes: 4 additions & 0 deletions
4
...pt/no-angle-bracket-type-assertion/bad.ts → ...escript/consistent-type-assertions/bad.ts
This file contains 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 |
---|---|---|
@@ -1,2 +1,6 @@ | ||
let bar1: string | number; | ||
const foo1 = <string>bar1; | ||
|
||
const baz1 = { | ||
bar: 1 | ||
} as object; |
4 changes: 4 additions & 0 deletions
4
...t/no-angle-bracket-type-assertion/good.ts → ...script/consistent-type-assertions/good.ts
This file contains 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 |
---|---|---|
@@ -1,2 +1,6 @@ | ||
let bar2: string | number; | ||
const foo2 = bar2 as string; | ||
|
||
const baz2 = { | ||
bar: 1 | ||
} as any; |
File renamed without changes.
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 0 additions & 10 deletions
10
test/typescript/no-angle-bracket-type-assertion/.eslintrc.js
This file was deleted.
Oops, something went wrong.
This file contains 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,10 @@ | ||
module.exports = { | ||
rules: { | ||
/** | ||
* 避免错误的使用 Promise | ||
* @category TypeScript | ||
* @requires-types-information | ||
*/ | ||
'@typescript-eslint/no-misused-promises': 'off' | ||
} | ||
}; |
9 changes: 0 additions & 9 deletions
9
test/typescript/no-object-literal-type-assertion/.eslintrc.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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,10 @@ | ||
module.exports = { | ||
rules: { | ||
/** | ||
* 私有变量如果没有在构造函数外被赋值,则必须设为 readonly | ||
* @category TypeScript | ||
* @requires-types-information | ||
*/ | ||
'@typescript-eslint/prefer-readonly': 'off' | ||
} | ||
}; |
This file contains 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,10 @@ | ||
module.exports = { | ||
rules: { | ||
/** | ||
* async 函数中必须存在 await 语句 | ||
* @category TypeScript | ||
* @requires-types-information | ||
*/ | ||
'@typescript-eslint/require-await': 'off' | ||
} | ||
}; |
This file contains 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,10 @@ | ||
module.exports = { | ||
rules: { | ||
/** | ||
* 条件判断必须传入布尔值 | ||
* @category TypeScript | ||
* @requires-types-information | ||
*/ | ||
'@typescript-eslint/strict-boolean-expressions': 'off' | ||
} | ||
}; |
This file contains 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,13 @@ | ||
module.exports = { | ||
rules: { | ||
/** | ||
* 禁止使用三斜杠导入文件 | ||
* @category TypeScript | ||
* @reason 三斜杠是已废弃的语法,但在类型声明文件中还是可以使用的 | ||
*/ | ||
'@typescript-eslint/triple-slash-reference': [ | ||
'error', | ||
{ path: 'never', types: 'always', lib: 'always' } | ||
] | ||
} | ||
}; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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,20 @@ | ||
module.exports = { | ||
rules: { | ||
/** | ||
* interface 和 type 定义时必须声明成员的类型 | ||
* @category TypeScript | ||
*/ | ||
'@typescript-eslint/typedef': [ | ||
'error', | ||
{ | ||
arrayDestructuring: false, | ||
arrowParameter: false, | ||
memberVariableDeclaration: false, | ||
objectDestructuring: false, | ||
parameter: false, | ||
propertyDeclaration: true, | ||
variableDeclaration: false | ||
} | ||
] | ||
} | ||
}; |
This file contains 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,4 @@ | ||
type Foo1 = { | ||
bar; | ||
baz; | ||
}; |
This file contains 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,4 @@ | ||
type Foo2 = { | ||
bar: boolean; | ||
baz: string; | ||
}; |
File renamed without changes.
Oops, something went wrong.