azz / prettier-tslint

Code ➡️ prettier ➡️ tslint --fix ➡️ Formatted Code ✨
https://npm.im/prettier-tslint
MIT License
225 stars 13 forks source link

Imports are mangled when using "ordered-imports" with prettier-vscode #26

Closed liuweiGL closed 5 years ago

liuweiGL commented 5 years ago

Bug Report

TypeScript code being linted


import {NgModule} from '@angular/core'
import {AppComponent} from './app.component'
import {CommonModuleCustom} from './modules/common.module'
import {ElectronService} from './providers/electron.service'
import {LayoutComponent} from './components/layout/layout.component'

with tslint.json configuration:


  ordered-imports:
    - true
    - grouped-imports: false
      import-sources-order: case-insensitive
      named-imports-order: case-insensitive
      module-source-path: full
  # From tslint-eslint-rules
  object-curly-spacing: 
    - true
    - always

Actual behavior

image

Expected behavior

image

Reproduce

You can reproduce from this repository: https://github.com/liuweiGL/prettier-tslint-bug-reproduce

PS

I think the apply-fixes.js has some problems,the tslint‘s applyTSLintAllFixes function will update Program, but you don't.

Refrence from https://github.com/palantir/tslint/pull/2864

aleclarson commented 5 years ago

Duplicate of #19

Thanks for the repro. Looking into a fix..

liuweiGL commented 5 years ago

Duplicate of #19

Thanks for the repro. Looking into a fix..

Okay thank you.

aleclarson commented 5 years ago

Fixed in v0.4.2 🎉