Skip to content

Refactor relative cross-package imports to absolute ones via package name

Administrator requested to merge vb/cross-package-imports-eslint into main

Created by: valerybugakov

Closes #19562.

Changes

  • Added new ESLint rule that forbids cross-package relative imports.
  • All cross-package imports are auto-fixed by new ESLint rule.
import X from '../../shared/src/x'

👇

import X from '@sourcegraph/shared/src/x'

Note

ESLint auto-fixer for a new rule doesn't work correctly out of the box. I've patched it locally to process our repo. I plan to create a PR to ESLint rule later to fix this issue. In the meantime the rule itself correctly shows errors.

Merge request reports

Loading