@drupal-canvas/eslint-config 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +38 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4447,7 +4447,7 @@ function checkImportSource(context, node, source) {
|
|
|
4447
4447
|
if (source.startsWith("@fontsource")) {
|
|
4448
4448
|
context.report({
|
|
4449
4449
|
node,
|
|
4450
|
-
message: `Importing font packages ("${source}") is not supported in components
|
|
4450
|
+
message: `Importing font packages ("${source}") is not supported in components.`
|
|
4451
4451
|
});
|
|
4452
4452
|
return;
|
|
4453
4453
|
}
|
|
@@ -4508,7 +4508,7 @@ function checkImportSource(context, node, source) {
|
|
|
4508
4508
|
if (source === "@/lib/FormattedText") {
|
|
4509
4509
|
context.report({
|
|
4510
4510
|
node,
|
|
4511
|
-
message: "The `FormattedText` component was moved into the `drupal-canvas` package.",
|
|
4511
|
+
message: "The `FormattedText` component was moved into the `drupal-canvas` package. The `@/lib/FormattedText` path is provided by Canvas and cannot be used for local files.",
|
|
4512
4512
|
fix(fixer) {
|
|
4513
4513
|
if (node.type === "ImportDeclaration" && node.specifiers.length === 1 && node.specifiers[0].local.name === "FormattedText") {
|
|
4514
4514
|
return fixer.replaceText(
|
|
@@ -4521,6 +4521,42 @@ function checkImportSource(context, node, source) {
|
|
|
4521
4521
|
});
|
|
4522
4522
|
return;
|
|
4523
4523
|
}
|
|
4524
|
+
if (source === "@/lib/utils") {
|
|
4525
|
+
context.report({
|
|
4526
|
+
node,
|
|
4527
|
+
message: "Utilities were moved into the `drupal-canvas` package. The `@/lib/utils` path is provided by Canvas and cannot be used for local files.",
|
|
4528
|
+
fix(fixer) {
|
|
4529
|
+
return fixer.replaceText(node.source, "'drupal-canvas'");
|
|
4530
|
+
}
|
|
4531
|
+
});
|
|
4532
|
+
return;
|
|
4533
|
+
}
|
|
4534
|
+
if (source === "@/lib/jsonapi-utils") {
|
|
4535
|
+
context.report({
|
|
4536
|
+
node,
|
|
4537
|
+
message: "JSON:API utilities were moved into the `drupal-canvas` package. The `@/lib/jsonapi-utils` path is provided by Canvas and cannot be used for local files.",
|
|
4538
|
+
fix(fixer) {
|
|
4539
|
+
return fixer.replaceText(node.source, "'drupal-canvas'");
|
|
4540
|
+
}
|
|
4541
|
+
});
|
|
4542
|
+
return;
|
|
4543
|
+
}
|
|
4544
|
+
if (source === "@/lib/drupal-utils") {
|
|
4545
|
+
context.report({
|
|
4546
|
+
node,
|
|
4547
|
+
message: "Drupal utilities were moved into the `drupal-canvas` package. The `@/lib/drupal-utils` path is provided by Canvas and cannot be used for local files.",
|
|
4548
|
+
fix(fixer) {
|
|
4549
|
+
const importsSortMenu = node.type === "ImportDeclaration" && node.specifiers.some(
|
|
4550
|
+
(specifier) => specifier.local.name === "sortMenu" || specifier.type === "ImportSpecifier" && specifier.imported.type === "Identifier" && specifier.imported.name === "sortMenu"
|
|
4551
|
+
);
|
|
4552
|
+
if (!importsSortMenu) {
|
|
4553
|
+
return fixer.replaceText(node.source, "'drupal-canvas'");
|
|
4554
|
+
}
|
|
4555
|
+
return null;
|
|
4556
|
+
}
|
|
4557
|
+
});
|
|
4558
|
+
return;
|
|
4559
|
+
}
|
|
4524
4560
|
if (source.startsWith("@/")) {
|
|
4525
4561
|
const suffix = source.slice(2);
|
|
4526
4562
|
const config = resolveCanvasConfig({ hostRoot: context.cwd });
|