This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
Restrict importing from enterprise
in OSS codebase
#23044
Merged
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.
Adds an ESLint rule with the same intention as ts-enterprise-import.sh to help provide earlier feedback about mixing enterprise code into the OSS codebase. For the many of us who have ESLint integration set up with our editors, this will provide the feedback at the time the code is being written, as opposed to at the time the checks are being run.
We can actually spot these pretty easily by just searching for the import pattern
**/enterprise/*
since most of our imports use relative paths: only an import from a file outside ofenterprise
would need to includeenterprise
in its path.The error looks like this:
Tagging @sourcegraph/frontend-devs because I also upgraded ESLint in order to take advantage of the recently-added support for custom error messages with this rule's
patterns
eslint/eslint#11843. It doesn't appear to have caused other breaking changes, but not sure if others on the team have other concerns to check.