Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier fails when plugin(s) are present in Prettier config. #7

Open
christofferbergj opened this issue Jan 18, 2024 · 0 comments
Open

Comments

@christofferbergj
Copy link

Thanks for this lib. It is truly appreciated.

Prettier fails when plugin(s) are present in Prettier config.

// .prettierrc
{
  "arrowParens": "always",
  "jsxSingleQuote": false,
  "plugins": ["prettier-plugin-jsdoc"],
  "printWidth": 100,
  "proseWrap": "preserve",
  "semi": false,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "all",
  "useTabs": false
}

Error without installing dependencies:

Failed to run prettier: Error: Cannot find module 'prettier-plugin-jsdoc'

Error with installing dependencies:

Failed to run prettier: Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/{project_name_here}}/node_modules/.pnpm/prettier-plugin-jsdoc@1.3.0_prettier@3.2.2/node_modules/prettier-plugin-jsdoc/dist/index.js from /home/runner/work/_actions/the-guild-org/changesets-dependencies-action/v1.2.2/dist/index.js not supported.

Instead change the require of /home/runner/work/andel-energi/andel-energi/node_modules/.pnpm/prettier-plugin-jsdoc@1.3.0_prettier@3.2.2/node_modules/prettier-plugin-jsdoc/dist/index.js in /home/runner/work/_actions/the-guild-org/changesets-dependencies-action/v1.2.2/dist/index.js to a dynamic import() which is available in all CommonJS modules.

Would it be possible to ignore prettier completely and handle my own logic in the preCommit hook?
Right now I'm forced to install my prettier dependencies for the action not to break, due to me using a plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant