Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the error message for invalid default namespaces #1513

Merged
merged 3 commits into from Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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