Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

How to get command line tslint to lint Vue files #3676

Closed
ffxsam opened this issue Jan 26, 2018 · 6 comments
Closed

How to get command line tslint to lint Vue files #3676

ffxsam opened this issue Jan 26, 2018 · 6 comments

Comments

@ffxsam
Copy link

ffxsam commented Jan 26, 2018

Bug Report

  • TSLint version: 5.9.1
  • TypeScript version: 2.6.2
  • Running TSLint via: CLI

TypeScript code being linted

<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.

@adidahiya
Copy link
Contributor

duplicate of #2099

@ffxsam
Copy link
Author

ffxsam commented Jan 26, 2018

@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.

@adidahiya
Copy link
Contributor

adidahiya commented Jan 26, 2018

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.

@ffxsam
Copy link
Author

ffxsam commented Jan 27, 2018

Fair enough! I'll post there.

@Akaronte
Copy link

Akaronte commented Nov 17, 2018

test

<script lang="ts"> in the tag of script part <script lang="ts"> </script>

@Akaronte
Copy link

// tsconfig.json
{
"include": [
"src//*.ts",
"src/
/*.vue"
],
"exclude": [
"node_modules"
],

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants