changesets-dependencies-action icon indicating copy to clipboard operation
changesets-dependencies-action copied to clipboard

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

Open christofferbergj opened this issue 1 year ago • 0 comments

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/[email protected][email protected]/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/[email protected][email protected]/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.

christofferbergj avatar Jan 18 '24 08:01 christofferbergj