ggascoigne / prettier-plugin-import-sort

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

Error formatting document. TypeError: style is not a function #26

Closed agusterodin closed 2 years ago

agusterodin commented 2 years ago

I followed the setup options and get this error when I attempt to format a file (_app.tsx for example).

["INFO" - 5:23:33 PM] Using config file at '/Users/Jeff/Desktop/prettier-import-order/my-app/.prettierrc.json'
["INFO" - 5:23:33 PM] Using ignore file (if present) at /Users/Jeff/Desktop/prettier-import-order/my-app/.prettierignore
["INFO" - 5:23:33 PM] File Info:
{
  "ignored": false,
  "inferredParser": "typescript"
}
["INFO" - 5:23:33 PM] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 5:23:33 PM] Prettier Options:
{
  "filepath": "/Users/Jeff/Desktop/prettier-import-order/my-app/pages/index.tsx",
  "parser": "typescript",
  "importSort": {
    ".js, .jsx, .ts, .tsx": {
      "style": "module",
      "parser": "typescript"
    }
  }
}
["ERROR" - 5:23:34 PM] Error formatting document.
TypeError: style is not a function
    at /Users/Jeff/Desktop/prettier-import-order/my-app/node_modules/import-sort/lib/index.js:220:16
    at sortImports (/Users/Jeff/Desktop/prettier-import-order/my-app/node_modules/import-sort/lib/index.js:24:58)
    at importSort (/Users/Jeff/Desktop/prettier-import-order/my-app/node_modules/import-sort/lib/index.js:19:12)
    at organizeImports (/Users/Jeff/Desktop/prettier-import-order/my-app/node_modules/prettier-plugin-import-sort/src/index.js:50:22)
    at Object.preprocess (/Users/Jeff/Desktop/prettier-import-order/my-app/node_modules/prettier-plugin-import-sort/src/index.js:72:14)
    at Object.parse (/Users/Jeff/Desktop/prettier-import-order/my-app/node_modules/prettier/index.js:7357:25)
    at coreFormat (/Users/Jeff/Desktop/prettier-import-order/my-app/node_modules/prettier/index.js:8672:18)
    at formatWithCursor2 (/Users/Jeff/Desktop/prettier-import-order/my-app/node_modules/prettier/index.js:8864:18)
    at /Users/Jeff/Desktop/prettier-import-order/my-app/node_modules/prettier/index.js:39174:12
    at Object.Success [as format] (/Users/Jeff/Desktop/prettier-import-order/my-app/node_modules/prettier/index.js:39188:12)
    at t.default.format (/Users/Jeff/.vscode/extensions/esbenp.prettier-vscode-9.5.0/src/PrettierEditService.ts:463:45)
    at t.PrettierEditProvider.provideEdits (/Users/Jeff/.vscode/extensions/esbenp.prettier-vscode-9.5.0/src/PrettierEditService.ts:322:22)
    at B.provideDocumentFormattingEdits (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:85:102917)
["INFO" - 5:23:34 PM] Formatting completed in 0.195ms.

Here is a minimal reproduction: https://github.com/agusterodin/pretter-import-sort-error-reproduction