@huangjunsen/eslint-config 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +17 -17
- package/.eslintignore +17 -17
- package/.eslintrc.js +5 -5
- package/CHANGELOG.md +7 -0
- package/README.md +0 -286
- package/__tests__/fixtures/es5.js +4 -4
- package/__tests__/fixtures/index.js +3 -3
- package/__tests__/fixtures/node.js +23 -23
- package/__tests__/fixtures/react-display-name.js +7 -7
- package/__tests__/fixtures/react.jsx +132 -132
- package/__tests__/fixtures/ts-import-a.ts +3 -3
- package/__tests__/fixtures/ts-import-b.ts +3 -3
- package/__tests__/fixtures/ts-node.ts +19 -19
- package/__tests__/fixtures/ts-react.tsx +27 -27
- package/__tests__/fixtures/ts-vue.vue +36 -36
- package/__tests__/fixtures/ts.ts +17 -17
- package/__tests__/fixtures/vue.vue +16 -16
- package/__tests__/validate-js-configs.test.js +259 -259
- package/es5.js +10 -10
- package/essential/es5.js +12 -12
- package/essential/index.js +12 -12
- package/essential/react.js +76 -76
- package/essential/rules/blacklist.js +48 -48
- package/essential/rules/es6-blacklist.js +62 -62
- package/essential/rules/set-style-to-warn.js +30 -30
- package/essential/rules/ts-blacklist.js +15 -15
- package/essential/typescript/index.js +7 -7
- package/essential/typescript/react.js +7 -7
- package/essential/typescript/vue.js +9 -9
- package/essential/vue.js +8 -8
- package/flat/index.js +32 -0
- package/flat/react.js +19 -0
- package/flat/typescript.js +15 -0
- package/flat/vue.js +12 -0
- package/index.js +23 -23
- package/jsx-a11y.js +5 -5
- package/node.js +6 -6
- package/package.json +28 -10
- package/react.js +11 -11
- package/rules/base/best-practices.js +284 -284
- package/rules/base/es6.js +168 -168
- package/rules/base/possible-errors.js +126 -126
- package/rules/base/strict.js +6 -6
- package/rules/base/style.js +445 -445
- package/rules/base/variables.js +48 -48
- package/rules/es5.js +11 -11
- package/rules/imports.js +167 -167
- package/rules/jsx-a11y.js +23 -23
- package/rules/node.js +11 -11
- package/rules/react.js +354 -354
- package/rules/vue.js +96 -96
- package/typescript/node.js +6 -6
- package/typescript/react.js +6 -6
- package/typescript/vue.js +10 -10
- package/vue.js +10 -10
- package/LICENSE +0 -21
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import { connect } from 'react-redux';
|
|
3
|
-
import { bindActionCreators } from 'redux';
|
|
4
|
-
import { Breadcrumb, Button, Search, Select, Dropdown, Menu, Notice } from 'antd';
|
|
5
|
-
import Layout from 'layout';
|
|
6
|
-
import { Translate } from 'antd-i18n';
|
|
7
|
-
import * as actions from '../actions/index';
|
|
8
|
-
|
|
9
|
-
const { Nav, Card, Section, Toolbar } = Layout;
|
|
10
|
-
|
|
11
|
-
const ButtonGroup = Button.Group;
|
|
12
|
-
const { Option } = Select;
|
|
13
|
-
|
|
14
|
-
class Root extends Component {
|
|
15
|
-
componentDidMount() {
|
|
16
|
-
this.props.getBreadcrumb();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
onSearch(searchParams) {
|
|
20
|
-
console.log(searchParams);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
onSelectChange(value, data) {
|
|
24
|
-
console.log(value, data);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
onMenuClick(selectedKeys, menuItem, meta) {
|
|
28
|
-
console.log(selectedKeys, menuItem, meta);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
render() {
|
|
32
|
-
const { breadcrumb } = this.props;
|
|
33
|
-
const subNavData = {
|
|
34
|
-
navs: [
|
|
35
|
-
{
|
|
36
|
-
key: 'home',
|
|
37
|
-
text: '导航操作区',
|
|
38
|
-
active: true,
|
|
39
|
-
link: '#',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
key: 'permit',
|
|
43
|
-
text: '权限',
|
|
44
|
-
link: '#',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
key: 'favorite',
|
|
48
|
-
text: '常用链接',
|
|
49
|
-
link: '#',
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<Layout>
|
|
56
|
-
<Nav data={subNavData} />
|
|
57
|
-
<Section>
|
|
58
|
-
<Breadcrumb dataSource={breadcrumb} />
|
|
59
|
-
</Section>
|
|
60
|
-
<Section>
|
|
61
|
-
<Notice title="提示:" type="info">
|
|
62
|
-
页面提示信息区(Notice组件)
|
|
63
|
-
</Notice>
|
|
64
|
-
</Section>
|
|
65
|
-
<Section>
|
|
66
|
-
<Toolbar>
|
|
67
|
-
<Toolbar.Left>
|
|
68
|
-
<Toolbar.Item>
|
|
69
|
-
<Button type="primary">页面操作区</Button>
|
|
70
|
-
</Toolbar.Item>
|
|
71
|
-
<Toolbar.Item>
|
|
72
|
-
<ButtonGroup>
|
|
73
|
-
<Dropdown
|
|
74
|
-
triggerButton={<Button type="normal">批量操作</Button>}
|
|
75
|
-
triggerType="click"
|
|
76
|
-
>
|
|
77
|
-
<Menu onClick={this.onMenuClick}>
|
|
78
|
-
<Menu.Item key="submit_cr">提交发布</Menu.Item>
|
|
79
|
-
<Menu.Item key="close_cr">关闭变更</Menu.Item>
|
|
80
|
-
</Menu>
|
|
81
|
-
</Dropdown>
|
|
82
|
-
<Dropdown triggerButton={<Button type="normal">更多</Button>} triggerType="click">
|
|
83
|
-
<Menu onClick={this.onMenuClick}>
|
|
84
|
-
<Menu.Item key="other_1">更多操作 1</Menu.Item>
|
|
85
|
-
<Menu.Item key="other_2">更多操作 2</Menu.Item>
|
|
86
|
-
<Menu.Item key="other_3">更多操作 3</Menu.Item>
|
|
87
|
-
</Menu>
|
|
88
|
-
</Dropdown>
|
|
89
|
-
</ButtonGroup>
|
|
90
|
-
</Toolbar.Item>
|
|
91
|
-
</Toolbar.Left>
|
|
92
|
-
<Toolbar.Right>
|
|
93
|
-
<Toolbar.Item>
|
|
94
|
-
<Select onChange={this.onSelectChange} defaultValue="default">
|
|
95
|
-
<Option value="default">默认排序</Option>
|
|
96
|
-
<Option value="gmt_create|DESC">按创建时间降序</Option>
|
|
97
|
-
<Option value="gmt_create|ASC">按创建时间升序</Option>
|
|
98
|
-
</Select>
|
|
99
|
-
</Toolbar.Item>
|
|
100
|
-
<Toolbar.Item>
|
|
101
|
-
<Search placeholder="请输入关键词搜索" onSearch={this.onSearch} />
|
|
102
|
-
</Toolbar.Item>
|
|
103
|
-
</Toolbar.Right>
|
|
104
|
-
</Toolbar>
|
|
105
|
-
</Section>
|
|
106
|
-
<Section>
|
|
107
|
-
<Card title="详细内容展示区(Card组件)" extra={<a href="#">更多操作</a>}>
|
|
108
|
-
<p>
|
|
109
|
-
<a
|
|
110
|
-
href="#"
|
|
111
|
-
target="_blank"
|
|
112
|
-
rel="noreferrer noopener"
|
|
113
|
-
>
|
|
114
|
-
点击查看设计规范
|
|
115
|
-
</a>
|
|
116
|
-
</p>
|
|
117
|
-
<p>
|
|
118
|
-
<Button type="primary" onClick={this.props.changeLang}>
|
|
119
|
-
<Translate value="buttonText" />
|
|
120
|
-
</Button>
|
|
121
|
-
</p>
|
|
122
|
-
</Card>
|
|
123
|
-
</Section>
|
|
124
|
-
</Layout>
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export default connect(
|
|
130
|
-
({ index, ...others }) => ({ ...index, ...others }),
|
|
131
|
-
dispatch => bindActionCreators(actions, dispatch)
|
|
132
|
-
)(Root);
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { connect } from 'react-redux';
|
|
3
|
+
import { bindActionCreators } from 'redux';
|
|
4
|
+
import { Breadcrumb, Button, Search, Select, Dropdown, Menu, Notice } from 'antd';
|
|
5
|
+
import Layout from 'layout';
|
|
6
|
+
import { Translate } from 'antd-i18n';
|
|
7
|
+
import * as actions from '../actions/index';
|
|
8
|
+
|
|
9
|
+
const { Nav, Card, Section, Toolbar } = Layout;
|
|
10
|
+
|
|
11
|
+
const ButtonGroup = Button.Group;
|
|
12
|
+
const { Option } = Select;
|
|
13
|
+
|
|
14
|
+
class Root extends Component {
|
|
15
|
+
componentDidMount() {
|
|
16
|
+
this.props.getBreadcrumb();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
onSearch(searchParams) {
|
|
20
|
+
console.log(searchParams);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
onSelectChange(value, data) {
|
|
24
|
+
console.log(value, data);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
onMenuClick(selectedKeys, menuItem, meta) {
|
|
28
|
+
console.log(selectedKeys, menuItem, meta);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
render() {
|
|
32
|
+
const { breadcrumb } = this.props;
|
|
33
|
+
const subNavData = {
|
|
34
|
+
navs: [
|
|
35
|
+
{
|
|
36
|
+
key: 'home',
|
|
37
|
+
text: '导航操作区',
|
|
38
|
+
active: true,
|
|
39
|
+
link: '#',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
key: 'permit',
|
|
43
|
+
text: '权限',
|
|
44
|
+
link: '#',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
key: 'favorite',
|
|
48
|
+
text: '常用链接',
|
|
49
|
+
link: '#',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<Layout>
|
|
56
|
+
<Nav data={subNavData} />
|
|
57
|
+
<Section>
|
|
58
|
+
<Breadcrumb dataSource={breadcrumb} />
|
|
59
|
+
</Section>
|
|
60
|
+
<Section>
|
|
61
|
+
<Notice title="提示:" type="info">
|
|
62
|
+
页面提示信息区(Notice组件)
|
|
63
|
+
</Notice>
|
|
64
|
+
</Section>
|
|
65
|
+
<Section>
|
|
66
|
+
<Toolbar>
|
|
67
|
+
<Toolbar.Left>
|
|
68
|
+
<Toolbar.Item>
|
|
69
|
+
<Button type="primary">页面操作区</Button>
|
|
70
|
+
</Toolbar.Item>
|
|
71
|
+
<Toolbar.Item>
|
|
72
|
+
<ButtonGroup>
|
|
73
|
+
<Dropdown
|
|
74
|
+
triggerButton={<Button type="normal">批量操作</Button>}
|
|
75
|
+
triggerType="click"
|
|
76
|
+
>
|
|
77
|
+
<Menu onClick={this.onMenuClick}>
|
|
78
|
+
<Menu.Item key="submit_cr">提交发布</Menu.Item>
|
|
79
|
+
<Menu.Item key="close_cr">关闭变更</Menu.Item>
|
|
80
|
+
</Menu>
|
|
81
|
+
</Dropdown>
|
|
82
|
+
<Dropdown triggerButton={<Button type="normal">更多</Button>} triggerType="click">
|
|
83
|
+
<Menu onClick={this.onMenuClick}>
|
|
84
|
+
<Menu.Item key="other_1">更多操作 1</Menu.Item>
|
|
85
|
+
<Menu.Item key="other_2">更多操作 2</Menu.Item>
|
|
86
|
+
<Menu.Item key="other_3">更多操作 3</Menu.Item>
|
|
87
|
+
</Menu>
|
|
88
|
+
</Dropdown>
|
|
89
|
+
</ButtonGroup>
|
|
90
|
+
</Toolbar.Item>
|
|
91
|
+
</Toolbar.Left>
|
|
92
|
+
<Toolbar.Right>
|
|
93
|
+
<Toolbar.Item>
|
|
94
|
+
<Select onChange={this.onSelectChange} defaultValue="default">
|
|
95
|
+
<Option value="default">默认排序</Option>
|
|
96
|
+
<Option value="gmt_create|DESC">按创建时间降序</Option>
|
|
97
|
+
<Option value="gmt_create|ASC">按创建时间升序</Option>
|
|
98
|
+
</Select>
|
|
99
|
+
</Toolbar.Item>
|
|
100
|
+
<Toolbar.Item>
|
|
101
|
+
<Search placeholder="请输入关键词搜索" onSearch={this.onSearch} />
|
|
102
|
+
</Toolbar.Item>
|
|
103
|
+
</Toolbar.Right>
|
|
104
|
+
</Toolbar>
|
|
105
|
+
</Section>
|
|
106
|
+
<Section>
|
|
107
|
+
<Card title="详细内容展示区(Card组件)" extra={<a href="#">更多操作</a>}>
|
|
108
|
+
<p>
|
|
109
|
+
<a
|
|
110
|
+
href="#"
|
|
111
|
+
target="_blank"
|
|
112
|
+
rel="noreferrer noopener"
|
|
113
|
+
>
|
|
114
|
+
点击查看设计规范
|
|
115
|
+
</a>
|
|
116
|
+
</p>
|
|
117
|
+
<p>
|
|
118
|
+
<Button type="primary" onClick={this.props.changeLang}>
|
|
119
|
+
<Translate value="buttonText" />
|
|
120
|
+
</Button>
|
|
121
|
+
</p>
|
|
122
|
+
</Card>
|
|
123
|
+
</Section>
|
|
124
|
+
</Layout>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export default connect(
|
|
130
|
+
({ index, ...others }) => ({ ...index, ...others }),
|
|
131
|
+
dispatch => bindActionCreators(actions, dispatch)
|
|
132
|
+
)(Root);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { b } from '@/ts-import-b';
|
|
2
|
-
|
|
3
|
-
export const a = b;
|
|
1
|
+
import { b } from '@/ts-import-b';
|
|
2
|
+
|
|
3
|
+
export const a = b;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a } from '@/ts-import-c';
|
|
2
|
-
|
|
3
|
-
export const b = a;
|
|
1
|
+
import { a } from '@/ts-import-c';
|
|
2
|
+
|
|
3
|
+
export const b = a;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
// node/prefer-promises/fs
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
|
|
4
|
-
fs.readFile('../node.js', 'utf-8', (err, data) => {
|
|
5
|
-
// no-console
|
|
6
|
-
console.log(err, data);
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// no-var
|
|
10
|
-
// @typescript-eslint/no-unused-vars
|
|
11
|
-
var count = 1 + 1;
|
|
12
|
-
|
|
13
|
-
class Test {
|
|
14
|
-
func(): void {
|
|
15
|
-
return 1;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default Test;
|
|
1
|
+
// node/prefer-promises/fs
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
|
|
4
|
+
fs.readFile('../node.js', 'utf-8', (err, data) => {
|
|
5
|
+
// no-console
|
|
6
|
+
console.log(err, data);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
// no-var
|
|
10
|
+
// @typescript-eslint/no-unused-vars
|
|
11
|
+
var count = 1 + 1;
|
|
12
|
+
|
|
13
|
+
class Test {
|
|
14
|
+
func(): void {
|
|
15
|
+
return 1;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default Test;
|
|
20
20
|
// eol-last
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
export interface Props {
|
|
4
|
-
name: string;
|
|
5
|
-
enthusiasmLevel?: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function Hello({ name, enthusiasmLevel = 1 }: Props) {
|
|
9
|
-
if (enthusiasmLevel <= 0) {
|
|
10
|
-
throw new Error('You could be a little more enthusiastic. :D');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const foo: number = 1
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<div className="hello">
|
|
17
|
-
<div className="greeting">
|
|
18
|
-
Hello {name + enthusiasmLevel}
|
|
19
|
-
</div>
|
|
20
|
-
<Hi>
|
|
21
|
-
haha
|
|
22
|
-
</Hi>
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default Hello;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface Props {
|
|
4
|
+
name: string;
|
|
5
|
+
enthusiasmLevel?: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function Hello({ name, enthusiasmLevel = 1 }: Props) {
|
|
9
|
+
if (enthusiasmLevel <= 0) {
|
|
10
|
+
throw new Error('You could be a little more enthusiastic. :D');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const foo: number = 1
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div className="hello">
|
|
17
|
+
<div className="greeting">
|
|
18
|
+
Hello {name + enthusiasmLevel}
|
|
19
|
+
</div>
|
|
20
|
+
<Hi>
|
|
21
|
+
haha
|
|
22
|
+
</Hi>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default Hello;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div style="margin: 20px;">
|
|
3
|
-
<textarea>{{ value }}</textarea>
|
|
4
|
-
<img class="image-viewer__thumbnails" :src="imageUrl" @click="clickHandler" />
|
|
5
|
-
<div v-show="visible" class="image-viewer__wrapper">
|
|
6
|
-
<i class="image-viewer__closebtn" @click="closeHandler" />
|
|
7
|
-
<div class="image-viewer__img">
|
|
8
|
-
<img :src="imageUrl" />
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script lang="ts">
|
|
15
|
-
import { Vue, Component, Prop } from 'vue-property-decorator';
|
|
16
|
-
|
|
17
|
-
@Component
|
|
18
|
-
export default class ImageViewer extends Vue {
|
|
19
|
-
@Prop(String) readonly imageUrl;
|
|
20
|
-
|
|
21
|
-
visible = false;
|
|
22
|
-
|
|
23
|
-
closeHandler() {
|
|
24
|
-
this.visible = false;
|
|
25
|
-
|
|
26
|
-
const foo: number = 1
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
clickHandler() {
|
|
30
|
-
this.visible = true;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
<style lang="scss">
|
|
36
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div style="margin: 20px;">
|
|
3
|
+
<textarea>{{ value }}</textarea>
|
|
4
|
+
<img class="image-viewer__thumbnails" :src="imageUrl" @click="clickHandler" />
|
|
5
|
+
<div v-show="visible" class="image-viewer__wrapper">
|
|
6
|
+
<i class="image-viewer__closebtn" @click="closeHandler" />
|
|
7
|
+
<div class="image-viewer__img">
|
|
8
|
+
<img :src="imageUrl" />
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import { Vue, Component, Prop } from 'vue-property-decorator';
|
|
16
|
+
|
|
17
|
+
@Component
|
|
18
|
+
export default class ImageViewer extends Vue {
|
|
19
|
+
@Prop(String) readonly imageUrl;
|
|
20
|
+
|
|
21
|
+
visible = false;
|
|
22
|
+
|
|
23
|
+
closeHandler() {
|
|
24
|
+
this.visible = false;
|
|
25
|
+
|
|
26
|
+
const foo: number = 1
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
clickHandler() {
|
|
30
|
+
this.visible = true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<style lang="scss">
|
|
36
|
+
</style>
|
package/__tests__/fixtures/ts.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
interface AppDeveloper {
|
|
2
|
-
nickname: string,
|
|
3
|
-
name: string,
|
|
4
|
-
avatarUrl: string,
|
|
5
|
-
id: number,
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const foo: string = 1
|
|
9
|
-
let bar = [1,2]
|
|
10
|
-
const baz = {obj:2}
|
|
11
|
-
|
|
12
|
-
function func(arg: string): string;
|
|
13
|
-
function func(arg: number): number;
|
|
14
|
-
function func(arg: string | number): string | number {
|
|
15
|
-
if (typeof arg === 'string') return arg;
|
|
16
|
-
return arg;
|
|
17
|
-
}
|
|
1
|
+
interface AppDeveloper {
|
|
2
|
+
nickname: string,
|
|
3
|
+
name: string,
|
|
4
|
+
avatarUrl: string,
|
|
5
|
+
id: number,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const foo: string = 1
|
|
9
|
+
let bar = [1,2]
|
|
10
|
+
const baz = {obj:2}
|
|
11
|
+
|
|
12
|
+
function func(arg: string): string;
|
|
13
|
+
function func(arg: number): number;
|
|
14
|
+
function func(arg: string | number): string | number {
|
|
15
|
+
if (typeof arg === 'string') return arg;
|
|
16
|
+
return arg;
|
|
17
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div style="margin: 20px;">
|
|
3
|
-
<textarea>{{ value }}</textarea>
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script lang="js">
|
|
8
|
-
export default {
|
|
9
|
-
data() {
|
|
10
|
-
const bo = import('./foo');
|
|
11
|
-
return {
|
|
12
|
-
value: 'value',
|
|
13
|
-
};
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div style="margin: 20px;">
|
|
3
|
+
<textarea>{{ value }}</textarea>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="js">
|
|
8
|
+
export default {
|
|
9
|
+
data() {
|
|
10
|
+
const bo = import('./foo');
|
|
11
|
+
return {
|
|
12
|
+
value: 'value',
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
</script>
|