import-sort icon indicating copy to clipboard operation
import-sort copied to clipboard

SyntaxError: Decorators cannot be used to decorate parameters (60:14)

Open xenoterracide opened this issue 5 years ago • 2 comments
trafficstars

lies, decorators work fine on parameters

@singleton
export class OrderResolver implements GraphQLResolversFactory {
  constructor(@lazy(OrderRepository) private readonly repo: () => OrderRepository) {}

  resolvers(): Resolvers<Context> {
    return {
      Query: {
        order: async (_: unknown, args: { id: Scalars['ID'] }): Promise<GraphOrderParent> => {
          const order = await this.repo().findOneOrFail(args.id);
          return orderMapper(order);
        },
      },
    };
  }
}
> npx import-sort --version
6.0.0

xenoterracide avatar Jul 08 '20 12:07 xenoterracide

Also running into this issue. It's especially frustrating within an Angular application.

mr1upmachine avatar Sep 11 '20 16:09 mr1upmachine

This appears to be a documentation issue. Per the advice in https://github.com/renke/import-sort/issues/101, I was able to fix this by installing import-sort-parser-typescript and adding a config to package.json:

"importSort": {
  ".js, .ts": {
    "style": "eslint",
    "parser": "typescript"
  }
}

chrislambe avatar Feb 11 '21 16:02 chrislambe