Skip to content

Commit

Permalink
feat(simpleList): rename isCurrent to isActive
Browse files Browse the repository at this point in the history
  • Loading branch information
wise-king-sullyman committed Jan 3, 2023
1 parent 33d04c4 commit 4aa5c7a
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
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 @@ -46,6 +46,7 @@ const rules = {
"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'),
"simpleList-remove-isCurrent": require('./lib/rules/v5/simpleList-remove-isCurrent')
};

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/8132
module.exports = {
meta: { fixable: 'code' },
create: renameProp(
'SimpleList',
{'isCurrent': 'isActive'},
node => `isCurrent prop has been removed for ${node.name.name} and replaced with the isActive prop.`
),
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const ruleTester = require('../../ruletester');
const rule = require('../../../lib/rules/v5/simpleList-remove-isCurrent');

ruleTester.run("simpleList-remove-isCurrent", rule, {
valid: [
{
code: `import { SimpleList } from '@patternfly/react-core'; <SimpleList isActive />`,
},
{
// No @patternfly/react-core import
code: `<SimpleList isCurrent />`,
}
],
invalid: [
{
code: `import { SimpleList } from '@patternfly/react-core'; <SimpleList isCurrent />`,
output: `import { SimpleList } from '@patternfly/react-core'; <SimpleList isActive />`,
errors: [{
message: `isCurrent prop has been removed for SimpleList and replaced with the isActive prop.`,
type: "JSXOpeningElement",
}]
}
]
});
18 changes: 18 additions & 0 deletions packages/pf-codemods/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,21 @@ Out:
```jsx
<ToolbarContent visibility={{ default: "hidden" }} />
```

### simpleList-remove-isCurrent [(#8132)](https://github.com/patternfly/patternfly-react/pull/8132)

We've removed the deprecated the `isCurrent` prop. This rule wil replace it with `isActive`.

#### Examples

In:

```jsx
<SimpleList isCurrent />
```

Out:

```jsx
<SimpleList isActive />
```

0 comments on commit 4aa5c7a

Please sign in to comment.