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

Create .pre-commit-hooks.yaml #581

Merged
merged 1 commit into from
Mar 23, 2023
Merged

Create .pre-commit-hooks.yaml #581

merged 1 commit into from
Mar 23, 2023

Conversation

killermoehre
Copy link
Contributor

@killermoehre killermoehre commented Mar 23, 2023

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Feature: pre-commit is a standard on how to integrate your repository with commands running before commit.

  • What is the current behaviour? (You can also link to an open issue here)

Closes: #493

  • What is the new behaviour (if this is a feature change)?

Easier use.

  • Other information:

If the gh-super-linter can use this, then pre-commit should be a no-brainer.


This change is Reviewable

`pre-commit` is a standard on how to integrate your repository with
commands running before commit.
@kucherenko kucherenko merged commit 9d0c1ae into kucherenko:master Mar 23, 2023
@killermoehre killermoehre deleted the feature/add-pre-commit-hook branch March 24, 2023 15:08
@killermoehre
Copy link
Contributor Author

@kucherenko can you do a new release/tag as well? Or cherry-pick this file back onto the v3.5.3 tag? Else, pre-commit can't pick it up.

@kucherenko
Copy link
Owner

@killermoehre jscpd@3.5.4 just released

@killermoehre
Copy link
Contributor Author

Hmm, interesting. It breaks. @kucherenko

$ pre-commit run jscpd
[INFO] Initializing environment for https://github.com/kucherenko/jscpd.
[INFO] Installing environment for https://github.com/kucherenko/jscpd.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('~/.cache/pre-commit/reporrbwearr/node_env-system/bin/node', '/opt/homebrew/bin/npm', 'install', '--dev', '--prod', '--ignore-prepublish', '--no-progress', '--no-save')
return code: 1
stdout: (none)
stderr:
    npm WARN config dev Please use --include=dev instead.
    npm WARN config production Use `--omit=dev` instead.
    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE unable to resolve dependency tree
    npm ERR!
    npm ERR! While resolving: jscpd-monorepo@3.3.0-rc.0
    npm ERR! Found: typedoc@0.17.6
    npm ERR! node_modules/typedoc
    npm ERR!   dev typedoc@"~0.17.6" from the root project
    npm ERR!
    npm ERR! Could not resolve dependency:
    npm ERR! peer typedoc@"^0.16.7" from typedoc-plugin-lerna-packages@0.3.0
    npm ERR! node_modules/typedoc-plugin-lerna-packages
    npm ERR!   dev typedoc-plugin-lerna-packages@"~0.3.0" from the root project
    npm ERR!
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
    npm ERR!
    npm ERR!
    npm ERR! For a full report see:
    npm ERR! ~/.npm/_logs/2023-03-28T14_50_28_710Z-eresolve-report.txt

    npm ERR! A complete log of this run can be found in:
    npm ERR!     ~/.npm/_logs/2023-03-28T14_50_28_710Z-debug-0.log
Check the log at ~/.cache/pre-commit/pre-commit.log

~/.npm/_logs/2023-03-28T14_50_28_710Z-eresolve-report.txt

'Log files:
~/.npm/_logs/2023-03-28T14_50_28_710Z-debug-0.log

# npm resolution error report

While resolving: jscpd-monorepo@3.3.0-rc.0
Found: typedoc@0.17.6
node_modules/typedoc
  dev typedoc@"~0.17.6" from the root project

Could not resolve dependency:
peer typedoc@"^0.16.7" from typedoc-plugin-lerna-packages@0.3.0
node_modules/typedoc-plugin-lerna-packages
  dev typedoc-plugin-lerna-packages@"~0.3.0" from the root project

Fix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

~/.npm/_logs/2023-03-28T14_50_28_710Z-debug-0.log

