Skip to content

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

@christofferbergj

Description

@christofferbergj

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions