Repository navigation
fix(oxlint-config): bundle the dependencies of @stylistic rules - #11
Merged
Merged
Conversation
@stylistic/eslint-plugin is built with rolldown, whose output loads the dependencies of its vendored code with a require() made by createRequire(). esbuild does not follow such calls, so dist/stylistic.js required @eslint-community/eslint-utils and @typescript-eslint/types at runtime. Neither is a dependency of the package: 0.1.0 fails to load in a project that does not have them installed. The tests did not notice, since the packages are installed in the repository as dev dependencies. The build now turns those calls into plain require() calls, which esbuild bundles, and fails if dist/ still loads a package other than a node built-in or the optional typescript. A new test loads dist/ from a directory without node_modules around it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
@bitrix24/oxlint-config-bitrix24@0.1.0fails to load in a project that does not happen to have@eslint-community/eslint-utilsinstalled:@stylistic/eslint-pluginis built with rolldown, whose output loads the dependencies of its vendored code with arequire()made bycreateRequire(import.meta.url). esbuild does not follow such calls, sodist/stylistic.jsrequired@eslint-community/eslint-utilsand@typescript-eslint/typesat runtime. Neither is a dependency of the package. The tests passed because both packages are installed in the repository as dev dependencies.oxlint-config-bitrix24-mobile@0.1.0is broken too, since it extends this preset.Fix
@stylistic/eslint-plugin/distinto plainrequire()calls, which esbuild bundles.dist/still loads a package other than a node built-in or the optionaltypescript(loaded by eslint-plugin-vue intry/catch).^0.1.0takes 0.1.1.Tests
dist/is copied to a directory with nonode_modulesaround it and every bundle is imported. It fails on 0.1.0 with the error above.oxlint-config-bitrix24: 184 tests pass.oxlint@1.87.0and@bitrix24/oxlint-config-bitrix24-mobile@0.1.0from npm lints with both presets: native rules,@stylistic,@bitrix24/bitrix24-rulesand the mobile overrides all report.After the merge, 0.1.1 is published through the workflow (once the trusted publisher is set up for the package), and 0.1.0 can be deprecated:
npm deprecate @bitrix24/oxlint-config-bitrix24@0.1.0 "Fails to load: use 0.1.1"