Skip to content

Commit 49b77d1

Browse files
committed
remove at-nest
1 parent 76909e4 commit 49b77d1

4 files changed

Lines changed: 13 additions & 24 deletions

File tree

.tape.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,27 +67,27 @@ export default {
6767
// Proposal nesting syntax
6868
{
6969
source: '.foo { color: blue; } body .foo { color: rebeccapurple; } html .foo { color: red; }',
70-
expect: '.foo { color: blue; @nest body & { color: rebeccapurple; } @nest html & { color: red; } }',
70+
expect: '.foo { color: blue; body & { color: rebeccapurple; } html & { color: red; } }',
7171
args: ['always']
7272
},
7373
{
7474
source: '.foo { color: blue; } body .foo { color: rebeccapurple; } html .foo { color: red; }',
75-
expect: '.foo { color: blue; @nest body & { color: rebeccapurple; } } html .foo { color: red; }',
75+
expect: '.foo { color: blue; body & { color: rebeccapurple; } } html .foo { color: red; }',
7676
args: ['always', { except: /^html$/i }]
7777
},
7878
{
7979
source: '.foo { color: blue; } body .foo { color: rebeccapurple; } html .foo { color: red; }',
80-
expect: '.foo { color: blue; @nest body & { color: rebeccapurple; } } html .foo { color: red; }',
80+
expect: '.foo { color: blue; body & { color: rebeccapurple; } } html .foo { color: red; }',
8181
args: ['always', { except: 'html' }]
8282
},
8383
{
8484
source: '.foo { color: blue; } body .foo { color: rebeccapurple; } html .foo { color: red; }',
85-
expect: '.foo { color: blue; @nest body & { color: rebeccapurple; } } html .foo { color: red; }',
85+
expect: '.foo { color: blue; body & { color: rebeccapurple; } } html .foo { color: red; }',
8686
args: ['always', { only: /^body$/i }]
8787
},
8888
{
8989
source: '.foo { color: blue; } body .foo { color: rebeccapurple; } html .foo { color: red; }',
90-
expect: '.foo { color: blue; @nest body & { color: rebeccapurple; } } html .foo { color: red; }',
90+
expect: '.foo { color: blue; body & { color: rebeccapurple; } } html .foo { color: red; }',
9191
args: ['always', { only: 'body' }]
9292
},
9393

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes to Stylelint Use Nesting
22

3+
### 5.1.0 (March 3, 2024)
4+
5+
- Remove `@nest` [#15](https://github.com/csstools/stylelint-use-nesting/issues/15)
6+
37
### 5.0.0 (March 3, 2024)
48

59
- Updated: peer `stylelint` to >= 16 (major)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "stylelint-use-nesting",
3-
"version": "5.0.0",
3+
"version": "5.1.0",
44
"description": "Enforce nesting when it is possible in CSS",
55
"author": "Jonathan Neal <[email protected]>",
66
"license": "CC0-1.0",

src/lib/fix-nesting-at-rule.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,15 @@
11
import postcss from 'postcss';
22

33
export default function fixNestingAtRule(rule1, rule2, opts) {
4-
const syntax = Object(opts).syntax;
5-
64
rule1.remove();
75

86
rule1.selectors = rule1.selectors.map(
97
selector => `${selector.slice(0, -rule2.selector.length - 1)} &`
108
);
119

12-
let ruleOrAtRule;
13-
switch (syntax) {
14-
case "scss": {
15-
ruleOrAtRule = postcss.rule({
16-
selector: String(rule1.selector),
17-
});
18-
break;
19-
}
20-
21-
default: {
22-
ruleOrAtRule = postcss.atRule({
23-
name: "nest",
24-
params: String(rule1.selector),
25-
});
26-
}
27-
}
10+
const ruleOrAtRule = postcss.rule({
11+
selector: String(rule1.selector),
12+
});
2813

2914
const rule = Object.assign(
3015
ruleOrAtRule,

0 commit comments

Comments
 (0)