Skip to content

Restrict importing from `enterprise` in OSS codebase

Administrator requested to merge eslint-enterprise-imports-rule into main

Created by: courier-new

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 of enterprise would need to include enterprise in its path.

The error looks like this:

image

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 https://github.com/eslint/eslint/issues/11843. It doesn't appear to have caused other breaking changes, but not sure if others on the team have other concerns to check.

Merge request reports

Loading