Closed rerodrigues closed 3 years ago
Not at my computer right now, but I’m guessing that you aren’t using the latest versions of prettier and prettier-plugin-import-sort.
On Wed, Jun 10, 2020 at 5:52 PM Renato Rodrigues notifications@github.com wrote:
I don't know exactly why this happens, but when running prettier via eslint --fix I got this error.
the error is trown by prettier-plugin-import-sort/src/index.js line
const { parsers: javascriptParsers } = _interopDefault( require('prettier/parser-babel') )
even I'm using TS
below is my conf on package.json
"importSort": { ".ts, .tsx": { "style": "renke", "parser": "typescript" } },
and my lint-staged config which is firing the eslint --fix
"lint-staged": { "*.{js,ts,tsx,jsx}": [ "eslint --fix" ] },
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ggascoigne/prettier-plugin-import-sort/issues/12, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACAVVCEV3VKQTOS7TYNMXDRWATC7ANCNFSM4N26GHFA .
I have received the same error and it was resolved by updating to prettier: ^2.x.x (previously was on prettier 1.x.x).
This error was fixed by using the latest version of Pettier, but I'm now getting TypeError: style is not a function
.
@c10b10 Had the same issue just now. The mistake was that I hadn't used the right format for the importSort
config in package.json
. It doesn't tell you if it's malformed and then falls back to node_modules/eslint/lib/api.js
as the style, which doesn't work.
Not working
// package.json
"importSort": {
"*.js": {
"style": "module",
}
},
Working
// package.json
"importSort": {
".js": {
"style": "module",
}
},
Thanks for pointing this out, I'll make note of this in the readme.
FYI the next release is going to drop prettier v1 support, v2 has been out long enough now that this shouldn't be too much of a problem.
I don't know exactly why this happens, but when running prettier via eslint --fix I got this error.
the error is trown by prettier-plugin-import-sort/src/index.js line
even I'm using TS
below is my conf on package.json
and my lint-staged config which is firing the eslint --fix
EDIT: Even if I run
$(npm bin)/prettier
manually, the same error happens