Trouble with eslint since recent change to plugin-skeleton because failed to run yarn install

I copied stuff over from GitHub - discourse/discourse-plugin-skeleton: Template for Discourse plugins today since this commit DEV: Update linting setup (#41) · discourse/discourse-plugin-skeleton@a92be1d · GitHub

and the good news is that git now runs tests locally before submitting to github, which I hope will save me lots of time (as I still don’t have vscode doing the formatting and linting that I think it should when I save, but that’s another sad story). The bummer is that it’s failing, apparently because it can’t find stuff that’s at github?

EDIT: I found this: GitHub - discourse/lint-configs, but I still don’t understand what I’m doing wrong.

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
yarn run v1.22.21
$ /home/pfaffman/src/pfaffman/discourse-pfaffmanager/node_modules/.bin/ember-template-lint assets/javascripts
Done in 0.79s.
yarn run v1.22.21
$ /home/pfaffman/src/pfaffman/discourse-pfaffmanager/node_modules/.bin/eslint --ext .js,.js.es6 --no-error-on-unmatched-pattern {test,assets}/javascripts

Oops! Something went wrong! :(

ESLint: 7.19.0

Error: Cannot read config file: /home/pfaffman/src/pfaffman/discourse-pfaffmanager/.eslintrc.cjs
Error: Cannot find module '@discourse/lint-configs/eslint'
Require stack:
- /home/pfaffman/src/pfaffman/discourse-pfaffmanager/.eslintrc.cjs
- /home/pfaffman/src/pfaffman/discourse-pfaffmanager/node_modules/@eslint/eslintrc/lib/config-array-factory.js
- /home/pfaffman/src/pfaffman/discourse-pfaffmanager/node_modules/@eslint/eslintrc/lib/index.js
- /home/pfaffman/src/pfaffman/discourse-pfaffmanager/node_modules/eslint/lib/cli-engine/cli-engine.js
- /home/pfaffman/src/pfaffman/discourse-pfaffmanager/node_modules/eslint/lib/eslint/eslint.js
- /home/pfaffman/src/pfaffman/discourse-pfaffmanager/node_modules/eslint/lib/eslint/index.js
- /home/pfaffman/src/pfaffman/discourse-pfaffmanager/node_modules/eslint/lib/cli.js
- /home/pfaffman/src/pfaffman/discourse-pfaffmanager/node_modules/eslint/bin/eslint.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (/home/pfaffman/src/pfaffman/discourse-pfaffmanager/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/home/pfaffman/src/pfaffman/discourse-pfaffmanager/.eslintrc.cjs:1:80)
    at Module._compile (/home/pfaffman/src/pfaffman/discourse-pfaffmanager/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

EDIT: Looks like eslint was too old and I needed to do a

yarn install

after I updated the package.json.

2 Likes