Skip to content

Suggestion: move pre-commit support to another repo #8925

@FloChehab

Description

@FloChehab

Hi,
First of all, thanks for the awesome tool, I have been using for a couple of years and have never been disappointed ! :)

This issue is more a of a question / suggestion, so sorry if it doesn't fit in the standard issue schema.

Context
I am currently using prettier to format files not related to JavaScript through the https://pre-commit.com/ integration. Because (from what I understand) pre-commit runs npm i . it's pretty slow and bandwidth intensive on this repo (takes around 40-50s to set up in our CI environment).
The other issue is that sometimes, sub-dependencies of prettier are broken (like today, see the error below - v2.0.5).

By looking at the npm page I see that prettier is actually a standalone package: https://www.npmjs.com/package/prettier ; and doing npm i prettier@2.0.5 takes actually less than 1 second, which is pretty great 🎉 .

So here is my suggestion:
Could it be possible to move the 'official' support of pre-commit to another git repo, that would have a simple package.json with only prettier and the same hook file as https://github.com/prettier/prettier/blob/master/.pre-commit-hooks.yaml ?

This would

  • Be faster to install (which is also good for the 🌍 ),
  • Avoid deps errors,
  • Require the fairly small maintenance of another repo.

I have currently switched to https://github.com/awebdeveloper/pre-commit-prettier which is kind of what I am suggesting, but without the native tag support.

Have a nice day !


Sub dependancies errors
An unexpected error has occurred: CalledProcessError: command: ('/home/jenkins/.cache/pre-commit/repole0tq7th/node_env-default/bin/node', '/home/jenkins/.cache/pre-commit/repole0tq7th/node_env-default/bin/npm', 'install')

return code: 1

expected return code: 0

stdout: (none)

stderr:

    npm WARN deprecated rollup-plugin-babel@4.4.0: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.

    npm WARN deprecated json-parser@1.1.5: `json-parser` is deprecated. Please use `comment-json` instead

    npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.

    npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated

    npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated

    npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.

    npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142

    npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

    npm WARN deprecated har-validator@5.1.5: this library is no longer supported

    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.2 (node_modules/jest-haste-map/node_modules/fsevents):

    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

    npm WARN notsup Unsupported engine for watchpack-chokidar2@2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"14.7.0","npm":"6.14.7"})

    npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2@2.0.0

    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):

    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

    npm WARN @rollup/plugin-commonjs@11.0.2 requires a peer of rollup@^1.20.0 but none is installed. You must install peer dependencies yourself.

    npm WARN @rollup/plugin-json@4.0.2 requires a peer of rollup@^1.20.0 but none is installed. You must install peer dependencies yourself.

    npm WARN @rollup/plugin-replace@2.3.1 requires a peer of rollup@^1.20.0 but none is installed. You must install peer dependencies yourself.

    npm WARN @rollup/plugin-node-resolve@7.1.1 requires a peer of rollup@^1.20.0 but none is installed. You must install peer dependencies yourself.

    npm WARN @rollup/plugin-alias@3.0.1 requires a peer of rollup@^1.20.0 but none is installed. You must install peer dependencies yourself.

    

    npm ERR! code E404

    npm ERR! 404 Not Found - GET https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-2.3.1.tgz

    npm ERR! 404 

    npm ERR! 404  '@rollup/plugin-replace@2.3.1' is not in the npm registry.

    npm ERR! 404 You should bug the author to publish it (or use the name yourself!)

    npm ERR! 404 It was specified as a dependency of 'repole0tq7th'

    npm ERR! 404 

    npm ERR! 404 Note that you can also install from a

    npm ERR! 404 tarball, folder, http url, or git url.

    

    npm ERR! A complete log of this run can be found in:

    npm ERR!     /home/jenkins/.npm/_logs/2020-08-06T09_02_33_456Z-debug.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliIssues with Prettier's Command Line Interfacelocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions