-
Notifications
You must be signed in to change notification settings - Fork 21
feat(react-dropzone): updated to latest version #216
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
Merged
wise-king-sullyman
merged 1 commit into
patternfly:main
from
thatblindgeye:iss166_dropzone
Jan 30, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
26 changes: 26 additions & 0 deletions
26
packages/eslint-plugin-pf-codemods/lib/rules/v5/react-dropzone-warn-upgrade.js
This file contains hidden or 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,26 @@ | ||
// https://github.com/patternfly/patternfly-react/pull/7926 | ||
module.exports = { | ||
meta: {}, | ||
create: function (context) { | ||
return { | ||
ImportDeclaration(node) { | ||
const importsWithDropzone = node.specifiers.find( | ||
(specifier) => | ||
(["FileUpload", "MultipleFileUpload"].includes( | ||
specifier.imported.name | ||
) && | ||
node.source.value === "@patternfly/react-core") || | ||
(specifier.imported.name === "CodeEditor" && | ||
node.source.value === "@patternfly/react-code-editor") | ||
); | ||
|
||
if (importsWithDropzone) { | ||
context.report({ | ||
node, | ||
message: `The react-dropzone dependency used within ${importsWithDropzone.imported.name} has been updated from version 9 to version 14.`, | ||
}); | ||
} | ||
}, | ||
}; | ||
}, | ||
}; |
2 changes: 0 additions & 2 deletions
2
packages/eslint-plugin-pf-codemods/lib/rules/v5/wizard-warn-button-order.js
This file contains hidden or 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
38 changes: 38 additions & 0 deletions
38
packages/eslint-plugin-pf-codemods/test/rules/v5/react-dropzone-warn-upgrade.js
This file contains hidden or 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,38 @@ | ||
const ruleTester = require("../../ruletester"); | ||
const rule = require("../../../lib/rules/v5/react-dropzone-warn-upgrade"); | ||
|
||
ruleTester.run("react-dropzone-warn-upgrade", rule, { | ||
valid: [], | ||
invalid: [ | ||
{ | ||
code: `import { FileUpload } from '@patternfly/react-core';`, | ||
output: `import { FileUpload } from '@patternfly/react-core';`, | ||
errors: [ | ||
{ | ||
message: `The react-dropzone dependency used within FileUpload has been updated from version 9 to version 14.`, | ||
type: "ImportDeclaration", | ||
}, | ||
], | ||
}, | ||
{ | ||
code: `import { MultipleFileUpload } from '@patternfly/react-core';`, | ||
output: `import { MultipleFileUpload } from '@patternfly/react-core';`, | ||
errors: [ | ||
{ | ||
message: `The react-dropzone dependency used within MultipleFileUpload has been updated from version 9 to version 14.`, | ||
type: "ImportDeclaration", | ||
}, | ||
], | ||
}, | ||
{ | ||
code: `import { CodeEditor } from '@patternfly/react-code-editor';`, | ||
output: `import { CodeEditor } from '@patternfly/react-code-editor';`, | ||
errors: [ | ||
{ | ||
message: `The react-dropzone dependency used within CodeEditor has been updated from version 9 to version 14.`, | ||
type: "ImportDeclaration", | ||
}, | ||
], | ||
}, | ||
], | ||
}); |
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import { AccordionExpandableContent } from "@patternfly/react-core"; | ||
import { ApplicationLauncher } from "@patternfly/react-core"; | ||
import { Card } from "@patternfly/react-core"; | ||
import { CodeEditor } from "@patternfly/react-code-editor"; | ||
import { DropdownToggle, Toggle } from "@patternfly/react-core"; | ||
import { FileUpload } from "@patternfly/react-core"; | ||
import { KEY_CODES } from "@patternfly/react-core"; | ||
import { MultipleFileUpload } from "@patternfly/react-core"; | ||
import { Nav } from "@patternfly/react-core"; | ||
import { Tabs } from "@patternfly/react-core"; | ||
import { Wizard } from "@patternfly/react-core"; | ||
import { WizardFooter } from "@patternfly/react-core/next"; | ||
|
||
<> | ||
<DropdownToggle isPrimary /> | ||
<Nav variant='horizontal-subnav' />; | ||
<Toggle isPrimary /> | ||
</> | ||
<DropdownToggle isPrimary /> | ||
<Nav variant='horizontal-subnav' />; | ||
<Toggle isPrimary /> | ||
</>; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What might a consumer need to do with this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the PR itself, other than updating the version it looks like there were some type updates. Other than possibly mentioning those in the warning message, we could just state that the version bump may require additional breaking changes to be made (though it's a bit generic)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though part of that may be resolved with #142
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I wonder if this and a PR for #142 are both needed 🤔
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right... i wonder if the language from this can be merged into 142 (if we still want to talk about version numbers)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could update the output warning here so that if FileUpload/MultipleFileUpload are imported, warn that "As part of the react-dropzone dependency upgrade from version 9 to 14, the type of X prop has been changed to Y...." Code Editor would just get a warning about the version bump.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that would make sense to me. Want me to do that under a followup?