From fd14d0803634085b227f2f47397f89d2b9c46457 Mon Sep 17 00:00:00 2001 From: MartinNuc Date: Fri, 18 Aug 2023 11:12:15 +0200 Subject: [PATCH] Improve error message of collocated fragments. --- src/rule-must-colocate-fragment-spreads.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/rule-must-colocate-fragment-spreads.js b/src/rule-must-colocate-fragment-spreads.js index 5e29f59..596c2c1 100644 --- a/src/rule-must-colocate-fragment-spreads.js +++ b/src/rule-must-colocate-fragment-spreads.js @@ -155,10 +155,12 @@ function checkColocation(context) { loc: utils.getLoc(context, node, queriedFragments[fragment]), message: `This spreads the fragment \`${fragment}\` but ` + - 'this module does not use it directly. If a different module ' + - 'needs this information, that module should directly define a ' + - 'fragment querying for that data, colocated next to where the ' + - 'data is used.\n' + `this module does not use it directly or it the fragment is named incorrectly. If a different module ` + + `needs the data from this fragment, that module should directly define it's own fragment ` + + `to query for it's own data, and such fragment should be spread in the parent component.` + + `The naming convention should be _. ` + + `The should match the import name. Optinal suffix should be separated ` + + `by underscore (usually when you need to pass multiple fragments to the same component).\n` }); } }