Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/eslint-plugin-pf-codemods/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const rules = {
"chart-remove-allowZoom": require('./lib/rules/v4/chartVoronoiContainer-remove-allowTooltip'),
"react-icons-remove-icon": require('./lib/rules/v4/react-icons-remove-icon'),
"toolbar-remove-visiblity": require('./lib/rules/v5/toolbar-remove-visiblity'),
"divider-remove-isVertical": require('./lib/rules/v5/divider-remove-isVertical'),
};

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { renameProp } = require('../../helpers');

// https://github.com/patternfly/patternfly-react/pull/8199
module.exports = {
meta: { fixable: 'code' },
create: renameProp(
'Divider',
{'isVertical': `orientation={{ default: 'vertical' }}`},
node => `isVertical prop has been removed for ${node.name.name} and replaced with the orientation prop, which can specify verticality at various breakpoints.`
),
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const ruleTester = require('../../ruletester');
const rule = require('../../../lib/rules/v5/divider-remove-isVertical');

ruleTester.run("divider-remove-isVertical", rule, {
valid: [
{
code: `import { Divider } from '@patternfly/react-core'; <Divider />`,
},
{
// No @patternfly/react-core import
code: `<Divider />`,
}
],
invalid: [
{
code: `import { Divider } from '@patternfly/react-core'; <Divider isVertical />`,
output: `import { Divider } from '@patternfly/react-core'; <Divider orientation={{ default: 'vertical' }} />`,
errors: [{
message: `isVertical prop has been removed for Divider and replaced with the orientation prop, which can specify verticality at various breakpoints.`,
type: "JSXOpeningElement",
}]
}
]
});