renke / import-sort

Sort ES2015 (aka ES6) imports. Both JavaScript and TypeScript are supported.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error when trying process Typescript files

felixcatto opened this issue · comments

TS version: 3.0.3
import-sort-cli: 5.2.0

When i trying to process .ts or .tsx i got following error :'(
TypeError: parser.parseImports is not a function

But with .js files all working well.

package.json

  "importSort": {
    ".js, .jsx, .es6, .es": {
      "parser": "babylon",
      "style": "eslint"
    },
    ".ts, .tsx": {
      "parser": "typescript",
      "style": "eslint"
    }
  },

@felixcatto Did you manage to make it work? I'm facing the same issue

Aha! It works after installing additionally the proper parser:

npm i -D import-sort-parser-typescript

@renke What do you think about mentioning this in docs?

@felixcatto Did you manage to make it work? I'm facing the same issue

Nope, i just read that in other languages imports stays unsorted and it is ok :)

@renke What do you think about mentioning this in docs?

Seconded. It would be helpful to mention this in the README.