Skip to content

Commit

Permalink
Improve error message of collocated fragments.
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNuc committed Aug 18, 2023
1 parent a7d245a commit fd14d08
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/rule-must-colocate-fragment-spreads.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <nameOfComponentCamelCase>_<optionalSuffix>. ` +
`The <nameOfComponentCamelCase> 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`
});
}
}
Expand Down

0 comments on commit fd14d08

Please sign in to comment.