0 verbose cli /opt/homebrew/Cellar/node/19.6.0/bin/node /opt/homebrew/bin/npm
1 info using npm@9.4.0
2 info using node@v19.6.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:/opt/homebrew/lib/node_modules/npm/npmrc Completed in 4ms
6 timing config:load:builtin Completed in 4ms
7 warn config dev Please use --include=dev instead.
8 warn config production Use `--omit=dev` instead.
9 timing config:load:cli Completed in 1ms
10 timing config:load:env Completed in 0ms
11 timing config:load:file:~/.cache/pre-commit/reporrbwearr/.npmrc Completed in 0ms
12 timing config:load:project Completed in 1ms
13 timing config:load:file:~/.npmrc Completed in 3ms
14 timing config:load:user Completed in 3ms
15 timing config:load:file:~/.cache/pre-commit/reporrbwearr/node_env-system/etc/npmrc Completed in 0ms
16 timing config:load:global Completed in 0ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 11ms
19 timing npm:load:configload Completed in 11ms
20 timing npm:load:mkdirpcache Completed in 0ms
21 timing npm:load:mkdirplogs Completed in 0ms
22 verbose title npm install
23 verbose argv "install" "--dev" "--prod" "--ignore-prepublish" "--no-progress" "--no-save"
24 timing npm:load:setTitle Completed in 2ms
25 timing config:load:flatten Completed in 2ms
26 timing npm:load:display Completed in 3ms
27 verbose logfile logs-max:10 dir:~/.npm/_logs/2023-03-28T14_50_28_710Z-
28 verbose logfile ~/.npm/_logs/2023-03-28T14_50_28_710Z-debug-0.log
29 timing npm:load:logFile Completed in 2ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 20ms
33 timing arborist:ctor Completed in 1ms
34 silly logfile start cleaning logs, removing 1 files
35 silly logfile done cleaning log files
36 timing arborist:ctor Completed in 0ms
37 timing idealTree:init Completed in 60ms
38 timing idealTree:userRequests Completed in 0ms
39 silly idealTree buildDeps
40 silly fetch manifest codecov@3.7.2
41 http fetch GET 200 https://registry.npmjs.org/codecov 892ms (cache revalidated)
42 silly fetch manifest @istanbuljs/nyc-config-typescript@1.0.1
43 http fetch GET 200 https://registry.npmjs.org/@istanbuljs%2fnyc-config-typescript 130ms (cache revalidated)
44 silly fetch manifest nyc@15.0.1
45 http fetch GET 200 https://registry.npmjs.org/nyc 72ms (cache revalidated)
46 silly fetch manifest source-map-support@0.5.19
47 http fetch GET 200 https://registry.npmjs.org/source-map-support 72ms (cache revalidated)
48 silly fetch manifest ts-node@*
49 http fetch GET 200 https://registry.npmjs.org/ts-node 70ms (cache revalidated)
50 silly fetch manifest @swc/core@>=1.2.50
51 http fetch GET 200 https://registry.npmjs.org/@swc%2fcore 120ms (cache revalidated)
52 silly fetch manifest @swc/wasm@>=1.2.50
53 http fetch GET 200 https://registry.npmjs.org/@swc%2fwasm 132ms (cache revalidated)
54 silly fetch manifest @types/node@13.11.1
55 http fetch GET 200 https://registry.npmjs.org/@types%2fnode 416ms (cache updated)
56 silly fetch manifest typescript@3.8.3
57 http fetch GET 200 https://registry.npmjs.org/typescript 1169ms (cache updated)
58 silly fetch manifest @types/chai@4.2.11
59 http fetch GET 200 https://registry.npmjs.org/@types%2fchai 79ms (cache revalidated)
60 silly fetch manifest @types/mocha@7.0.2
61 http fetch GET 200 https://registry.npmjs.org/@types%2fmocha 734ms (cache revalidated)
62 silly fetch manifest @types/proxyquire@1.3.28
63 http fetch GET 200 https://registry.npmjs.org/@types%2fproxyquire 85ms (cache revalidated)
64 silly fetch manifest @types/sinon@9.0.0
65 http fetch GET 200 https://registry.npmjs.org/@types%2fsinon 85ms (cache revalidated)
66 silly fetch manifest @typescript-eslint/eslint-plugin@2.30.0
67 http fetch GET 200 https://registry.npmjs.org/@typescript-eslint%2feslint-plugin 864ms (cache updated)
68 silly fetch manifest @typescript-eslint/parser@2.30.0
69 http fetch GET 200 https://registry.npmjs.org/@typescript-eslint%2fparser 914ms (cache updated)
70 silly fetch manifest eslint@6.8.0
71 http fetch GET 200 https://registry.npmjs.org/eslint 74ms (cache revalidated)
72 silly fetch manifest chai@4.2.0
73 http fetch GET 200 https://registry.npmjs.org/chai 73ms (cache revalidated)
74 silly fetch manifest conventional-changelog-cli@2.0.31
75 http fetch GET 200 https://registry.npmjs.org/conventional-changelog-cli 855ms (cache revalidated)
76 silly fetch manifest cz-conventional-changelog@3.1.0
77 http fetch GET 200 https://registry.npmjs.org/cz-conventional-changelog 75ms (cache revalidated)
78 silly fetch manifest eslint-plugin-sonarjs@0.5.0
79 http fetch GET 200 https://registry.npmjs.org/eslint-plugin-sonarjs 67ms (cache revalidated)
80 silly fetch manifest gh-pages@2.2.0
81 http fetch GET 200 https://registry.npmjs.org/gh-pages 767ms (cache revalidated)
82 silly fetch manifest git-cz@4.3.1
83 http fetch GET 200 https://registry.npmjs.org/git-cz 812ms (cache revalidated)
84 silly fetch manifest lerna@3.20.2
85 http fetch GET 200 https://registry.npmjs.org/lerna 111ms (cache updated)
86 silly fetch manifest lerna-changelog@1.0.1
87 http fetch GET 200 https://registry.npmjs.org/lerna-changelog 250ms (cache revalidated)
88 silly fetch manifest mocha@7.1.2
89 http fetch GET 200 https://registry.npmjs.org/mocha 81ms (cache revalidated)
90 silly fetch manifest npm-run-all@4.1.5
91 http fetch GET 200 https://registry.npmjs.org/npm-run-all 774ms (cache revalidated)
92 silly fetch manifest open-cli@5.0.0
93 http fetch GET 200 https://registry.npmjs.org/open-cli 71ms (cache revalidated)
94 silly fetch manifest proxyquire@2.1.3
95 http fetch GET 200 https://registry.npmjs.org/proxyquire 70ms (cache revalidated)
96 silly fetch manifest sinon@9.0.2
97 http fetch GET 200 https://registry.npmjs.org/sinon 98ms (cache updated)
98 silly fetch manifest snyk@1.314.0
99 http fetch GET 200 https://registry.npmjs.org/snyk 848ms (cache updated)
100 silly fetch manifest typedoc@0.17.6
101 http fetch GET 200 https://registry.npmjs.org/typedoc 138ms (cache updated)
102 silly fetch manifest typedoc-plugin-lerna-packages@0.3.0
103 http fetch GET 200 https://registry.npmjs.org/typedoc-plugin-lerna-packages 773ms (cache revalidated)
104 silly fetch manifest typedoc@^0.16.7
105 timing idealTree Completed in 12023ms
106 timing command:install Completed in 12026ms
107 verbose stack Error: unable to resolve dependency tree
107 verbose stack     at [failPeerConflict] (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1381:25)
107 verbose stack     at [loadPeerSet] (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1347:34)
107 verbose stack     at async [buildDepStep] (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:929:11)
107 verbose stack     at async Arborist.buildIdealTree (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:207:7)
107 verbose stack     at async Promise.all (index 1)
107 verbose stack     at async Arborist.reify (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:160:5)
107 verbose stack     at async Install.exec (/opt/homebrew/lib/node_modules/npm/lib/commands/install.js:146:5)
107 verbose stack     at async module.exports (/opt/homebrew/lib/node_modules/npm/lib/cli.js:134:5)
108 verbose cwd ~/.cache/pre-commit/reporrbwearr
109 verbose Darwin 22.3.0
110 verbose node v19.6.0
111 verbose npm  v9.4.0
112 error code ERESOLVE
113 error ERESOLVE unable to resolve dependency tree
114 error
115 error While resolving: jscpd-monorepo@3.3.0-rc.0
115 error Found: typedoc@0.17.6
115 error node_modules/typedoc
115 error   dev typedoc@"~0.17.6" from the root project
115 error
115 error Could not resolve dependency:
115 error peer typedoc@"^0.16.7" from typedoc-plugin-lerna-packages@0.3.0
115 error node_modules/typedoc-plugin-lerna-packages
115 error   dev typedoc-plugin-lerna-packages@"~0.3.0" from the root project
115 error
115 error Fix the upstream dependency conflict, or retry
115 error this command with --force or --legacy-peer-deps
115 error to accept an incorrect (and potentially broken) dependency resolution.
116 error
116 error
116 error For a full report see:
116 error ~/.npm/_logs/2023-03-28T14_50_28_710Z-eresolve-report.txt
117 verbose exit 1
118 timing npm Completed in 12093ms
119 verbose unfinished npm timer reify 1680015028778
120 verbose unfinished npm timer reify:loadTrees 1680015028780
121 verbose unfinished npm timer idealTree:buildDeps 1680015028840
122 verbose unfinished npm timer idealTree:#root 1680015028840
123 verbose code 1
124 error A complete log of this run can be found in:
124 error     ~/.npm/_logs/2023-03-28T14_50_28_710Z-debug-0.log

@kucherenko
Copy link
Owner

@killermoehre I think the pre-commit should be located in packages/jscpd folder.

@killermoehre
Copy link
Contributor Author

killermoehre commented Mar 29, 2023

Well, pre-commit just does a

git clone $repo
cd $repo
npm install .

There is no magic here, as far as I understand node modules.

Also, cd packages/jscpd && npm install . still fails with ERESOLVE.

@killermoehre
Copy link
Contributor Author

Ha, I got a solution. Will open another PR. Thank you for your patience.

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

Successfully merging this pull request may close these issues.

Offer pre-commit Hook
2 participants