Vue-cli: TSlint rule "no-consecutive-blank-lines" doesn't work with `vue-service tslint`

Created on 5 Jul 2018  路  5Comments  路  Source: vuejs/vue-cli

Version

3.0.0-rc.3

Reproduction link

https://github.com/hdurix/vue-consecutive-empty-lines

Steps to reproduce

Create a TypeScript project using vue cli.

Set no-consecutive-blank-lines to true (or remove it) in tslint.json

Change HelloWorld.vue to extract TypeScript in a dedicated file (HelloWorld.ts)

In HelloWorld.ts, add two consecutive empty lines.

In App.vue, add // @ts-ignore before the import statement (more information in https://github.com/vuejs/vue-cli/issues/1576)

Launch npm run lint.

What is expected?

Consecutive empty lines are replaced by only one empty line.

What is actually happening?

The prompt says: No lint errors found.


The same thing works if we call directly tslint using tslint --project . --fix or if we run npm run serve.

I think, it comes from: https://github.com/vuejs/vue-cli/blob/838f6a2b662075fa48047f751b4510ec11da3fa9/packages/%40vue/cli-plugin-typescript/lib/tslint.js#L24-L26.

enhancement typescript

Most helpful comment

So @Akryum, why, there is a different behaviour between npm run serve and npm run lint?

Note: the problem is not with the Vue file but with the dedicated TypeScript file.

Is there a documentation to explain why some tslint rules are not allowed?

All 5 comments

So @Akryum, why, there is a different behaviour between npm run serve and npm run lint?

Note: the problem is not with the Vue file but with the dedicated TypeScript file.

Is there a documentation to explain why some tslint rules are not allowed?

there is a different behaviour between npm run serve and npm run lint

It wans't clear to me from your issue.

why, there is a different behaviour between npm run serve and npm run lint?

I guess its because npm run serve runs tslint as part of a webpack build process and npm run lint calls a monkey-patched tslint directly. in the webpack process the rule isnt disabled.

Exactly. And we patch tslint in the lint script to make it work with .vue files. It's a necessary hack.

Was this page helpful?
0 / 5 - 0 ratings