提交 92663374f06b6e2b82cc4c8de6bf7b2b67457d5a

作者 陈帅
提交者 chencheng (云谦)
1 个父辈 70d4167a

feat: add-table (#54)

* feat: add-table

* add engines

* update doc
1 module.exports = { 1 module.exports = {
2 - parser: 'babel-eslint',  
3 - extends: ['airbnb', 'prettier', 'plugin:compat/recommended'],  
4 - env: {  
5 - browser: true,  
6 - node: true,  
7 - es6: true,  
8 - mocha: true,  
9 - jest: true,  
10 - jasmine: true,  
11 - },  
12 - globals: {  
13 - APP_TYPE: true,  
14 - page: true,  
15 - }, 2 + extends: [require.resolve('@umijs/fabric/dist/eslint')],
16 rules: { 3 rules: {
17 - 'import/prefer-default-export': 0,  
18 - 'react/jsx-filename-extension': [1, { extensions: ['.js'] }],  
19 - 'react/jsx-wrap-multilines': 0,  
20 - 'react/prop-types': 0,  
21 - 'react/forbid-prop-types': 0,  
22 - 'react/jsx-one-expression-per-line': 0,  
23 - 'import/no-unresolved': 0,  
24 - 'import/no-extraneous-dependencies': [  
25 - 2,  
26 - {  
27 - optionalDependencies: true,  
28 - devDependencies: ['**/tests/**.js', '/mock/**.js', '**/**.test.js', '**/_scripts/*.js'],  
29 - },  
30 - ],  
31 - 'jsx-a11y/no-noninteractive-element-interactions': 0,  
32 - 'jsx-a11y/click-events-have-key-events': 0,  
33 - 'jsx-a11y/no-static-element-interactions': 0,  
34 - 'jsx-a11y/anchor-is-valid': 0,  
35 - 'linebreak-style': 0,  
36 - },  
37 - settings: {  
38 - polyfills: ['fetch', 'promises', 'url'], 4 + 'import/no-extraneous-dependencies': 0,
39 }, 5 },
40 }; 6 };
1 -  
2 export default { 1 export default {
3 plugins: [ 2 plugins: [
4 - ['umi-plugin-block-dev', {  
5 - layout: process.env.LAYOUT || 'ant-design-pro',  
6 - menu: {  
7 - name: process.env.BLOCK,  
8 - icon: 'home', 3 + [
  4 + 'umi-plugin-block-dev',
  5 + {
  6 + layout: process.env.LAYOUT || 'ant-design-pro',
  7 + menu: {
  8 + name: process.env.BLOCK,
  9 + icon: 'home',
  10 + },
9 }, 11 },
10 - }],  
11 - ['umi-plugin-react', {  
12 - 'dva': true,  
13 - 'antd': true,  
14 - }],  
15 - require.resolve('./plugin'), 12 + ],
  13 + [
  14 + 'umi-plugin-react',
  15 + {
  16 + dva: true,
  17 + antd: true,
  18 + },
  19 + ],
  20 + // require.resolve('./plugin'),
16 ], 21 ],
17 }; 22 };
@@ -15,7 +15,7 @@ $ yarn @@ -15,7 +15,7 @@ $ yarn
15 > Specify the block via BLOCK env. 15 > Specify the block via BLOCK env.
16 16
17 ```bash 17 ```bash
18 -$ BLOCK=templates/user-dashboard yarn start 18 + yarn start templates/user-dashboard
19 ``` 19 ```
20 20
21 ### Create Block 21 ### Create Block
@@ -17,7 +17,7 @@ class BlockGenerator extends Generator { @@ -17,7 +17,7 @@ class BlockGenerator extends Generator {
17 this.destinationPath(file.replace(/^_/, '.')), 17 this.destinationPath(file.replace(/^_/, '.')),
18 { 18 {
19 name: process.env.BLOCK.split('/')[1], 19 name: process.env.BLOCK.split('/')[1],
20 - }, 20 + }
21 ); 21 );
22 } 22 }
23 }); 23 });
@@ -33,7 +33,7 @@ function haveImport(cwd, name) { @@ -33,7 +33,7 @@ function haveImport(cwd, name) {
33 function parseJSON(root) { 33 function parseJSON(root) {
34 const dirs = readdirSync(root); 34 const dirs = readdirSync(root);
35 const type = basename(root); 35 const type = basename(root);
36 - const list = dirs.reduce((memo, dir) => { 36 + const list = dirs.reduce((memo = [], dir) => {
37 if (dir.charAt(0) === '.') return; 37 if (dir.charAt(0) === '.') return;
38 const absDirPath = join(root, dir); 38 const absDirPath = join(root, dir);
39 const pkg = require(join(absDirPath, 'package.json')); 39 const pkg = require(join(absDirPath, 'package.json'));
@@ -69,11 +69,7 @@ function generate(root) { @@ -69,11 +69,7 @@ function generate(root) {
69 mkdirp.sync(dist); 69 mkdirp.sync(dist);
70 70
71 const json = parseJSON(root); 71 const json = parseJSON(root);
72 - writeFileSync(  
73 - join(dist, `${type}.json`),  
74 - JSON.stringify(json, null, 2),  
75 - 'utf-8',  
76 - ); 72 + writeFileSync(join(dist, `${type}.json`), JSON.stringify(json, null, 2), 'utf-8');
77 } 73 }
78 74
79 generate(join(__dirname, '..', 'templates')); 75 generate(join(__dirname, '..', 'templates'));
@@ -24,4 +24,3 @@ const generator = new BlockGenerator({ @@ -24,4 +24,3 @@ const generator = new BlockGenerator({
24 generator.run(() => { 24 generator.run(() => {
25 console.log('done'); 25 console.log('done');
26 }); 26 });
27 -  
@@ -32,7 +32,9 @@ files.forEach(file => { @@ -32,7 +32,9 @@ files.forEach(file => {
32 }; 32 };
33 const isPrettier = prettier.check(input, withParserOptions); 33 const isPrettier = prettier.check(input, withParserOptions);
34 if (!isPrettier) { 34 if (!isPrettier) {
35 - console.log(`\x1b[31m ${file} is no prettier, please use npm run prettier and git add !\x1b[0m`); 35 + console.log(
  36 + `\x1b[31m ${file} is no prettier, please use npm run prettier and git add !\x1b[0m`
  37 + );
36 didWarn = true; 38 didWarn = true;
37 } 39 }
38 } catch (e) { 40 } catch (e) {
不能预览此文件类型
@@ -3,5 +3,5 @@ import { Button } from 'antd'; @@ -3,5 +3,5 @@ import { Button } from 'antd';
3 import styles from './index.less'; 3 import styles from './index.less';
4 4
5 export default () => { 5 export default () => {
6 - return <Button className={styles.container}>Hello UmiJS!</Button>  
7 -} 6 + return <Button className={styles.container}>Hello UmiJS!</Button>;
  7 +};
1 -  
2 .wrapper { 1 .wrapper {
3 display: flex; 2 display: flex;
4 min-height: 100vh; 3 min-height: 100vh;
5 flex-direction: column; 4 flex-direction: column;
6 5
7 - header, footer { 6 + header,
  7 + footer {
8 background: #82caff; 8 background: #82caff;
9 flex: 0 0 6em; 9 flex: 0 0 6em;
10 } 10 }
@@ -19,7 +19,8 @@ @@ -19,7 +19,8 @@
19 flex: 1; 19 flex: 1;
20 background: #fecccc; 20 background: #fecccc;
21 } 21 }
22 - aside, nav { 22 + aside,
  23 + nav {
23 flex: 0 0 12em; 24 flex: 0 0 12em;
24 background: #c9c; 25 background: #c9c;
25 } 26 }
  1 +{
  2 + "name": "table",
  3 + "description": "查询表格是每一个项目都需要的基本页面。",
  4 + "dependencies": {
  5 + "@ant-design/pro-table": "^1.0.31",
  6 + "@umijs/ui-flag": "1.0.2",
  7 + "antd": "^3.10.9"
  8 + },
  9 + "peerDependencies": {
  10 + "react": "^16.8.6",
  11 + "react-dom": "^16.8.6"
  12 + },
  13 + "devDependencies": {
  14 + "umi": "^2.13.0"
  15 + }
  16 +}
  1 +import { Button, Divider, Dropdown, Form, Icon, Menu } from 'antd';
  2 +import React, { useState, useRef } from 'react';
  3 +import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table';
  4 +import UmiUIFlag from '@umijs/ui-flag';
  5 +import { FormComponentProps } from 'antd/es/form';
  6 +import { TableListItem, TableListParams } from './typing.d';
  7 +
  8 +export async function queryRule(params?: TableListParams) {
  9 + console.log(params);
  10 + return { data: [], success: true };
  11 +}
  12 +
  13 +const TableList: React.FC<FormComponentProps> = () => {
  14 + const [sorter, setSorter] = useState({});
  15 + const actionRef = useRef<ActionType>();
  16 + const columns: ProColumns<TableListItem>[] = [
  17 + {
  18 + title: '规则名称',
  19 + dataIndex: 'name',
  20 + },
  21 + {
  22 + title: '描述',
  23 + dataIndex: 'desc',
  24 + },
  25 + {
  26 + title: '服务调用次数',
  27 + dataIndex: 'callNo',
  28 + sorter: true,
  29 + align: 'right',
  30 + renderText: (val: string) => `${val} 万`,
  31 + },
  32 + {
  33 + title: '状态',
  34 + dataIndex: 'status',
  35 + valueEnum: {
  36 + 0: { text: '关闭', status: 'Default' },
  37 + 1: { text: '运行中', status: 'Processing' },
  38 + 2: { text: '已上线', status: 'Success' },
  39 + 3: { text: '异常', status: 'Error' },
  40 + },
  41 + },
  42 + {
  43 + title: '上次调度时间',
  44 + dataIndex: 'updatedAt',
  45 + sorter: true,
  46 + valueType: 'dateTime',
  47 + },
  48 + {
  49 + title: '操作',
  50 + dataIndex: 'option',
  51 + valueType: 'option',
  52 + render: () => (
  53 + <>
  54 + <a>配置</a>
  55 + <Divider type="vertical" />
  56 + <a href="">订阅警报</a>
  57 + </>
  58 + ),
  59 + },
  60 + ];
  61 +
  62 + return (
  63 + <ProTable<TableListItem>
  64 + headerTitle="查询表格"
  65 + actionRef={actionRef}
  66 + rowKey="key"
  67 + onChange={(_, _filter, _sorter) => {
  68 + setSorter(`${_sorter.field}_${_sorter.order}`);
  69 + }}
  70 + params={{
  71 + sorter,
  72 + }}
  73 + toolBarRender={(action, { selectedRows }) => [
  74 + <>
  75 + <UmiUIFlag />
  76 + </>,
  77 + <Button icon="plus" type="primary">
  78 + 新建
  79 + </Button>,
  80 + selectedRows && selectedRows.length > 0 && (
  81 + <Dropdown
  82 + overlay={
  83 + <Menu
  84 + onClick={async e => {
  85 + if (e.key === 'remove') {
  86 + console.log('remove');
  87 + action.reload();
  88 + }
  89 + }}
  90 + selectedKeys={[]}
  91 + >
  92 + <Menu.Item key="remove">批量删除</Menu.Item>
  93 + <Menu.Item key="approval">批量审批</Menu.Item>
  94 + </Menu>
  95 + }
  96 + >
  97 + <Button>
  98 + 批量操作 <Icon type="down" />
  99 + </Button>
  100 + </Dropdown>
  101 + ),
  102 + ]}
  103 + tableAlertRender={(selectedRowKeys, selectedRows) => (
  104 + <div>
  105 + 已选择 <a style={{ fontWeight: 600 }}>{selectedRowKeys.length}</a> 项&nbsp;&nbsp;
  106 + <span>
  107 + 服务调用次数总计 {selectedRows.reduce((pre, item) => pre + item.callNo, 0)} 万
  108 + </span>
  109 + </div>
  110 + )}
  111 + request={params => queryRule(params)}
  112 + columns={columns}
  113 + />
  114 + );
  115 +};
  116 +
  117 +export default Form.create<FormComponentProps>()(TableList);
  1 +export interface TableListItem {
  2 + key: number;
  3 + disabled?: boolean;
  4 + href: string;
  5 + avatar: string;
  6 + name: string;
  7 + title: string;
  8 + owner: string;
  9 + desc: string;
  10 + callNo: number;
  11 + status: number;
  12 + updatedAt: Date;
  13 + createdAt: Date;
  14 + progress: number;
  15 +}
  16 +
  17 +export interface TableListParams {
  18 + sorter?: string;
  19 + status?: string;
  20 + name?: string;
  21 + desc?: string;
  22 + key?: number;
  23 + pageSize?: number;
  24 + currentPage?: number;
  25 +}
1 { 1 {
2 "private": true, 2 "private": true,
3 "scripts": { 3 "scripts": {
4 - "start": "UMI_UI=none umi dev",  
5 - "lint:style": "stylelint \"src/**/*.less\" --syntax less", 4 + "build": "node ./_scripts/build.js",
  5 + "create": "node ./_scripts/create.js",
6 "lint": "eslint --ext .js src mock tests && npm run lint:style", 6 "lint": "eslint --ext .js src mock tests && npm run lint:style",
7 - "lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style",  
8 "lint-staged": "lint-staged", 7 "lint-staged": "lint-staged",
9 "lint-staged:js": "eslint --ext .js", 8 "lint-staged:js": "eslint --ext .js",
10 - "prettier": "node ./_scripts/prettier.js",  
11 - "build": "node ./_scripts/build.js",  
12 - "create": "node ./_scripts/create.js" 9 + "lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style",
  10 + "lint:style": "stylelint \"src/**/*.less\" --syntax less",
  11 + "prettier": "prettier -c --write \"**/*\"",
  12 + "screenshot": "pro screenshot",
  13 + "start": "umi block_dev"
13 }, 14 },
14 - "devDependencies": {  
15 - "@ant-design/pro-layout": "^4.5.16",  
16 - "babel-eslint": "^10.0.1",  
17 - "eslint": "^5.4.0",  
18 - "eslint-config-airbnb": "^17.0.0",  
19 - "eslint-config-prettier": "^3.0.1",  
20 - "eslint-plugin-babel": "^5.3.0",  
21 - "eslint-plugin-compat": "^2.6.2",  
22 - "eslint-plugin-import": "^2.14.0",  
23 - "eslint-plugin-jsx-a11y": "^6.1.2",  
24 - "eslint-plugin-markdown": "^1.0.0-beta.6",  
25 - "eslint-plugin-react": "^7.11.1",  
26 - "glob": "^7.1.4",  
27 - "husky": "^1.2.0",  
28 - "lint-staged": "^8.1.0",  
29 - "mkdirp": "^0.5.1",  
30 - "prettier": "1.15.2",  
31 - "stylelint": "^9.8.0",  
32 - "stylelint-config-prettier": "^4.0.0",  
33 - "stylelint-config-standard": "^18.0.0",  
34 - "umi": "^2.3.0-0",  
35 - "umi-plugin-block-dev": "^2.0.0",  
36 - "umi-plugin-react": "^1.3.0-0",  
37 - "umi-request": "^1.2.6",  
38 - "yeoman-generator": "^4.1.0" 15 + "husky": {
  16 + "hooks": {
  17 + "pre-commit": "npm run lint-staged"
  18 + }
39 }, 19 },
40 "lint-staged": { 20 "lint-staged": {
  21 + "**/*.less": "stylelint --syntax less",
  22 + "x/**/*.{js,jsx}": "npm run lint-staged:js",
41 "x/**/*.{js,ts,tsx,json,jsx,less}": [ 23 "x/**/*.{js,ts,tsx,json,jsx,less}": [
42 "node ./_scripts/lint-prettier.js", 24 "node ./_scripts/lint-prettier.js",
43 "git add" 25 "git add"
44 - ],  
45 - "x/**/*.{js,jsx}": "npm run lint-staged:js",  
46 - "**/*.less": "stylelint --syntax less" 26 + ]
47 }, 27 },
48 - "husky": {  
49 - "hooks": {  
50 - "pre-commit": "npm run lint-staged"  
51 - } 28 + "devDependencies": {
  29 + "@ant-design/pro-cli": "^1.0.5",
  30 + "@ant-design/pro-layout": "^4.5.16",
  31 + "@umijs/fabric": "^2.0.0",
  32 + "cross-env": "^6.0.0",
  33 + "eslint": "^6.8.0",
  34 + "glob": "^7.1.4",
  35 + "husky": "^4.0.7",
  36 + "import-sort-cli": "^6.0.0",
  37 + "import-sort-parser-babylon": "^6.0.0",
  38 + "import-sort-parser-typescript": "^6.0.0",
  39 + "import-sort-style-module": "^6.0.0",
  40 + "lint-staged": "^9.5.0",
  41 + "mkdirp": "^0.5.1",
  42 + "prettier": "1.19.1",
  43 + "stylelint": "^13.0.0",
  44 + "stylelint-config-prettier": "^8.0.0",
  45 + "stylelint-config-standard": "^19.0.0",
  46 + "typescript": "^3.5.1",
  47 + "umi": "^2.13.0",
  48 + "umi-plugin-block-dev": "^3.0.1",
  49 + "umi-plugin-react": "^1.15.0",
  50 + "umi-request": "^1.2.17",
  51 + "yeoman-generator": "^4.1.0"
  52 + },
  53 + "engines": {
  54 + "node": "12.x"
52 } 55 }
53 } 56 }
@@ -35,7 +35,7 @@ function getRoute() { @@ -35,7 +35,7 @@ function getRoute() {
35 }; 35 };
36 } 36 }
37 37
38 -export default (api) => { 38 +export default api => {
39 api.modifyRoutes(routes => { 39 api.modifyRoutes(routes => {
40 routes[0].routes = [ 40 routes[0].routes = [
41 getRoute(), 41 getRoute(),
1 -  
2 const PAGE_SIZE = 3; 1 const PAGE_SIZE = 3;
3 let data = [ 2 let data = [
4 { 3 {
5 - "id": 1,  
6 - "name": "Leanne Graham",  
7 - "email": "Sincere@april.biz",  
8 - "website": "hildegard.org", 4 + id: 1,
  5 + name: 'Leanne Graham',
  6 + email: 'Sincere@april.biz',
  7 + website: 'hildegard.org',
9 }, 8 },
10 { 9 {
11 - "id": 2,  
12 - "name": "Ervin Howell",  
13 - "email": "Shanna@melissa.tv",  
14 - "website": "anastasia.net", 10 + id: 2,
  11 + name: 'Ervin Howell',
  12 + email: 'Shanna@melissa.tv',
  13 + website: 'anastasia.net',
15 }, 14 },
16 { 15 {
17 - "id": 3,  
18 - "name": "Clementine Bauch",  
19 - "email": "Nathan@yesenia.net",  
20 - "website": "ramiro.info", 16 + id: 3,
  17 + name: 'Clementine Bauch',
  18 + email: 'Nathan@yesenia.net',
  19 + website: 'ramiro.info',
21 }, 20 },
22 { 21 {
23 - "id": 4,  
24 - "name": "Patricia Lebsack",  
25 - "email": "Julianne.OConner@kory.org",  
26 - "website": "kale.biz", 22 + id: 4,
  23 + name: 'Patricia Lebsack',
  24 + email: 'Julianne.OConner@kory.org',
  25 + website: 'kale.biz',
27 }, 26 },
28 { 27 {
29 - "id": 5,  
30 - "name": "Chelsey Dietrich",  
31 - "email": "Lucio_Hettinger@annie.ca",  
32 - "website": "demarco.info", 28 + id: 5,
  29 + name: 'Chelsey Dietrich',
  30 + email: 'Lucio_Hettinger@annie.ca',
  31 + website: 'demarco.info',
33 }, 32 },
34 { 33 {
35 - "id": 6,  
36 - "name": "Mrs. Dennis Schulist",  
37 - "email": "Karley_Dach@jasper.info",  
38 - "website": "ola.org", 34 + id: 6,
  35 + name: 'Mrs. Dennis Schulist',
  36 + email: 'Karley_Dach@jasper.info',
  37 + website: 'ola.org',
39 }, 38 },
40 { 39 {
41 - "id": 7,  
42 - "name": "Kurtis Weissnat",  
43 - "email": "Telly.Hoeger@billy.biz",  
44 - "website": "elvis.io", 40 + id: 7,
  41 + name: 'Kurtis Weissnat',
  42 + email: 'Telly.Hoeger@billy.biz',
  43 + website: 'elvis.io',
45 }, 44 },
46 { 45 {
47 - "id": 8,  
48 - "name": "Nicholas Runolfsdottir V",  
49 - "email": "Sherwood@rosamond.me",  
50 - "website": "jacynthe.com", 46 + id: 8,
  47 + name: 'Nicholas Runolfsdottir V',
  48 + email: 'Sherwood@rosamond.me',
  49 + website: 'jacynthe.com',
51 }, 50 },
52 { 51 {
53 - "id": 9,  
54 - "name": "Glenna Reichert",  
55 - "email": "Chaim_McDermott@dana.io",  
56 - "website": "conrad.com", 52 + id: 9,
  53 + name: 'Glenna Reichert',
  54 + email: 'Chaim_McDermott@dana.io',
  55 + website: 'conrad.com',
57 }, 56 },
58 ]; 57 ];
59 58
60 function uid(len) { 59 function uid(len) {
61 len = len || 7; 60 len = len || 7;
62 - return Math.random().toString(35).substr(2, len); 61 + return Math.random()
  62 + .toString(35)
  63 + .substr(2, len);
63 } 64 }
64 65
65 function getData(page) { 66 function getData(page) {
@@ -11,7 +11,7 @@ class UserEditModal extends Component { @@ -11,7 +11,7 @@ class UserEditModal extends Component {
11 }; 11 };
12 } 12 }
13 13
14 - showModelHandler = (e) => { 14 + showModelHandler = e => {
15 if (e) e.stopPropagation(); 15 if (e) e.stopPropagation();
16 this.setState({ 16 this.setState({
17 visible: true, 17 visible: true,
@@ -45,9 +45,7 @@ class UserEditModal extends Component { @@ -45,9 +45,7 @@ class UserEditModal extends Component {
45 45
46 return ( 46 return (
47 <span> 47 <span>
48 - <span onClick={this.showModelHandler}>  
49 - { children }  
50 - </span> 48 + <span onClick={this.showModelHandler}>{children}</span>
51 <Modal 49 <Modal
52 title="Edit User" 50 title="Edit User"
53 visible={this.state.visible} 51 visible={this.state.visible}
@@ -55,35 +53,20 @@ class UserEditModal extends Component { @@ -55,35 +53,20 @@ class UserEditModal extends Component {
55 onCancel={this.hideModelHandler} 53 onCancel={this.hideModelHandler}
56 > 54 >
57 <Form horizontal onSubmit={this.okHandler}> 55 <Form horizontal onSubmit={this.okHandler}>
58 - <FormItem  
59 - {...formItemLayout}  
60 - label="Name"  
61 - >  
62 - {  
63 - getFieldDecorator('name', {  
64 - initialValue: name,  
65 - })(<Input />)  
66 - } 56 + <FormItem {...formItemLayout} label="Name">
  57 + {getFieldDecorator('name', {
  58 + initialValue: name,
  59 + })(<Input />)}
67 </FormItem> 60 </FormItem>
68 - <FormItem  
69 - {...formItemLayout}  
70 - label="Email"  
71 - >  
72 - {  
73 - getFieldDecorator('email', {  
74 - initialValue: email,  
75 - })(<Input />)  
76 - } 61 + <FormItem {...formItemLayout} label="Email">
  62 + {getFieldDecorator('email', {
  63 + initialValue: email,
  64 + })(<Input />)}
77 </FormItem> 65 </FormItem>
78 - <FormItem  
79 - {...formItemLayout}  
80 - label="Website"  
81 - >  
82 - {  
83 - getFieldDecorator('website', {  
84 - initialValue: website,  
85 - })(<Input />)  
86 - } 66 + <FormItem {...formItemLayout} label="Website">
  67 + {getFieldDecorator('website', {
  68 + initialValue: website,
  69 + })(<Input />)}
87 </FormItem> 70 </FormItem>
88 </Form> 71 </Form>
89 </Modal> 72 </Modal>
1 -  
2 .normal { 1 .normal {
3 } 2 }
4 3
5 .operation a { 4 .operation a {
6 - margin: 0 .5em; 5 + margin: 0 0.5em;
7 } 6 }
8 7
9 .create { 8 .create {
1 -  
2 export const PAGE_SIZE = 3; 1 export const PAGE_SIZE = 3;
@@ -2,8 +2,8 @@ @@ -2,8 +2,8 @@
2 "compilerOptions": { 2 "compilerOptions": {
3 "outDir": "build/dist", 3 "outDir": "build/dist",
4 "module": "esnext", 4 "module": "esnext",
5 - "target": "es2016",  
6 - "lib": ["es6", "dom"], 5 + "target": "esnext",
  6 + "lib": ["esnext", "dom"],
7 "sourceMap": true, 7 "sourceMap": true,
8 "baseUrl": ".", 8 "baseUrl": ".",
9 "jsx": "react", 9 "jsx": "react",
@@ -15,21 +15,13 @@ @@ -15,21 +15,13 @@
15 "suppressImplicitAnyIndexErrors": true, 15 "suppressImplicitAnyIndexErrors": true,
16 "noUnusedLocals": true, 16 "noUnusedLocals": true,
17 "allowJs": true, 17 "allowJs": true,
  18 + "resolveJsonModule": true,
18 "experimentalDecorators": true, 19 "experimentalDecorators": true,
  20 + "strict": true,
19 "paths": { 21 "paths": {
20 - "@/*": ["./ant-design-pro/*/src/*"] 22 + "@/*": ["./src/*"]
21 } 23 }
22 }, 24 },
23 - "include": ["./ant-design-pro"],  
24 - "exclude": [  
25 - "node_modules",  
26 - "build",  
27 - "scripts",  
28 - "acceptance-tests",  
29 - "webpack",  
30 - "jest",  
31 - "src/setupTests.ts",  
32 - "tslint:latest",  
33 - "tslint-config-prettier"  
34 - ] 25 + "include": [".", "./typings.d"],
  26 + "exclude": ["node_modules", "_scripts", "jest", "tslint:latest", "tslint-config-prettier"]
35 } 27 }
1 -{  
2 - "extends": ["tslint:latest", "tslint-react", "tslint-config-prettier"],  
3 - "rules": {  
4 - "no-var-requires": false,  
5 - "no-submodule-imports": false,  
6 - "object-literal-sort-keys": false,  
7 - "jsx-no-lambda": false,  
8 - "no-implicit-dependencies": false,  
9 - "no-console": false  
10 - }  
11 -}  
  1 +declare module '*.css';
  2 +declare module '*.less';
  3 +declare module '*.scss';
  4 +declare module '*.sass';
  5 +declare module '*.svg';
  6 +declare module '*.png';
  7 +declare module '*.jpg';
  8 +declare module '*.jpeg';
  9 +declare module '*.gif';
  10 +declare module '*.bmp';
  11 +declare module '*.tiff';
  12 +declare module 'mockjs';
  13 +
  14 +declare module '@umijs/ui-flag';
注册登录 后发表评论