From 0490f9eccb54d060a031b4fb028740daf1f5abd3 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Tue, 28 Sep 2021 13:44:20 +0200 Subject: [PATCH] Improve the error message for invalid default namespaces --- lib/src/importer/legacy_node.dart | 3 ++- lib/src/parse/stylesheet.dart | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/src/importer/legacy_node.dart b/lib/src/importer/legacy_node.dart index 83528fc26..d122fc8a7 100644 --- a/lib/src/importer/legacy_node.dart +++ b/lib/src/importer/legacy_node.dart @@ -2,4 +2,5 @@ // MIT-style license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. -export 'legacy_node/interface.dart' if (dart.library.js) 'legacy_node/implementation.dart'; +export 'legacy_node/interface.dart' + if (dart.library.js) 'legacy_node/implementation.dart'; 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)); } }