javascript icon indicating copy to clipboard operation
javascript copied to clipboard

Add eslint rule to avoid direct import from other packages.

Open abotteram opened this issue 6 years ago • 0 comments

Explanation

When importing a dependency we should not allow "direct" imports (from other packages) like this:

import transliterate from "yoastseo/src/stringProcessing/transliterate"; instead we should use this:

import { string } from "yoastseo";
const { transliterate } = string;

This is because direct imports cause problems in the plugin's webpack configuration.

To avoid problems in the future we should have an eslint rule that prohibits direct imports across packages.

Technical decisions

Feedback?

abotteram avatar May 06 '19 11:05 abotteram