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

Add media-query-no-invalid #6916

Closed
romainmenke opened this issue Jun 13, 2023 · 2 comments · Fixed by #6963
Closed

Add media-query-no-invalid #6916

romainmenke opened this issue Jun 13, 2023 · 2 comments · Fixed by #6963
Labels
status: wip is being worked on by someone type: new rule an entirely new rule

Comments

@romainmenke
Copy link
Member

romainmenke commented Jun 13, 2023

What is the problem you're trying to solve?

I want to warn on invalid media queries.

see : #6560 (comment)

Types of errors :

  1. the @media params are not even remotely similar to a media query
    • isMediaQueryInvalid(x) will be true
    • e.g. @media @foo {}
  2. the parenthesis and combinators are incorrect
    • isGeneralEnclosed(x) will be true
    • e.g. @media ((min-width: 300px) and (hover: hover) or (aspect-ratio: 1 / 1))
  3. syntactically incorrect values are used for media queries in general
    • isGeneralEnclosed(x) will be true
    • e.g. @media (min-width: var(--foo))
    • e.g. @media (min-width: 50%)

What solution would you like to see?

A new rule :

  • Name: media-query-no-invalid
  • Primary option: true
  • Secondary options: none
  • Autofixable: No
  • Message: Unexpected invalid media query "${query}"
  • Description: Disallow invalid media queries.
  • Section: "Avoid Errors" -> "Invalid"
  • Extended description: something about invalid media queries
@ybiquitous ybiquitous added the status: needs discussion triage needs further discussion label Jun 13, 2023
@ybiquitous
Copy link
Member

@romainmenke Thanks for opening the issue. That sounds great to me. 👍🏼

Let's wait for the feedback. If nobody objects, then let's mark it as ready.

@ybiquitous ybiquitous added status: ready to implement is ready to be worked on by someone type: new rule an entirely new rule and removed status: needs discussion triage needs further discussion labels Jun 19, 2023
@ybiquitous
Copy link
Member

Since there are no objections, I've labeled the issue as ready to implement. Please consider contributing if you have time.

There are steps on how to add a new rule in the Developer guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: wip is being worked on by someone type: new rule an entirely new rule
Development

Successfully merging a pull request may close this issue.

2 participants