Skip to content

Document additional_dependencies with Stylelint 17 - #5

Open
monosans wants to merge 1 commit into
awebdeveloper:masterfrom
monosans:docs-stylelint-17
Open

monosans wants to merge 1 commit into
awebdeveloper:masterfrom
monosans:docs-stylelint-17

Conversation

@monosans

Copy link
Copy Markdown

Since v17, Stylelint can't find shareable configs or plugins installed with additional_dependencies, so the setup in the README fails with Could not find "stylelint-config-standard". pre-commit puts the hook environment's node_modules on NODE_PATH. Stylelint 16 found packages there through its resolve-from fallback, which stylelint/stylelint#8886 removed.

This adds a "Stylelint 17 and later" section with the error, the cause and a stylelint.config.mjs that resolves the packages with require.resolve. For ESM-only packages like stylelint-config-standard-scss, which require can't resolve, it falls back to the package's index.js.

I checked it against this hook with stylelint 17.16.0 and stylelint-config-standard 40.0.0 under pre-commit and prek on Linux, with no node_modules in the project.

🤖 Generated with Claude Code

Stylelint 17 no longer falls back to NODE_PATH, so configs and plugins
installed with additional_dependencies aren't found by name. Add the
error, the cause and a config that works around it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant