组件:
<template lang="pug">
.container
h1 {{ pageTitle }}
hr
div
div V-Model test:
div {{ vModelTestProperty }}
div: input(type='text' v-model='vModelTestProperty')
hr
div
div {{ defaultTextLabel }}
div: RegularButton(:lettering='Non-default label' :onClickEventHandler='executeTest')
</template>
<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator';
@Component
export default class SPA_Test extends Vue {
private pageTitle: string = 'SPA test';
private vModelTestProperty: string = 'What you will input will display here';
private defaultTextLabel: string = 'Default label';
public executeTest(): void {
console.log('test, OK!');
}
}
</script>
TSLint告诉我:
WARNING in ./SPA_Test.vue ...
[1, 16]: " should be '
[18, 14]: " should be '
[1, 15]: Missing semicolon
[2, 13]: Missing semicolon
[4, 7]: Missing semicolon
[4, 20]: Missing semicolon
[5, 7]: Missing semicolon
[7, 8]: Missing semicolon
[8, 10]: Missing semicolon
[8, 20]: Missing semicolon
[9, 10]: Missing semicolon
[9, 32]: Missing semicolon
[10, 59]: Missing semicolon
[11, 7]: Missing semicolon
[13, 8]: Missing semicolon
[14, 10]: Missing semicolon
[14, 30]: Missing semicolon
[18, 8]: Missing semicolon
[18, 19]: Missing semicolon
[33, 10]: Missing semicolon
看起来像TSLint是指我的哈巴狗模板。如果没有错误,该如何告诉TSLint不要同时检查<template>
和<styles>
部分?
我试图将tslint-loader
和vue-tslint-loader
分开。不幸的是,看起来我在正则表达式中犯了某种错误,目前tslint无法正常工作:
module: {
rules: [
{
// @see https://regex101.com/r/fqrnCW/1
test: /^(?:\w|-)*?(?!vue.ts).ts$/,
loader: 'tslint-loader',
enforce: 'pre',
options: {},
{
// @see https://regex101.com/r/zY6fLn/1
test: /^(?:\w|-)*?.vue.ts$/,
loader: 'vue-tslint-loader',
enforce: 'pre',
options: {},
},
// ...
]
}