A recent change on Discourse main branch (https://github.com/discourse/discourse/commit/e84d7c9f26ed) broke our way of linting the custom plugins we’re working on.
The PR/commit subject was
DEV: Update
bin/lintto work correctly for non-bundled plugins
So I’m wondering if we’re doing something entirely wrong with our linting workflow (cc @david).
How I lint
The way I was using bin/lint was, to run it from Discourse root and point it to my plugin inside the plugin directory:
bin/lint --fix plugins/my-custom-plugin
That broken with the commit mentioned above. pnpm errors about being run in a plugin directory and then isn’t able to find the files any more. One example from the error output:
> pnpm was run inside a plugin directory. Re-executing with --ignore-workspace...
NoFilesFoundError: No files matching the pattern "plugins/zlb-community/assets/stylesheets/common/atoms/category-button.scss, plugins/zlb-community/assets/stylesheets/common/atoms/category-icon.scss, plugins/zlb-community/assets/stylesheets/common/atoms/icon-info.scss, plugins/zlb-community/assets/stylesheets/common/atoms/user-pill.scss, plugins/zlb-community/assets/stylesheets/common/base/grid.scss, plugins/zlb-community/assets/stylesheets/common/base/normalize.scss, plugins/zlb-community/assets/stylesheets/common/base/rich-text.scss, plugins/zlb-community/assets/stylesheets/common/base/stack.scss, plugins/zlb-community/assets/stylesheets/common/index.scss, plugins/zlb-community/assets/stylesheets/common/molecules/card.scss, plugins/zlb-community/assets/stylesheets/common/molecules/expander.scss, plugins/zlb-community/assets/stylesheets/common/molecules/header.scss, plugins/zlb-community/assets/stylesheets/common/molecules/user-pill-list.scss, plugins/zlb-community/assets/stylesheets/common/organisms/category-header.scss, plugins/zlb-community/assets/stylesheets/common/templates/lobby.scss, plugins/zlb-community/assets/stylesheets/community-sidebar.scss, plugins/zlb-community/assets/stylesheets/user_home.scss, plugins/zlb-community/assets/stylesheets/common/atoms/badge.scss" were found.
at standalone (file:///Users/max/code/bitcrowd/zlb/discourse/plugins/zlb-community/node_modules/.pnpm/stylelint@17.5.0_typescript@5.9.3/node_modules/stylelint/lib/standalone.mjs:293:43)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
It worked perfectly fine before. How (unless I go back to the commit before the change…) I can only lint globally with bin/lint in root. But that obviously takes way longer.
Should this be done differently?