ggascoigne / prettier-plugin-import-sort

Prettier plugin to pass javascript and typescript through import-sort
MIT License
110 stars 11 forks source link

Style "module" could not be resolved #17

Closed yann510 closed 3 years ago

yann510 commented 3 years ago

When I'm trying to format this file:

import { Column, Entity } from "typeorm"
import { RootEntity } from "./root.entity"
import { MinLength } from "class-validator";

@Entity()
export class Todo extends RootEntity {
  @MinLength(5, { always: true })
  @Column({nullable:false})
  text: string
}

I'm getting the following error:

Error: prettier-plugin-import-sort:  Style "module" could not be resolved
    at throwIf (/project/node_modules/prettier-plugin-import-sort/src/index.js:19:11)
    at getAndCheckConfig (/project/node_modules/prettier-plugin-import-sort/src/index.js:36:3)
    at organizeImports (/project/node_modules/prettier-plugin-import-sort/src/index.js:46:18)
    at Object.preprocess (/project/node_modules/prettier-plugin-import-sort/src/index.js:73:14)
    at Object.parse (/project/node_modules/prettier/index.js:11363:21)
    at coreFormat (/project/node_modules/prettier/index.js:14782:25)
    at format (/project/node_modules/prettier/index.js:15017:75)
    at formatWithCursor (/project/node_modules/prettier/index.js:15033:12)
    at /project/node_modules/prettier/index.js:50675:12
    at Object.format (/project/node_modules/prettier/index.js:50695:12)

Not sure, but I think this might be related to the usage of decorators?

Alexander3 commented 3 years ago

You can choose styles from https://github.com/renke/import-sort/tree/master/packages To fix your problem just run npm install --dev import-sort-style-module

yann510 commented 3 years ago

This fixed the problem, thank you good sir :)