Skip to content

Commit 1b8e089

Browse files
committed
Forbid multiple !global or !default flags on the same variable
Closes #604
1 parent 473d83a commit 1b8e089

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
parsing associated with it. It is now parsed like any other unknown plain CSS
88
at-rule, where Sass features are only allowed within `#{}` interpolation.
99

10+
* **Breaking change:** A variable definition may now only have a single
11+
`!global` flag or `!default` flag, or one of each.
12+
1013
### Bogus Combinators
1114

1215
* **Breaking change:** Selectors with more than one combinator in a row, such as

lib/src/parse/stylesheet.dart

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,8 @@ abstract class StylesheetParser extends Parser {
255255
switch (identifier()) {
256256
case 'default':
257257
if (guarded) {
258-
warnings.add((
259-
deprecation: Deprecation.duplicateVarFlags,
260-
message:
261-
'!default should only be written once for each variable.\n'
262-
'This will be an error in Dart Sass 2.0.0.',
263-
span: scanner.spanFrom(flagStart),
264-
));
258+
error('Only one !default is allowed per declaration.',
259+
scanner.spanFrom(flagStart));
265260
}
266261
guarded = true;
267262

@@ -272,13 +267,8 @@ abstract class StylesheetParser extends Parser {
272267
scanner.spanFrom(flagStart),
273268
);
274269
} else if (global) {
275-
warnings.add((
276-
deprecation: Deprecation.duplicateVarFlags,
277-
message:
278-
'!global should only be written once for each variable.\n'
279-
'This will be an error in Dart Sass 2.0.0.',
280-
span: scanner.spanFrom(flagStart),
281-
));
270+
error('Only one !global is allowed per declaration.',
271+
scanner.spanFrom(flagStart));
282272
}
283273
global = true;
284274

0 commit comments

Comments
 (0)