Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Chip) update to deprecated path #588

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const warningRules = [
// rules that will run before other rules (move to deprecated?)
export const setupRules = [
"applicationLauncher-deprecated",
"chip-deprecated",
"contextSelector-update-deprecatedPath",
"dropdown-update-deprecatedPath",
"datalist-remove-selectableRow",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### chip-deprecated [(#)](https://github.com/patternfly/patternfly-react/pull/10049)

Chip has been deprecated. Running the fix flag will update your imports to our deprecated package, but we suggest using Label instead.

#### Examples

In:

```jsx
%inputExample%
```

Out:

```jsx
%outputExample%
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const ruleTester = require('../../ruletester');
import * as rule from './chip-deprecated';

ruleTester.run('chip-deprecated', rule, {
valid: [
{
code: `import { Chip } from '@someOtherPackage';`,
},
],
invalid: [
{
code: `import { Chip } from '@patternfly/react-core';`,
output: `import {\n\tChip\n} from '@patternfly/react-core/deprecated';`,
errors: [
{
message: `Chip has been deprecated. Running the fix flag will update your imports to our deprecated package, but we suggest using Label instead.`,
type: 'ImportDeclaration',
},
],
},
],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { moveSpecifiers } from '../../helpers';

// https://github.com/patternfly/patternfly-react/pull/10049

const specifiersToMove = ['Chip', 'ChipGroup'];

const fromPackage = '@patternfly/react-core';
const toPackage = '@patternfly/react-core/deprecated';
const messageAfterImportNameChange =
'been deprecated. Running the fix flag will update your imports to our deprecated package, but we suggest using Label instead.';

module.exports = {
meta: { fixable: 'code' },
create: moveSpecifiers(
specifiersToMove,
fromPackage,
toPackage,
messageAfterImportNameChange
),
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import { Chip } from '@patternfly/react-core';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import { Chip } from '@patternfly/react-core/deprecated';
Loading