-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Tabs): added warning that the type of Tabs children is now limited #220
feat(Tabs): added warning that the type of Tabs children is now limited #220
Conversation
|
||
// Update index file | ||
const ruleIndexPath = path.join(__dirname, 'packages/eslint-plugin-pf-codemods/index.js'); | ||
const ruleIndex = fs.readFileSync(ruleIndexPath, 'utf8'); | ||
fs.writeFileSync( | ||
ruleIndexPath, | ||
// (ab)Use fact that `rules` object is at top of file | ||
ruleIndex.replace("};", ` "${newRuleName}": require('./lib/rules/v5/${newRuleName}'),\n};`) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed as the index file no longer needs to be manually updated with rule names.
if (TabsImport) { | ||
context.report({ | ||
node, | ||
message: "Children of the 'Tabs' component must now be 'Tab' components or expressions resulting in a falsy value.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love this message, but it was the best I could come up with. 100% open to suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk why but when i see "children of the" i think "corn" 😆
how about "Tabs
component children must be Tab
components"
maybe add "or falsy", not sure that the expressions part needs to be mentioned. technically it would be "expressions resulting in either falsy value or a Tab component"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The children
prop of the Tabs component must now be passed a Tab component or a falsy value."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thatblindgeye I like the sound of that, but since children
isn't usually used explicitly as a prop I wonder if that might trip people up 🤔
@gitdallas so your suggestion would be "Tabs component children must be Tab components or expressions resulting in either falsy value or a Tab component" in its full form?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wise-king-sullyman - i really don't think the mention of expressions is necessary, anything could be expression but that doesn't matter... all that matters is what comes out of the expression. if you believe it's important to mention expressions, lmk the thoughts behind that.
i was thinking "Tabs
component children must be Tab
components or a falsy value", I guess... or in Eric's format we could have "The children
of the Tabs
component must now be passed a Tab
component or a falsy value."
2f357ee
to
27ee094
Compare
@@ -0,0 +1,23 @@ | |||
const { getPackageImports } = require("../../helpers"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
Closes #168