Skip to content

Commit

Permalink
feat(Masthead): Remove backgroundColor prop
Browse files Browse the repository at this point in the history
  • Loading branch information
wise-king-sullyman committed Feb 15, 2024
1 parent 18edec9 commit 15df1ac
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 80 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test:v6": "yarn build && mocha packages/eslint-plugin-pf-codemods/dist/js/rules/v6/*/*.test.js",
"test:v4:single": "pf-codemods --v4 --no-cache test/v4test.tsx",
"test:v5:single": "pf-codemods --no-cache test/test.tsx",
"test:v6:single": "yarn build && pf-codemods --v6 --no-cache packages/eslint-plugin-pf-codemods/src/rules/v6/*/*.tsx",
"test:v6:single": "yarn build && pf-codemods --v6 --no-cache packages/eslint-plugin-pf-codemods/src/rules/v6/*/*Input.tsx",
"test:koku": "pf-codemods --no-cache test/koku-ui",
"test:console": "pf-codemods --no-cache test/console/frontend",
"test:integreatly": "pf-codemods --no-cache test/tutorial-web-app",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
### masthead-remove-background-color [(#9744)](https://github.com/patternfly/patternfly-react/pull/9744)

We've removed the `backgroundColor` prop from Masthead as theming is no longer handled React-side.

#### Examples

In:

```jsx
%inputExample%
```

Out:

```jsx
%outputExample%
```

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const ruleTester = require('../../ruletester');
import * as rule from './masthead-remove-background-color';

ruleTester.run("masthead-remove-background-color", rule, {
valid: [
{
code: `<Masthead backgroundColor />`
}
],
invalid: [
{
code: `import { Masthead } from '@patternfly/react-core'; <Masthead backgroundColor />`,
output: `import { Masthead } from '@patternfly/react-core'; <Masthead />`,
errors: [{
message: `We've removed the \`backgroundColor\` prop from Masthead as theming is no longer handled React-side.`,
type: "JSXOpeningElement",
}]
},
]
});

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { renameProps } from '../../helpers';

// https://github.com/patternfly/patternfly-react/pull/9744
module.exports = {
meta: { fixable: 'code' },
create: renameProps({
Masthead: {
"backgroundColor": {
newName: "",
message: () =>
"We've removed the `backgroundColor` prop from Masthead as theming is no longer handled React-side.",
},
},
}),
};

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Masthead } from "@patternfly/react-core";

export const MastheadRemoveBackgroundColorInput = () => <Masthead backgroundColor />
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Masthead } from "@patternfly/react-core";

export const MastheadRemoveBackgroundColorInput = () => <Masthead />
12 changes: 6 additions & 6 deletions packages/pf-codemods/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,25 @@ These rules are based off the breaking change notes for React. Each rule links t

Some rules will add either a comment (`/* data-codemods */`) or data attribute (`data-codemods="true"`) in order to prevent certain other rules from applying an unnecessary fix.

### example-rule[(#1234)](https://github.com/patternfly/patternfly-react/pull/1234)
### masthead-remove-background-color [(#9744)](https://github.com/patternfly/patternfly-react/pull/9744)

We've renamed the `ComponentName` component to `NewComponentName`.
We've removed the `backgroundColor` prop from Masthead as theming is no longer handled React-side.

#### Examples

In:

```jsx
import { ComponentName } from "@patternfly/react-core";
import { Masthead } from "@patternfly/react-core";

export const ExampleRule = () => <ComponentName propName="foo">Body</ComponentName>;
export const MastheadRemoveBackgroundColorInput = () => <Masthead backgroundColor />
```

Out:

```jsx
import { ComponentName } from "@patternfly/react-core";
import { Masthead } from "@patternfly/react-core";

export const ExampleRule = () => <ComponentName >Body</ComponentName>;
export const MastheadRemoveBackgroundColorInput = () => <Masthead />
```

0 comments on commit 15df1ac

Please sign in to comment.