sindresorhus / awesome-lint

Linter for Awesome lists
MIT License
600 stars 56 forks source link

`Awesome list must reside in a valid git repository remark-lint:awesome-github` error has been wrongly prompted with `npx` command #180

Open tapyu opened 9 months ago

tapyu commented 9 months ago

By following the README.md instructions, we get

❯ npx --verbose awesome-lint https://github.com/tapyu/awesome-stem-academy
npm verb cli /usr/bin/node /usr/lib/node_modules/npm/bin/npm-cli.js
npm info using npm@10.2.4
npm info using node@v21.3.0
npm verb title npm exec awesome-lint https://github.com/tapyu/awesome-stem-academy
npm verb argv "exec" "--loglevel" "verbose" "--" "awesome-lint" "https://github.com/tapyu/awesome-stem-academy"
npm verb logfile logs-max:10 dir:/home/tapyu/.npm/_logs/2023-12-02T10_15_30_030Z-
npm verb logfile /home/tapyu/.npm/_logs/2023-12-02T10_15_30_030Z-debug-0.log
npm http fetch GET 200 https://registry.npmjs.org/awesome-lint 1367ms (cache revalidated)
✖ Linting

  README.md:1:1
  ✖  1:1  Git repository must be at least 30 days old         remark-lint:awesome-git-repo-age
  ✖  1:1  Awesome list must reside in a valid git repository  remark-lint:awesome-github

  2 errors

npm verb exit 1
npm verb code 1

The error Awesome list must reside in a valid git repository is wrong. No matter which repository you run, awesome-lint wrongly outputs this error.

On the other hand, by cloning this repository and running npm install followed by

npx --verbose awesome-lint https://github.com/tapyu/awesome-stem-academy

This error just disappear

❯ npx --verbose awesome-lint https://github.com/tapyu/awesome-stem-academy
npm verb cli /usr/bin/node /usr/lib/node_modules/npm/bin/npm-cli.js
npm info using npm@10.2.4
npm info using node@v21.3.0
npm verb title npm exec awesome-lint https://github.com/tapyu/awesome-stem-academy
npm verb argv "exec" "--loglevel" "verbose" "--" "awesome-lint" "https://github.com/tapyu/awesome-stem-academy"
npm verb logfile logs-max:10 dir:/home/tapyu/.npm/_logs/2023-12-02T10_13_50_887Z-
npm verb logfile /home/tapyu/.npm/_logs/2023-12-02T10_13_50_887Z-debug-0.log
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 705ms
✖ Linting

  README.md:1:1
  ✖  1:1  Git repository must be at least 30 days old  remark-lint:awesome-git-repo-age

  1 error

npm verb exit 1
npm verb code 1

I am pretty stupid when it comes to JavaScript. I have 0 knowledge in it, so I didn't find out what is going on. That was as far as I could go.

Futher information:

  ❯ neofetch --off
tapyu@tapyu-Inspiron-5570 
------------------------- 
OS: Ubuntu 22.04.3 LTS x86_64 
Host: Inspiron 5570 
Kernel: 6.2.0-37-generic 
Uptime: 14 mins 
Packages: 1754 (dpkg), 11 (snap) 
Shell: zsh 5.8.1 
Resolution: 1366x768 
DE: GNOME 42.9 
WM: Mutter 
WM Theme: Adwaita 
Theme: Yaru-dark [GTK2/3] 
Icons: Yaru [GTK2/3] 
Terminal: kitty 
CPU: Intel i5-8250U (8) @ 3.400GHz 
GPU: AMD ATI Radeon R7 M260/M265 / M340/M360 / M440/M445 / 530/535 / 620/625 Mobile 
GPU: Intel UHD Graphics 620 
Memory: 1491MiB / 2272MiB 
❯ npm --version
10.2.4
❯ node --version
v21.3.0
❯ npx awesome-lint --version
1.0.1
tapyu commented 9 months ago

The logfile of /home/tapyu/.npm/_logs/2023-12-02T10_15_30_030Z-debug-0.log contains

0 verbose cli /usr/bin/node /usr/lib/node_modules/npm/bin/npm-cli.js
1 info using npm@10.2.4
2 info using node@v21.3.0
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/usr/lib/node_modules/npm/npmrc Completed in 0ms
6 timing config:load:builtin Completed in 0ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:/home/tapyu/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/usr/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 1ms
14 timing config:load:setEnvs Completed in 0ms
15 timing config:load Completed in 5ms
16 timing npm:load:configload Completed in 5ms
17 timing config:load:flatten Completed in 2ms
18 timing npm:load:mkdirpcache Completed in 0ms
19 timing npm:load:mkdirplogs Completed in 0ms
20 verbose title npm exec awesome-lint https://github.com/tapyu/awesome-stem-academy
21 verbose argv "exec" "--loglevel" "verbose" "--" "awesome-lint" "https://github.com/tapyu/awesome-stem-academy"
22 timing npm:load:setTitle Completed in 1ms
23 timing npm:load:display Completed in 1ms
24 verbose logfile logs-max:10 dir:/home/tapyu/.npm/_logs/2023-12-02T20_37_02_809Z-
25 verbose logfile /home/tapyu/.npm/_logs/2023-12-02T20_37_02_809Z-debug-0.log
26 timing npm:load:logFile Completed in 6ms
27 timing npm:load:timers Completed in 0ms
28 timing npm:load:configScope Completed in 0ms
29 timing npm:load Completed in 26ms
30 silly logfile start cleaning logs, removing 1 files
31 silly logfile done cleaning log files
32 timing arborist:ctor Completed in 0ms
33 http fetch GET 200 https://registry.npmjs.org/awesome-lint 1154ms (cache revalidated)
34 timing arborist:ctor Completed in 0ms
35 timing arborist:ctor Completed in 0ms
36 timing arborist:ctor Completed in 0ms
37 timing command:exec Completed in 3000ms
38 verbose exit 1
39 timing npm Completed in 3123ms
40 verbose code 1

My humble guess it that https://registry.npmjs.org/awesome-lint dependency tree is outdated.

tapyu commented 9 months ago

Well, after some time, I realize that npx awesome-lint https://github.com/tapyu/awesome-stem-academy prompts Awesome list must reside in a valid git repository only if my current working directory doesn't contain .git/. I am sorry but that is clear neither by the error message nor by the readme.md. By "valid git repository" I understood the repository name, which must follow certain directives. Moreover, the readme.md doesn't explicitly say one must run npx awesome-lint within a git directory or it will prompt this error.

Honestly, I don't understand what is the point of this error. awesome-lint should analyze https://github.com/tapyu/awesome-stem-academy, not my current working directory. Anyway, if PR are welcome, I am pleased to open one to address this issue. Any discussion about it in order to make my PR useful would be great as well.

sindresorhus commented 9 months ago

The bug is that it requires being in a Git directory when a URL is passed. That should not be required.

tapyu commented 9 months ago

I see. While is bug is not fixed, it might be interesting to instruct users to run npx awesome-lint within a git repository, as I suggested in #182.