amatiasq / vsc-sort-imports

Sort ES6 imports automatically.
ISC License
58 stars 24 forks source link

Latest version complains about export in between decorator and class #28

Open dcwither opened 6 years ago

dcwither commented 6 years ago

Started getting https://github.com/renke/import-sort/issues/68 after updating. Although this is a change in import-sort-parser-babylon, perhaps there's a way for me to specify a version, or provide a path to the script I want to use?

amatiasq commented 6 years ago

Hey @dcwither sorry for the delay, you can install any package you want locally and then define that as your parser in your configuration.

amatiasq commented 6 years ago

I'll keep this open to update to the last version that fixes it.

astawbm commented 6 years ago

Hello @amatiasq In 6.0.0 the same problem again. Error sorting imports: SyntaxError: Using the export keyword between a decorator and a class is not allowed. Please use export @dec class instead. (14:0).


import { ActivatedRoute, Router } from '@angular/router';
import { Component, EventEmitter } from '@angular/core';
import { MpAPI, MpStorage } from '../../../shared';
import { MaterializeAction } from 'angular2-materialize';

@Component({
  selector: 'discussion',
  templateUrl: './discussion.component.html'
})
export class DiscussionComponent {}```

But yesterday everything worked great.
amatiasq commented 5 years ago

Can't reproduce, is this issue still running?

DevTrong commented 5 years ago

Running 6.0.1. Still seeing the error in VSCode Insiders. Works in VSCode though.

astawbm commented 5 years ago

@amatiasq http://i.shotnes.com/a/01/23/screenshot_1215825599.png Sorry. I was tired of work and holidays. No errors throw for now. Thanks!

amatiasq commented 5 years ago

@astawbm Is there something I should see in that screenshot? I see no error or complain

astawbm commented 5 years ago

@amatiasq Now all is fine. Thanks!

oyalhi commented 4 years ago

I see this error unfortunately.

I am using TypeScript v3.7.2.

12/1/2019, 11:05:00 AM:
-----------------------
Stage 2 decorators cannot be used to decorate parameters (/.../src/modules/Subscription/SubscribeResolver.ts:9:25)

   7 | export class SubscribeResolver {
   8 |   @Mutation(() => Boolean)
>  9 |   public async subscribe(@Arg('email') email: string): Promise<boolean> {
     |                         ^
  10 |     const subscriptionTest = await Subscription.findOne({ email })
  11 |     if (subscriptionTest) return true
  12 |     const subscription = Subscription.create({ email })
j-tegen commented 4 years ago

I'm having the same issue as @oyalhi. Any ideas on how to resolve it?

amatiasq commented 4 years ago

Do you know if this is a new feature of TS 3.7?

I think the issue comes from the tool importing a previous version of Typescript but I can't find which one is using and how to update it since all of this is handled by the core package import-sort

oyalhi commented 4 years ago

I think this is it: https://github.com/renke/import-sort/tree/master/packages/import-sort-parser-typescript. Maybe you could fork it and include it in your package and update it?

amatiasq commented 4 years ago

Yes, that's it, I'm aware of that.

I'm sorry but I don't have time to maintain this package anymore, I'm trying to provide support for the people who enjoy using it but can't do any development.

The good point of open source is anyone can do this, you can do it yourself, PRs are always welcome.