Skip to content

Commit 4b5c52c

Browse files
committed
feat: add at-rule-no-deprecated rule
1 parent df276d1 commit 4b5c52c

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { AtRules } from '../../types'
2+
import type { RuleConfig } from '../rule-config'
3+
4+
export type AtRuleNoDeprecatedOptions = RuleConfig<true, {
5+
ignoreAtRules?: (RegExp | AtRules)[]
6+
message?: string | ((atRule: string) => string)
7+
}>

src/rules/stylelint/index.d.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { AtRuleDescriptorNoUnknownOptions } from './at-rule-descriptor-no-u
55
import type { AtRuleDescriptorValueNoUnknownOptions } from './at-rule-descriptor-value-no-unknown'
66
import type { AtRuleDisallowedListOptions } from './at-rule-disallowed-list'
77
import type { AtRuleEmptyLineBeforeOptions } from './at-rule-empty-line-before'
8+
import type { AtRuleNoDeprecatedOptions } from './at-rule-no-deprecated'
89
import type { AtRuleNoUnknownOptions } from './at-rule-no-unknown'
910
import type { AtRuleNoVendorPrefixOptions } from './at-rule-no-vendor-prefix'
1011
import type { AtRulePropertyRequiredListOptions } from './at-rule-property-required-list'
@@ -271,6 +272,27 @@ export interface StyleLintRules {
271272
*/
272273
'at-rule-empty-line-before': AtRuleEmptyLineBeforeOptions
273274

275+
/**
276+
* Disallow deprecated at-rules.
277+
*
278+
* >``` scss
279+
* >@viewport {}
280+
* >//^^^^^^^
281+
* >//At-rules like this
282+
* >```
283+
*
284+
* This rule flags at-rules that were removed or deprecated after being in the CSS specifications, including editor drafts, and were subsequently either:
285+
*
286+
* - shipped in a stable version of a browser
287+
* - shipped by a developer channel/edition browser
288+
* - shipped but behind experimental flags
289+
* - polyfilled with some adoption before any browser actually shipped
290+
* - had an MDN page at one point in time
291+
*
292+
* @see [at-rule-no-deprecated](https://stylelint.io/user-guide/rules/at-rule-no-deprecated)
293+
*/
294+
'at-rule-no-deprecated': AtRuleNoDeprecatedOptions
295+
274296
/**
275297
* Disallow unknown at-rules.
276298
*

0 commit comments

Comments
 (0)