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

Add trim-left-pattern support to no-consecutive-blank-lines rule #4647

Closed
JoshuaKGoldberg opened this issue Apr 7, 2019 · 4 comments
Closed

Comments

@JoshuaKGoldberg
Copy link
Contributor

JoshuaKGoldberg commented Apr 7, 2019

Bug Report

Filing on behalf of @akoidan.

  • TSLint version: 5.15.0
  • TypeScript version: 3.4.0
  • Running TSLint via: CLI

TypeScript Vue code being linted

<template>
<div>asd</div>
</template>
<script lang="ts">
export default {
}
</script>

with tslint.json configuration:

{
    "rules": {
        "no-consecutive-blank-lines": true
    }
}

Actual behavior

Quoting #4643:

no-consecutive-blank-lines doesn't work in .vue files since to enable sourcemaps vue-loader will leave blank spaces in <template> section and this will never change.

Expected behavior

There should be a way to ignore these preceding blank lines in .vue files, since the rule is basically unusable at this point.

However, no-consecutive-blank-lines is no longer a priority for TSLint per #4534; the recommendation is typically to use Prettier.

Same discussion as #4646. What's the best way to handle this?

@adidahiya
Copy link
Contributor

@akoidan does prettier work for vue files? is there anything blocking you from using that for code formatting?

@akoidan
Copy link

akoidan commented Apr 16, 2019

Why would I use different formatters for vue files and ts files? I want tslint and tslint-microsoft-contrib rules, not prettier limited set of rules.

As for now I ended up with adding my customs rules to every project. I also don't know what's wrong with that PR that I created that fixes those things. It doesn't break existing functionality, it comes with tests, and it doesn't break any programming principles I'm aware of.

Am I the only one facing that issue, does none use vue with typescript? Or no one using tslint? I guess if this PR is rejected I will just ship a separate npm package with custom tslint rules for vue file. That would be ridiculous though.

@adidahiya
Copy link
Contributor

Why would I use different formatters for vue files and ts files? I want tslint and tslint-microsoft-contrib rules, not prettier limited set of rules.

I'm not suggesting different formatters, but rather switching to prettier for all file types because TSLint's formatting rules are essentially deprecated... or, you could use tslint-plugin-prettier + tslint-config-prettier + whichever tslint formatting rules do not conflict with prettier (very few, I imagine).

Am I the only one facing that issue, does none use vue with typescript? Or no one using tslint?

Good question, have you checked out #2099?

@JoshuaKGoldberg
Copy link
Contributor Author

Per #4379, a Vue-specific workaround isn't going to be able to land in TSLint core:

Given the lack of discussion or concrete proposal here and the upcoming deprecation of TSLint in favor of ESLint (#4534), I'm going to go ahead and close this issue and related Vue-specific reports for housekeeping purposes.

If this is still an issue for you in typescript-eslint, I'd recommend filing an issue there. Best of luck!

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