Skip to content

Commit 474b864

Browse files
committed
improve(ts-lib-tools): 升级 @babel/core 到 7.17.10 版本
1 parent e6ed666 commit 474b864

File tree

16 files changed

+2726
-3796
lines changed

16 files changed

+2726
-3796
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- improve(ts-lib-scripts): 启用 eslint 的缓存
99
- improve(ts-lib-scripts): 升级 husky 和 lint-staged
1010
- fix(ts-lib-tools): 修复在 monorepo 模式下打包之后再执行单元测试,有可能报 `package.json``dist/package.json` 名称相同的冲突
11+
- improve(ts-lib-tools): 升级 @babel/core 到 7.17.10 版本
1112

1213
## v0.14.3 - 2021.8.19
1314

e2e/jest-css-transform-demo/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
"react-dom": "17.0.2",
1010
"ts-lib-tools": "^0.14.3"
1111
},
12+
"devDependencies": {
13+
"@testing-library/jest-dom": "^5.16.4",
14+
"@testing-library/react": "^12.0.0",
15+
"react-dom": "^17.0.0"
16+
},
1217
"scripts": {
1318
"test": "ts-lib-tools test"
1419
},
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/**
2+
* @jest-environment jsdom
3+
*/
4+
import '@testing-library/jest-dom/extend-expect';
5+
6+
import { render } from '@testing-library/react';
7+
18
import Button from './Button';
29

310
it('验证button组件存在', () => expect(Button).toBeDefined());
11+
12+
it('按钮标题', () => {
13+
const { getByTestId } = render(<Button data-testid="button">标题</Button>);
14+
15+
expect(getByTestId('button')).toHaveTextContent('标题');
16+
});
Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1-
import React from 'react';
21
import './Button.css';
32

43
/**
5-
* 用于测试的按钮组件
4+
* 按钮组件属性
65
*/
7-
export default function Button() {
8-
return <div className="button">按钮</div>;
6+
interface ButtonProps {
7+
/**
8+
* 按钮中包含的元素
9+
*/
10+
children?: React.ReactNode;
911
}
12+
13+
/**
14+
* 用于测试的按钮组件
15+
*
16+
* @param props 属性
17+
* @param props.children 子元素
18+
*/
19+
const Button: React.FC<ButtonProps> = ({ children, ...rest }) => (
20+
<div className="button" {...rest}>
21+
{children}
22+
</div>
23+
);
24+
25+
export default Button;

e2e/jest-resolver-tsconfig-paths/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"resolver": "jest-resolver-tsconfig-paths"
55
},
66
"dependencies": {
7-
"jest": "^27.2.0"
7+
"jest": "^28.1.0"
88
}
99
}

e2e/jest-resolver-tsconfig-paths/yarn.lock

Lines changed: 960 additions & 2353 deletions
Large diffs are not rendered by default.

packages/babel-preset-ts-lib/package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@
1616
"test": "node ../ts-lib-tools/dist/index.js test"
1717
},
1818
"dependencies": {
19-
"@babel/core": "^7.15.0",
20-
"@babel/plugin-proposal-class-properties": "^7.14.5",
21-
"@babel/plugin-proposal-decorators": "^7.14.5",
22-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
23-
"@babel/plugin-proposal-numeric-separator": "^7.14.5",
24-
"@babel/plugin-proposal-object-rest-spread": "^7.14.7",
25-
"@babel/plugin-proposal-optional-chaining": "^7.14.5",
26-
"@babel/plugin-proposal-private-methods": "^7.14.5",
27-
"@babel/plugin-proposal-private-property-in-object": "^7.14.5",
19+
"@babel/core": "^7.17.10",
20+
"@babel/plugin-proposal-class-properties": "^7.16.7",
21+
"@babel/plugin-proposal-decorators": "^7.17.9",
22+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
23+
"@babel/plugin-proposal-numeric-separator": "^7.16.7",
24+
"@babel/plugin-proposal-object-rest-spread": "^7.17.3",
25+
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
26+
"@babel/plugin-proposal-private-methods": "^7.16.11",
27+
"@babel/plugin-proposal-private-property-in-object": "^7.16.7",
2828
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
29-
"@babel/plugin-transform-runtime": "^7.15.0",
29+
"@babel/plugin-transform-runtime": "^7.17.10",
3030
"@babel/polyfill": "^7.12.1",
31-
"@babel/preset-env": "^7.15.0",
32-
"@babel/preset-react": "^7.14.5",
33-
"@babel/preset-typescript": "^7.15.0",
34-
"@babel/runtime": "^7.14.8",
31+
"@babel/preset-env": "^7.17.10",
32+
"@babel/preset-react": "^7.16.7",
33+
"@babel/preset-typescript": "^7.16.7",
34+
"@babel/runtime": "^7.17.9",
3535
"@types/babel__core": "^7.1.15",
3636
"babel-plugin-annotate-pure-calls": "^0.4.0",
3737
"babel-plugin-dev-expression": "^0.2.2",

packages/eslint-config-ts-lib/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ module.exports = {
8989
'jsdoc/require-property-type': 'off',
9090
'jsdoc/require-returns': 'off',
9191
'@typescript-eslint/no-explicit-any': 'off',
92+
'react/prop-types': 'off',
9293
'jsdoc/require-jsdoc': [
9394
'error',
9495
{
@@ -104,6 +105,12 @@ module.exports = {
104105
},
105106
},
106107
],
108+
'jsdoc/check-tag-names': [
109+
'warn',
110+
{
111+
definedTags: ['jest-environment'],
112+
},
113+
],
107114
...varRules,
108115
},
109116
settings: {
@@ -131,6 +138,8 @@ module.exports = {
131138
'*/tests/*.js',
132139
'*/tests/*.ts',
133140
'*/tests/*.tsx',
141+
'*.stories.tsx',
142+
'*/stories/*',
134143
],
135144
env: {
136145
jest: true,

packages/eslint-config-ts-lib/scripts/getEslintRecommendedRules.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export default function getEslintRecommendedRules(): Observable<EsLintRule> {
5454

5555
return enRules$.pipe(
5656
combineLatestWith(zhRules$),
57-
mergeMap(([enRules, zhRules]) => {
58-
return enRules.map((rule) => {
57+
mergeMap(([enRules, zhRules]) =>
58+
enRules.map((rule) => {
5959
const zhRule = zhRules.find((item) => item.name === rule.name);
6060
if (zhRule) {
6161
return {
@@ -67,7 +67,7 @@ export default function getEslintRecommendedRules(): Observable<EsLintRule> {
6767
};
6868
}
6969
return rule;
70-
});
71-
}),
70+
}),
71+
),
7272
);
7373
}

packages/jest-resolver-tsconfig-paths/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
"tsconfig-paths": "^3.9.0"
2121
},
2222
"devDependencies": {
23-
"@types/jest": "^27.0.1"
23+
"@types/jest": "^27.5.0"
2424
}
2525
}

0 commit comments

Comments
 (0)