Skip to content

Commit 9946b23

Browse files
committed
Fix at-rule-no-deprecated false positives for @apply
1 parent ebd328a commit 9946b23

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

.changeset/pink-spoons-invent.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"stylelint": patch
3+
---
4+
5+
Fixed: `at-rule-no-deprecated` false positives for `@apply`

lib/reference/atKeywords.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import uniteSets from '../utils/uniteSets.mjs';
22

33
/** @type {ReadonlySet<string>} */
4-
export const deprecatedAtKeywords = new Set(['apply', 'document', 'nest', 'viewport']);
4+
export const deprecatedAtKeywords = new Set(['document', 'nest', 'viewport']);
55

66
/**
77
* @see https://www.w3.org/TR/css-nesting-1/#conditionals
88
* @type {ReadonlySet<string>}
99
*/
1010
export const nestingSupportedAtKeywords = new Set([
11+
'apply',
1112
'container',
1213
'layer',
1314
'media',

lib/rules/at-rule-no-deprecated/__tests__/index.mjs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,6 @@ testRule({
6767
text: '',
6868
},
6969
},
70-
{
71-
code: 'a { @apply foo; }',
72-
unfixable: true,
73-
message: messages.rejected('@apply'),
74-
line: 1,
75-
column: 5,
76-
endLine: 1,
77-
endColumn: 11,
78-
},
7970
{
8071
code: 'a { @nest .foo {} @nest .bar {} }',
8172
fixed: 'a { .foo {} .bar {} }',
@@ -120,12 +111,12 @@ testRule({
120111

121112
reject: [
122113
{
123-
code: 'a { @apply foo; }',
124-
message: messages.rejected('@apply'),
114+
code: 'a { @nest .foo & {} }',
115+
message: messages.rejected('@nest'),
125116
line: 1,
126117
column: 5,
127118
endLine: 1,
128-
endColumn: 11,
119+
endColumn: 10,
129120
},
130121
],
131122
});

0 commit comments

Comments
 (0)