Skip to content

Commit 21a02be

Browse files
committed
improve(eslint-config-ts-lib): 改进执行 lint 的速度
1 parent 922787f commit 21a02be

File tree

191 files changed

+6065
-919
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+6065
-919
lines changed

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
build

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# 变更说明
22

3+
## 0.14.4
4+
5+
- improve(eslint-config-ts-lib): 改进执行 lint 的速度
6+
- fix(eslint-config-ts-lib): 修复 prettier 和 eslint 规则冲突的缺陷
7+
- breadchange(eslint-config-ts-lib): 增加 jsdoc 和 typescript 类型显式声明的规则
8+
- improve(ts-lib-scripts): 启用 eslint 的缓存
9+
310
## v0.14.3 - 2021.8.19
411

512
- fix(ts-lib-tools): 修复打包时包含了 jest 的 `__snapshots__` 目录的缺陷

e2e/eslint/class-use-this.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export class Demo {
2+
method_a(): any {
3+
return this.method_a;
4+
}
5+
}

e2e/eslint/method-reassign.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* 累加
3+
*
4+
* @param acc 累加值
5+
* @param item 需要合并的项
6+
*/
7+
export function reduce(acc: Record<string, string>, item: string): void {
8+
acc[item] = '123';
9+
}

e2e/jest-resolver-tsconfig-paths/__tests__/module-a.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import k from '@test/module-a/k';
21
import moduleA from '@test/module-a';
2+
import k from '@test/module-a/k';
33

44
it('module-a', () => {
55
expect(k).toBeDefined();
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
export default function a() {
1+
/**
2+
* 测试函数
3+
*/
4+
export default function a(): string {
25
return 'x';
36
}

examples/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"lint-staged": "^8.1.7",
2020
"react": "^16.8.6",
2121
"rimraf": "^2.6.3",
22-
"typescript": "^4.3.5"
22+
"typescript": "^4.4.2"
2323
},
2424
"prettier": {
2525
"printWidth": 80,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"husky": "^4.2.5",
2222
"lerna": "^3.16.4",
2323
"lint-staged": "^8.1.7",
24-
"typescript": "^4.3.5",
24+
"typescript": "^4.4.2",
2525
"typescript-plugin-css-modules": "^3.4.0"
2626
},
2727
"eslintConfig": {

packages/babel-preset-ts-lib/create.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ module.exports = function create(_api, _opts, env) {
1616
},
1717
},
1818
],
19-
// eslint-disable-next-line prettier/prettier
2019
isEnvProduction && [
2120
require('@babel/preset-env').default,
2221
{
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { transform, TransformOptions } from '@babel/core';
1+
import type { TransformOptions } from '@babel/core';
2+
import { transform } from '@babel/core';
3+
24
import tsLibBabelPreset from '../index';
35

46
const transformOptions: TransformOptions = {
@@ -8,9 +10,10 @@ const transformOptions: TransformOptions = {
810

911
/**
1012
* 编译源码
13+
*
1114
* @param source 源码
1215
*/
13-
export default function buildSource(source: string) {
16+
export default function buildSource(source: string): string {
1417
const babelFileResult = transform(source, transformOptions);
1518
return babelFileResult.code;
1619
}

0 commit comments

Comments
 (0)