eslint / eslint/css

New Rule: `no-deprecated-media-types`

Open
#555 1 comment 0 reactions 1 assignee Claimed by @electrohyun View on GitHub
feature
Dominant language
JavaScript
Stars
308
Forks
44
Avg merge
2d 6h
Merged PRs (30d)
18

Description

### Rule details

Disallow deprecated media types in `@media` rules.

### What type of rule is this?

Warns about a potential problem

### Example code

```css
@media tv {
}

@media handheld and (max-width: 480px) {
}

@media screen, print, tty {
}
```

### Prior Art

There are existing implementations.

1. Stylelint's [`media-type-no-deprecated`](https://stylelint.io/user-guide/rules/media-type-no-deprecated/) reports deprecated media types.
2. Biome's [`noDeprecatedMediaType`](https://biomejs.dev/linter/rules/no-deprecated-media-type/) reports the same media types.

### Participation

- [x] I am willing to submit a pull request to implement this rule.

### AI acknowledgment

- [x] I did not use AI to generate this issue report.
- [ ] (If the above is not checked) I have reviewed the AI-generated content before submitting.

### Additional comments

The [specification](https://drafts.csswg.org/mediaqueries-5/#media-types) defines these eight media types as deprecated.

- `aural`
- `braille`
- `embossed`
- `handheld`
- `projection`
- `speech`
- `tty`
- `tv`

These media types are uncommon in modern CSS and are most likely to appear in legacy stylesheets.

However, the specification defines them to match nothing, and both Stylelint and Biome already check for them, so I would like to propose a rule that reports their use in this plugin as well.

Disclosure: I'm a participant of [open source contribution program OSSCA](https://github.com/eslint-ossca)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.