From 6641459fa253f4166d47f94bcc74263f2a437178 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Wed, 6 Oct 2021 19:16:35 +0200 Subject: [PATCH] Improve the error message for invalid default namespaces (#1513) --- CHANGELOG.md | 5 +++++ lib/src/parse/stylesheet.dart | 6 +++++- pubspec.yaml | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74ecdb529..0fe79b900 100644 --- a/CHANGELOG.md +++ b/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. diff --git a/lib/src/parse/stylesheet.dart b/lib/src/parse/stylesheet.dart index afe741594..5685f151c 100644 --- a/lib/src/parse/stylesheet.dart +++ b/lib/src/parse/stylesheet.dart @@ -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)); } } diff --git a/pubspec.yaml b/pubspec.yaml index 7268857ca..f2dff30f8 100644 --- a/pubspec.yaml +++ b/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