-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(simpleList): rename isCurrent to isActive
- Loading branch information
1 parent
33d04c4
commit 4aa5c7a
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/eslint-plugin-pf-codemods/lib/rules/v5/simpleList-remove-isCurrent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.` | ||
), | ||
}; |
24 changes: 24 additions & 0 deletions
24
packages/eslint-plugin-pf-codemods/test/rules/v5/simpleList-remove-isCurrent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
}] | ||
} | ||
] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters