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: No duplicate import specifiers rule #713

Merged

Conversation

adamviktora
Copy link
Contributor

Closes #709

@adamviktora adamviktora force-pushed the no-duplicate-import-specifiers branch from 2aa6710 to 0ade52f Compare July 24, 2024 13:27
Comment on lines 2 to 4
Content,
Content,
Content,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this unrelated rules output be updated? Or are we keeping the *Output.tsx files as the output of running just the associated rule on the *Input.tsx file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question. I maybe lean a bit more towards having it as the output of running all rules on the file. But I don't know how we approached this in other rules. What is your opinion on this? Also tagging @thatblindgeye

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I lean more towards having it the output of just the associated rule since these files get pulled into the readme as depictions of what each rule will do, and that's at least what I've been doing and what I thought yall were doing.

Something that's been talked about in the past is the idea of compiling all of input/output files together into master input/output files to ensure that rules play nice together, would you feel better about the "just the associated rule" approach if we rolled out something like that?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had been going with having each individual Output file only apply fixes for that specific rule. A "master" file of all in/outputs may not be bad, assuming it's more just for our own eyes (and not something we publish in any README or anything). That's basically what we used to do for v5 was the single file where we added everything to ensure all the rules that ran didn't conflict with one another (too badly).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah in my head at least it would just be for us to look at, and maybe to build a new CI check around 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A CI check would be less tedious for us to have to constantly check that master file and maybe notice any issues

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted the file so it is not updated by the no-duplicate-imports rule.

We may have the master file + CI check, I don't find it super necessary, but if there will be time for that, why not, created this issue for it.

Comment on lines +32 to +33
code: `import { Button } from "@patternfly/react-core";
import { Button } from "@patternfly/react-core";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also add an invalid test where Component is imported from react-core, but also imported from react-core/dist/...

valid: [
{
// we care only about imports from "@patternfly/react-core"
code: `import { Button, Button } from "somewhere"`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And maybe a valid test where Component is imported from react-core, but also react-core/[deprecated|next]?

Copy link
Collaborator

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thatblindgeye thatblindgeye merged commit 8a09099 into patternfly:main Jul 31, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a general no-duplicate-imports rule
3 participants