Skip to content

Commit c6f8779

Browse files
committed
test: add a test project
The default test project should always pass lint. TODO: Add cases that will fail the lint command
1 parent dbbb6e5 commit c6f8779

File tree

9 files changed

+1068
-2
lines changed

9 files changed

+1068
-2
lines changed

package.json

+11-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,18 @@
2020
"url": "https://github.com/vuejs/eslint-config-typescript/issues"
2121
},
2222
"homepage": "https://github.com/vuejs/eslint-config-typescript#readme",
23+
"devDependencies": {
24+
"@typescript-eslint/eslint-plugin": "^2.7.0",
25+
"@typescript-eslint/parser": "^2.7.0",
26+
"eslint": "^6.6.0",
27+
"eslint-plugin-vue": "^6.0.1",
28+
"typescript": "^3.7.2",
29+
"vue": "^2.6.10",
30+
"vue-property-decorator": "^8.3.0"
31+
},
2332
"peerDependencies": {
24-
"@typescript-eslint/eslint-plugin": "^2.5.0",
25-
"@typescript-eslint/parser": "^2.5.0",
33+
"@typescript-eslint/eslint-plugin": "^2.7.0",
34+
"@typescript-eslint/parser": "^2.7.0",
2635
"eslint": "^6.6.0",
2736
"typescript": "*"
2837
}

test/default/.eslintrc.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true
5+
},
6+
'extends': [
7+
'plugin:vue/essential',
8+
'eslint:recommended',
9+
require.resolve('../../recommended')
10+
],
11+
parserOptions: {
12+
parser: '@typescript-eslint/parser'
13+
}
14+
}

test/default/src/App.vue

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<template>
2+
<div id="app">
3+
<img alt="Vue logo" src="./assets/logo.png">
4+
<HelloWorld msg="Welcome to Your Vue.js + TypeScript App"/>
5+
</div>
6+
</template>
7+
8+
<script lang="ts">
9+
import { Component, Vue } from 'vue-property-decorator';
10+
import HelloWorld from './HelloWorld';
11+
12+
@Component({
13+
components: {
14+
HelloWorld,
15+
},
16+
})
17+
export default class App extends Vue {}
18+
</script>
19+
20+
<style>
21+
#app {
22+
font-family: 'Avenir', Helvetica, Arial, sans-serif;
23+
-webkit-font-smoothing: antialiased;
24+
-moz-osx-font-smoothing: grayscale;
25+
text-align: center;
26+
color: #2c3e50;
27+
margin-top: 60px;
28+
}
29+
</style>

test/default/src/HelloWorld.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Component, Prop, Vue } from 'vue-property-decorator';
2+
3+
@Component
4+
export default class HelloWorld extends Vue {
5+
@Prop() private msg!: string;
6+
7+
render() {
8+
return (
9+
<div class="hello">
10+
<h1>{ this.msg }</h1>
11+
</div>
12+
)
13+
}
14+
}

test/default/src/main.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Vue from 'vue'
2+
import App from '@/App.vue'
3+
4+
Vue.config.productionTip = false
5+
6+
new Vue({
7+
render: h => h(App),
8+
}).$mount('#app')

test/default/src/shims-tsx.d.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Vue, { VNode } from 'vue'
2+
3+
declare global {
4+
namespace JSX {
5+
// tslint:disable no-empty-interface
6+
interface Element extends VNode {}
7+
// tslint:disable no-empty-interface
8+
interface ElementClass extends Vue {}
9+
interface IntrinsicElements {
10+
[elem: string]: any
11+
}
12+
}
13+
}

test/default/src/shims-vue.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.vue' {
2+
import Vue from 'vue'
3+
export default Vue
4+
}

test/default/tsconfig.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"compilerOptions": {
3+
"target": "esnext",
4+
"module": "esnext",
5+
"strict": true,
6+
"jsx": "preserve",
7+
"importHelpers": true,
8+
"moduleResolution": "node",
9+
"experimentalDecorators": true,
10+
"esModuleInterop": true,
11+
"allowSyntheticDefaultImports": true,
12+
"sourceMap": true,
13+
"baseUrl": ".",
14+
"paths": {
15+
"@/*": [
16+
"src/*"
17+
]
18+
},
19+
"lib": [
20+
"esnext",
21+
"dom",
22+
"dom.iterable",
23+
"scripthost"
24+
]
25+
},
26+
"include": [
27+
"src/**/*.ts",
28+
"src/**/*.tsx",
29+
"src/**/*.vue"
30+
],
31+
"exclude": [
32+
"node_modules"
33+
]
34+
}

0 commit comments

Comments
 (0)