prettier / pretty-quick

⚡ Get Pretty Quick
https://npm.im/pretty-quick
MIT License
2.2k stars 82 forks source link

pretty-quick does not work when "type": "module" is declared in package.json in a TypeScript project #139

Open jpangelle opened 2 years ago

jpangelle commented 2 years ago

Description

When I use "type": "module" in package.json and use `pretty-quick, I get this error:

node:internal/errors:811
        (frm) => !StringPrototypeStartsWith(frm.getFileName(),
                  ^

TypeError: String.prototype.startsWith called on null or undefined
    at startsWith (<anonymous>)
    at node:internal/errors:811:19
    at Array.filter (<anonymous>)
    at node:internal/errors:809:16
    at prepareStackTrace (node:internal/errors:96:12)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:38)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at importFresh (/<path>/node_modules/prettier/third-party.js:91:60)

Dependencies

"husky": "^6.0.0" "prettier": "^2.4.1" "pretty-quick": "^3.1.1"

Husky Command

npx pretty-quick --staged

JounQin commented 5 months ago

Not sure to understand what's the issue.

A minimal but runnable online reproduction is required.