Skip to content

Commit

Permalink
Improve the error message for invalid default namespaces (#1513)
Browse files Browse the repository at this point in the history
  • Loading branch information
stof committed Oct 6, 2021
1 parent 4f67c4d commit 6641459
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,8 @@
## 1.43.2

* Improve the error message when the default namespace of a `@use` rule is not
a valid identifier.

## 1.43.1

* No user-visible changes.
Expand Down
6 changes: 5 additions & 1 deletion lib/src/parse/stylesheet.dart
Expand Up @@ -1398,7 +1398,11 @@ abstract class StylesheetParser extends Parser {
try {
return Parser.parseIdentifier(namespace, logger: logger);
} on SassFormatException {
error('Invalid Sass identifier "$namespace"', scanner.spanFrom(start));
error(
'The default namespace "$namespace" is not a valid Sass identifier.\n'
"\n"
'Recommendation: add an "as" clause to define an explicit namespace.',
scanner.spanFrom(start));
}
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,5 +1,5 @@
name: sass
version: 1.43.1
version: 1.43.2-dev
description: A Sass implementation in Dart.
homepage: https://github.com/sass/dart-sass

Expand Down

0 comments on commit 6641459

Please sign in to comment.