diff --git a/analysis/lib/analysis_options.yaml b/analysis/lib/analysis_options.yaml index 63c08dc2b..4ab629352 100644 --- a/analysis/lib/analysis_options.yaml +++ b/analysis/lib/analysis_options.yaml @@ -11,16 +11,13 @@ analyzer: # These are necessary for matching the JS API. avoid_types_as_parameter_names: ignore - # This has tons of false positives for StreamSubscription.close(). - unawaited_futures: ignore - # These are style preferences rather than potential semantic issues. While # we're not intrinsically opposed to adopting them for consistency with the # Dart ecosystem, there aren't currently any automated tools to help us # migrate to and remain consistent with these style rules, so achieving # consistency isn't worth the engineering time we'd spend getting there. annotate_overrides: ignore - prefer_single_quotes: ignore use_function_type_syntax_for_parameters: ignore + prefer_interpolation_to_compose_strings: ignore include: package:lints/recommended.yaml diff --git a/analysis/pubspec.yaml b/analysis/pubspec.yaml index e82117548..4e9257b82 100644 --- a/analysis/pubspec.yaml +++ b/analysis/pubspec.yaml @@ -6,7 +6,7 @@ homepage: https://github.com/sass/dart-sass/tree/master/analysis publish_to: none environment: - sdk: ">=2.0.0 <3.0.0" + sdk: ">=2.17.0 <3.0.0" dependencies: - lints: ^1.0.0 + lints: ^2.0.0 diff --git a/lib/src/callable.dart b/lib/src/callable.dart index 644877d50..7f8b0c383 100644 --- a/lib/src/callable.dart +++ b/lib/src/callable.dart @@ -10,8 +10,8 @@ import 'exception.dart'; import 'value.dart'; export 'callable/async.dart'; -export 'callable/async_built_in.dart'; -export 'callable/built_in.dart'; +export 'callable/async_built_in.dart' show AsyncBuiltInCallable; +export 'callable/built_in.dart' show BuiltInCallable; export 'callable/plain_css.dart'; export 'callable/user_defined.dart'; diff --git a/lib/src/callable/async_built_in.dart b/lib/src/callable/async_built_in.dart index 6751c0889..ff4513f25 100644 --- a/lib/src/callable/async_built_in.dart +++ b/lib/src/callable/async_built_in.dart @@ -11,7 +11,7 @@ import '../value.dart'; import 'async.dart'; /// An [AsyncBuiltInCallable]'s callback. -typedef _Callback = FutureOr Function(List arguments); +typedef Callback = FutureOr Function(List arguments); /// A callable defined in Dart code. /// @@ -26,7 +26,7 @@ class AsyncBuiltInCallable implements AsyncCallable { final ArgumentDeclaration _arguments; /// The callback to run when executing this callable. - final _Callback _callback; + final Callback _callback; /// Creates a function with a single [arguments] declaration and a single /// [callback]. @@ -76,7 +76,7 @@ class AsyncBuiltInCallable implements AsyncCallable { /// If no exact match is found, finds the closest approximation. Note that this /// doesn't guarantee that [positional] and [names] are valid for the returned /// [ArgumentDeclaration]. - Tuple2 callbackFor( + Tuple2 callbackFor( int positional, Set names) => Tuple2(_arguments, _callback); } diff --git a/lib/src/callable/built_in.dart b/lib/src/callable/built_in.dart index 1b4a2aeb9..8576c5c0c 100644 --- a/lib/src/callable/built_in.dart +++ b/lib/src/callable/built_in.dart @@ -8,7 +8,7 @@ import '../ast/sass.dart'; import '../callable.dart'; import '../value.dart'; -typedef _Callback = Value Function(List arguments); +typedef Callback = Value Function(List arguments); /// A callable defined in Dart code. /// @@ -20,7 +20,7 @@ class BuiltInCallable implements Callable, AsyncBuiltInCallable { final String name; /// The overloads declared for this callable. - final List> _overloads; + final List> _overloads; /// Creates a function with a single [arguments] declaration and a single /// [callback]. @@ -73,7 +73,7 @@ class BuiltInCallable implements Callable, AsyncBuiltInCallable { /// If passed, [url] is the URL of the module in which the function is /// defined. BuiltInCallable.overloadedFunction( - this.name, Map overloads, + this.name, Map overloads, {Object? url}) : _overloads = [ for (var entry in overloads.entries) @@ -91,9 +91,9 @@ class BuiltInCallable implements Callable, AsyncBuiltInCallable { /// If no exact match is found, finds the closest approximation. Note that this /// doesn't guarantee that [positional] and [names] are valid for the returned /// [ArgumentDeclaration]. - Tuple2 callbackFor( + Tuple2 callbackFor( int positional, Set names) { - Tuple2? fuzzyMatch; + Tuple2? fuzzyMatch; int? minMismatchDistance; for (var overload in _overloads) { diff --git a/lib/src/functions/map.dart b/lib/src/functions/map.dart index e317e2287..f07e1c3b2 100644 --- a/lib/src/functions/map.dart +++ b/lib/src/functions/map.dart @@ -170,7 +170,7 @@ final _hasKey = _function("has-key", r"$map, $key, $keys...", (arguments) { Value _modify(SassMap map, Iterable keys, Value modify(Value old), {bool addNesting = true}) { var keyIterator = keys.iterator; - SassMap _modifyNestedMap(SassMap map) { + SassMap modifyNestedMap(SassMap map) { var mutableMap = Map.of(map.contents); var key = keyIterator.current; @@ -182,11 +182,11 @@ Value _modify(SassMap map, Iterable keys, Value modify(Value old), var nestedMap = mutableMap[key]?.tryMap(); if (nestedMap == null && !addNesting) return SassMap(mutableMap); - mutableMap[key] = _modifyNestedMap(nestedMap ?? const SassMap.empty()); + mutableMap[key] = modifyNestedMap(nestedMap ?? const SassMap.empty()); return SassMap(mutableMap); } - return keyIterator.moveNext() ? _modifyNestedMap(map) : modify(map); + return keyIterator.moveNext() ? modifyNestedMap(map) : modify(map); } /// Merges [map1] and [map2], with values in [map2] taking precedence. diff --git a/lib/src/utils.dart b/lib/src/utils.dart index a5054298c..20f12fcc6 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -455,7 +455,7 @@ extension MapExtension on Map { /// [key] to the result. V putOrMerge(K key, V value, V Function(V oldValue, V newValue) merge) => containsKey(key) - ? this[key] = merge(this[key]!, value) + ? this[key] = merge(this[key] as V, value) : this[key] = value; } diff --git a/lib/src/value/number.dart b/lib/src/value/number.dart index 8caa42041..47d311574 100644 --- a/lib/src/value/number.dart +++ b/lib/src/value/number.dart @@ -593,7 +593,7 @@ abstract class SassNumber extends Value { var otherHasUnits = newNumerators.isNotEmpty || newDenominators.isNotEmpty; if (coerceUnitless && (!hasUnits || !otherHasUnits)) return this.value; - SassScriptException _compatibilityException() { + SassScriptException compatibilityException() { if (other != null) { var message = StringBuffer("$this and"); if (otherName != null) message.write(" \$$otherName:"); @@ -634,7 +634,7 @@ abstract class SassNumber extends Value { if (factor == null) return false; value *= factor; return true; - }, orElse: () => throw _compatibilityException()); + }, orElse: () => throw compatibilityException()); } var oldDenominators = denominatorUnits.toList(); @@ -644,11 +644,11 @@ abstract class SassNumber extends Value { if (factor == null) return false; value /= factor; return true; - }, orElse: () => throw _compatibilityException()); + }, orElse: () => throw compatibilityException()); } if (oldNumerators.isNotEmpty || oldDenominators.isNotEmpty) { - throw _compatibilityException(); + throw compatibilityException(); } return value; diff --git a/pubspec.yaml b/pubspec.yaml index 48484ab97..15b5bab9a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,15 +32,15 @@ dependencies: http: ^0.13.3 dev_dependencies: - analyzer: ^3.0.0 + analyzer: ^4.7.0 archive: ^3.1.2 cli_pkg: ^2.1.4 crypto: ^3.0.0 dart_style: ^2.0.0 - dartdoc: ^5.0.0 + dartdoc: ^6.0.0 grinder: ^0.9.0 node_preamble: ^2.0.0 - lints: ^1.0.0 + lints: ^2.0.0 pub_api_client: ^2.1.1 pub_semver: ^2.0.0 pubspec_parse: ^1.0.0 diff --git a/tool/grind/synchronize.dart b/tool/grind/synchronize.dart index f8b4eb33f..ac0e45fd2 100644 --- a/tool/grind/synchronize.dart +++ b/tool/grind/synchronize.dart @@ -128,7 +128,7 @@ class _Visitor extends RecursiveAstVisitor { } void visitClassDeclaration(ClassDeclaration node) { - if (_sharedClasses.contains(node.name.name)) { + if (_sharedClasses.contains(node.name2.lexeme)) { _skipNode(node); } else { super.visitClassDeclaration(node); @@ -141,7 +141,7 @@ class _Visitor extends RecursiveAstVisitor { } void visitMethodDeclaration(MethodDeclaration node) { - if (_synchronizeName(node.name.name) != node.name.name) { + if (_synchronizeName(node.name2.lexeme) != node.name2.lexeme) { // If the file defines any asynchronous versions of synchronous functions, // remove them. _skipNode(node);