<template>
<div>
Hi {{ name }}! {{ value * 2 }}
</div>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
data() {
return {
name: 'Bob',
};
},
methods: {
magic() {
const asdf = 'b';
this.name = 'Frank';
},
},
props: {
value: Number,
},
});
</script>
<style>
</style>
with tslint.json configuration:
{
"defaultSeverity": "error",
"extends": ["tslint:recommended"],
"jsRules": {},
"rules": {
"indent": [true, "spaces", 2],
"interface-name": false,
"newline-before-return": true,
"no-consecutive-blank-lines": false,
"no-console": { "severity": "warning" },
"no-debugger": { "severity": "warning" },
"no-empty": { "severity": "warning", "options": "allow-empty-catch" },
"no-irregular-whitespace": true,
"no-shadowed-variable": false,
"no-unused-variable": { "severity": "warning" },
"object-literal-sort-keys": false,
"ordered-imports": false,
"prefer-switch": true,
"semicolon": false,
"space-within-parens": true,
"quotemark": [true, "single"],
"trailing-comma": false,
"variable-name": true
},
"rulesDirectory": []
}
How do I set up tsconfig.json to lint the TS portion of my Vue files? It works fine in VS Code, but I'd like the command line to work as well.
duplicate of #2099
@adidahiya That issue became pretty off-topic. The discussion changed into linting issues, and there ultimately was no solution. Someone posted about configuring vue-loader, but command line tslint does not use webpack.
Yeah, but the original post is almost identical and the goal is the same. That thread has a lot of traffic and any even remotely applicable solution will show up there.
Fair enough! I'll post there.
test
// tsconfig.json
{
"include": [
"src//.ts",
"src//.vue"
],
"exclude": [
"node_modules"
],
Most helpful comment
// tsconfig.json
{
"include": [
"src//.ts",
"src//.vue"
],
"exclude": [
"node_modules"
],