diff --git a/.gitignore b/.gitignore index 377354f8..ef5e9729 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,7 @@ lerna-output.txt .idea test/packages/* .DS_Store -dist \ No newline at end of file +dist + +# IDE - VSCode +.history \ No newline at end of file diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListAction-remove-isPlainButtonAction-prop.md b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListAction-remove-isPlainButtonAction-prop.md new file mode 100644 index 00000000..797ed5c5 --- /dev/null +++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListAction-remove-isPlainButtonAction-prop.md @@ -0,0 +1,17 @@ +### dataListAction-remove-isPlainButtonAction-prop [(#10939)](https://github.com/patternfly/patternfly-react/pull/10939) + +The `isPlainButtonAction` prop has been removed from DataListAction as a wrapper is no longer needed. + +#### Examples + +In: + +```jsx +%inputExample% +``` + +Out: + +```jsx +%outputExample% +``` diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListAction-remove-isPlainButtonAction-prop.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListAction-remove-isPlainButtonAction-prop.test.ts new file mode 100644 index 00000000..94434b8b --- /dev/null +++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListAction-remove-isPlainButtonAction-prop.test.ts @@ -0,0 +1,25 @@ +const ruleTester = require("../../ruletester"); +import * as rule from "./dataListAction-remove-isPlainButtonAction-prop"; + +ruleTester.run("dataListAction-remove-isPlainButtonAction-prop", rule, { + valid: [ + { + code: ``, + }, + { + code: `import { DataListAction } from '@patternfly/react-core'; `, + }, + ], + invalid: [ + { + code: `import { DataListAction } from '@patternfly/react-core'; `, + output: `import { DataListAction } from '@patternfly/react-core'; `, + errors: [ + { + message: `The \`isPlainButtonAction\` prop has been removed from DataListAction as a wrapper is no longer needed.`, + type: "JSXOpeningElement", + }, + ], + }, + ], +}); diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListAction-remove-isPlainButtonAction-prop.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListAction-remove-isPlainButtonAction-prop.ts new file mode 100644 index 00000000..3019e043 --- /dev/null +++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListAction-remove-isPlainButtonAction-prop.ts @@ -0,0 +1,15 @@ +import { renameProps } from "../../helpers"; + +// https://github.com/patternfly/patternfly-react/pull/10939 +module.exports = { + meta: { fixable: "code" }, + create: renameProps({ + DataListAction: { + isPlainButtonAction: { + newName: "", + message: + "The `isPlainButtonAction` prop has been removed from DataListAction as a wrapper is no longer needed.", + }, + }, + }), +}; diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListActionRemoveIsPlainButtonActionPropInput.tsx b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListActionRemoveIsPlainButtonActionPropInput.tsx new file mode 100644 index 00000000..0a05d379 --- /dev/null +++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListActionRemoveIsPlainButtonActionPropInput.tsx @@ -0,0 +1,5 @@ +import { DataListAction } from "@patternfly/react-core"; + +export const DataListActionRemoveIsPlainButtonActionPropInput = () => ( + +); diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListActionRemoveIsPlainButtonActionPropOutput.tsx b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListActionRemoveIsPlainButtonActionPropOutput.tsx new file mode 100644 index 00000000..fe969791 --- /dev/null +++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListActionRemoveIsPlainButtonActionPropOutput.tsx @@ -0,0 +1,5 @@ +import { DataListAction } from "@patternfly/react-core"; + +export const DataListActionRemoveIsPlainButtonActionPropInput = () => ( + +);