prettier / prettier-vscode

Visual Studio Code extension for Prettier
https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
MIT License
5.04k stars 446 forks source link

Implement prettier-tslint #414

Closed orblazer closed 5 years ago

orblazer commented 6 years ago

Hello, I have implement prettier-tslint. This read and format correctly typescript (from tslint file)

Thanks.

CiGit commented 6 years ago

Hi, Thanks for doing that.

We would have to keep in mind that typescript files are processed by eslint (eslint config files) currently.

azz commented 6 years ago

Nice work - let's get prettier-tslint shipped!

orblazer commented 6 years ago

Ok, this PR is ready to merge ! Thanks @azz for the merge.

arealmaas commented 6 years ago

ah, been waiting for this! 😻

CiGit commented 6 years ago

Could you also update:

Add a test. You can duplicate testEslint and start from there.

This implementation makes tslint a higher priority than eslint. Having both enabled would break previous behavior where eslint was trying to read typescript files (assuming it had the right parser).

marvinroger commented 6 years ago

Any updates on this?

orblazer commented 6 years ago

no i dont have times this days for make that, if an people can make the test, i am so happy :)

Faultless commented 5 years ago

@orblazer made a small PR here Hope it helps speed things up!

Faultless commented 5 years ago

This PR fixes the tslint test. ~Its working fine with tslint.json, which is the standard name for such a file, but it doesn't seem to work with .yml files. Maybe this is not part of this PR, I'll have to take a look to make sure when I have time.~ Working fine for YAML as well.

Faultless commented 5 years ago

No idea why this test is failing, its working fine on local. Perhaps there's some missing prettier/tslint config on CI that I am unaware of? I'm open to suggestions to resolve this and get it merged asap.

For Context: I'm running this on a windows machine. Perhaps its a linux issue? if anyone can reproduce it would be great!

Faultless commented 5 years ago

Friendly nudge: can anyone reproduce tests on a linux/osx environment? and/or help with this obscure CI test failure. On windows the error is not reproduceable.

ColCh commented 5 years ago

I'm able to reproduce it on Mac OS

ColCh commented 5 years ago

@Faultless seems to be working now 😃

travis job for my commit: https://travis-ci.org/ColCh/prettier-vscode/jobs/385907251

commit itself https://github.com/ColCh/prettier-vscode/commit/3f1f3feb5e4be37558c27985e350778662e1c8b1

waiting for @orblazer to review PR https://github.com/orblazer/prettier-vscode/pull/5

ColCh commented 5 years ago

Thanks for merging. What now ?

Faultless commented 5 years ago

Fixed a small nit here, but apart from that there should be no reason not to merge this asap

Faultless commented 5 years ago

@CiGit is this good to go for you? or is there something blocking still?

CiGit commented 5 years ago

@azz deserves to review this one :-)

leocaseiro commented 5 years ago

it seems "This branch has conflicts that must be resolved"

bohdanbirdie commented 5 years ago

Hi @CiGit, Is there any chance to have merged soon? Or at least point me the way of how can I setup this updates manually for my local prettier-vscode

Thanks!

svipas commented 5 years ago

@azz we are waiting for your review 😄

sunnylqm commented 5 years ago

Can we merge this first since @azz had approved this before and what came after were just test code. So if the idea works, the test works, why not let any possible potential issues to be tested by users? @CiGit

l-7-l commented 5 years ago

Ah ah ah ah cool

bohdanbirdie commented 5 years ago

Coming here every day to check if PR was merged :D @CiGit @azz sorry for bothering, but merge will be highly appreciated!

HaoyangFan commented 5 years ago

hi, just want to know if the prettier tslint is already integrated into the prettier so that we don't need to install it every time via the npm and just need to turn it on in user's setting, like what we do for the prettier eslint?

tommck commented 5 years ago

*crickets*

cjbassi commented 5 years ago

So I ran into an issue when testing this out where import statements would get mangled when the file was formatted with the given tslint.json:

{ "rules": { "quotemark": [true, "single"], "ordered-imports": true } }

I was able to recreate the issue with a simple .ts file that has the following lines:

import Buttons from '../components/Buttons'; import { newText } from '../actions/actions';

Formatting the file swaps the lines as intended but it also mangles the imports and adds random characters. Must have something to do with the single quote rule.

chiefGui commented 5 years ago

Nothing yet? :(

CiGit commented 5 years ago

Thanks for your contribution.

@cjbassi AFAIK Errors should be corrected in dependencies.

chiefGui commented 5 years ago

Hey @CiGit

Thank you for merging this—glad it'll be arriving. Do you have an estimate on when you'll be rolling out the new version containing this update?

Thanks.

CiGit commented 5 years ago

@chiefGui Faster than it took to merge it :-) (under 24h if everything goes as I want)

sveyret commented 5 years ago

Hi @orblazer I tried to use tslint-prettier in vscode, but it looks like the max-line-length tslint rule is not taken into account for formatting line length, and neither is the print-width rule of prettier. Is this something I am doing wrong ?

james2406 commented 5 years ago

I am experiencing the same issue as @sveyret. With the following tslint.json setup:

{
  "extends": ["tslint:recommended"],
  "rules": {
    "max-line-length": [true, { "limit": 140 }]
  }
}
Faultless commented 5 years ago

I tried to use tslint-prettier in vscode, but it looks like the max-line-length tslint rule is not taken into account for formatting line length, and neither is the print-width rule of prettier. Is this something I am doing wrong ?

This should probably go into its own issue for tracking/visibility since this PR has already been merged. Just my 2 cents.

OldStarchy commented 5 years ago

It seems that prettier is ignoring tslint "Indent" setting. Was that supposed to be fixed in ths PR?

OldStarchy commented 5 years ago

If prettier.tslintIntegration is true, prettier ignores both its own tab settings (prettier.useTabs & prettier.tabWidth) and tslint's indent.

sveyret commented 5 years ago

I haven't experienced (yet) the problem raised by @aNickzz, but created 2 issues for max-line-length and also a problem of semicolon: https://github.com/prettier/prettier-vscode/issues/557 https://github.com/prettier/prettier-vscode/issues/558

azz commented 5 years ago

@sveyret could you move those issues to the prettier-tslint repo?

sveyret commented 5 years ago

@azz Done! :smile: https://github.com/azz/prettier-tslint/issues/15 https://github.com/azz/prettier-tslint/issues/16