Skip to content

New rule: no-log-testing-playground-url #294

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

Closed
MichaelDeBoey opened this issue Mar 20, 2021 · 12 comments
Closed

New rule: no-log-testing-playground-url #294

MichaelDeBoey opened this issue Mar 20, 2021 · 12 comments
Labels
new rule New rule to be included in the plugin

Comments

@MichaelDeBoey
Copy link
Member

MichaelDeBoey commented Mar 20, 2021

Just like no-debug but for screen.logTestingPlaygroundURL()

Reference: testing-library/dom-testing-library#781

@Belco90 Belco90 added the new rule New rule to be included in the plugin label Mar 20, 2021
@Belco90
Copy link
Member

Belco90 commented Mar 20, 2021

It sounds like a good idea, and would be really easy to implement just mirroring the same checks from no-debug. However, we have to put it on hold until v4 gets released or it will take forever!

@MichaelDeBoey
Copy link
Member Author

I think we can indeed extract a lot of the no-debug code in order to implement this one

@Belco90
Copy link
Member

Belco90 commented Apr 12, 2021

Rethinking this suggestion: I think no-debug should report logTestingPlaygroundURL usages. Both debug and logTestingPlaygroundURL are debugging utils, so no-debug should take care of them. Even prettyDOM and logRoles probably.

@MichaelDeBoey
Copy link
Member Author

Maybe we should rename no-debug to something like no-debugging-utils?

We can create that new rule in a minor release and let that handle all of them (debug/screen.debug, screen.logTestingPlaygroundURL, prettyDOM, logRoles, logDOM, prettyFormat, ...).

We can deprecate the no-debug rule for now and maybe throw a warning or so to say that using the new no-debugging-utils should be used and remove it in v5?
Or we can update no-debug and rename it to a better suiting name in v5 too if we want?

@MichaelDeBoey
Copy link
Member Author

On the other hand, maybe some people will want to enable this behavior for some utils, but not for others.
So having a setting for which one to enable can be helpful too I think

@Belco90
Copy link
Member

Belco90 commented Apr 12, 2021

  • I would implement everything under no-debug and rename it in a future v5 if necessary.
  • The rule should accept an option to decide which debug utils are allowed like no-console ESLint one

@MichaelDeBoey
Copy link
Member Author

Sounds like a solid plan @Belco90! 👊

@MichaelDeBoey
Copy link
Member Author

Since it's a breaking change to error on these new functions, we should set the default of the allow option to be ['debug', 'screen.debug']

Only in v5 we can update it to default to all functions then. 🤔

@Belco90
Copy link
Member

Belco90 commented Apr 12, 2021

Putting ESLint errors in that way, every single change should be a breaking change since it could potentially report errors not reported before. I'm never sure what to do in this case. If you take a look at ESLint releases, they seem to include this sort of changes in a minor and leave major for purely API changes, dependency updates, or config changes.

Anyway, setting it to 'debug' by default shouldn't be a problem (screen.debug shouldn't be an option tho, it's just another way of using debug from Testing Library and that's already addressed in v4 of the plugin across all rules).

@MichaelDeBoey
Copy link
Member Author

If ESLint makes these kind of things a minor, I think we should do that too

@gndelia
Copy link
Collaborator

gndelia commented Apr 12, 2021

  • I would implement everything under no-debug and rename it in a future v5 if necessary.
  • The rule should accept an option to decide which debug utils are allowed like no-console ESLint one

I like this plan - but I think definitely no-debug has to be renamed as it might be confusing as it is

@Belco90
Copy link
Member

Belco90 commented May 13, 2021

Closing this ticket and adding the renaming to the list of things to do on the next major.

@Belco90 Belco90 closed this as completed May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new rule New rule to be included in the plugin
Projects
None yet
Development

No branches or pull requests

3 participants