Skip to content

Commit

Permalink
Fix analysis issues (#2294)
Browse files Browse the repository at this point in the history
  • Loading branch information
jathak authored Jul 30, 2024
1 parent b0271a5 commit 9f786f4
Show file tree
Hide file tree
Showing 50 changed files with 55 additions and 20 deletions.
4 changes: 2 additions & 2 deletions analysis/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage: https://github.com/sass/dart-sass/tree/master/analysis
publish_to: none

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
lints: ^2.0.0
lints: ^4.0.0
3 changes: 1 addition & 2 deletions lib/src/async_import_cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,7 @@ final class AsyncImportCache {
// If multiple original URLs canonicalize to the same thing, choose the
// shortest one.
minBy<Uri, int>(
_canonicalizeCache.values
.whereNotNull()
_canonicalizeCache.values.nonNulls
.where((result) => result.$2 == canonicalUrl)
.map((result) => result.originalUrl),
(url) => url.path.length)
Expand Down
2 changes: 1 addition & 1 deletion lib/src/extend/functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -916,4 +916,4 @@ Iterable<SelectorList> _selectorPseudoArgs(
.whereType<PseudoSelector>()
.where((pseudo) => pseudo.isClass == isClass && pseudo.name == name)
.map((pseudo) => pseudo.selector)
.whereNotNull();
.nonNulls;
5 changes: 2 additions & 3 deletions lib/src/import_cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// DO NOT EDIT. This file was generated from async_import_cache.dart.
// See tool/grind/synchronize.dart for details.
//
// Checksum: 4362e28e5cd425786c235d2a6a2bb60539403799
// Checksum: f70eea612e1613ef93bad353803ad9479cda04aa
//
// ignore_for_file: unused_import

Expand Down Expand Up @@ -313,8 +313,7 @@ final class ImportCache {
// If multiple original URLs canonicalize to the same thing, choose the
// shortest one.
minBy<Uri, int>(
_canonicalizeCache.values
.whereNotNull()
_canonicalizeCache.values.nonNulls
.where((result) => result.$2 == canonicalUrl)
.map((result) => result.originalUrl),
(url) => url.path.length)
Expand Down
3 changes: 1 addition & 2 deletions lib/src/importer/node_package.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// https://opensource.org/licenses/MIT.

import 'package:cli_pkg/js.dart';
import 'package:collection/collection.dart';
import 'package:sass/src/util/map.dart';
import 'package:sass/src/util/nullable.dart';

Expand Down Expand Up @@ -239,7 +238,7 @@ class NodePackageImporter extends Importer {

return null;
})
.whereNotNull()
.nonNulls
.toList();

return switch (matches) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/io/js.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ Future<String> readStdin() async {
process.stdin.on('data', allowInterop(([Object? chunk]) {
sink.add(chunk as List<int>);
}));
process.stdin.on('end', allowInterop(([Object? _]) {
process.stdin.on('end', allowInterop(([Object? arg]) {
// Callback for 'end' receives no args.
assert(_ == null);
assert(arg == null);
sink.close();
}));
process.stdin.on('error', allowInterop(([Object? e]) {
Expand Down
11 changes: 3 additions & 8 deletions lib/src/js/value/calculation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,10 @@ final JSClass calculationClass = () {
if ((value == null && !_isValidClampArg(min)) ||
(max == null && ![min, value].any(_isValidClampArg))) {
jsThrow(JsError('Expected at least one SassString or '
'CalculationInterpolation in `${[
min,
value,
max
].whereNotNull()}`'));
'CalculationInterpolation in `${[min, value, max].nonNulls}`'));
}
[min, value, max].whereNotNull().forEach(_assertCalculationValue);
return SassCalculation.unsimplified(
'clamp', [min, value, max].whereNotNull());
[min, value, max].nonNulls.forEach(_assertCalculationValue);
return SassCalculation.unsimplified('clamp', [min, value, max].nonNulls);
}
});

Expand Down
1 change: 1 addition & 0 deletions test/browser_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@TestOn('browser')
library;

import 'package:js/js.dart';
import 'package:node_interop/js.dart';
Expand Down
1 change: 1 addition & 0 deletions test/cli/dart/colon_args_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/cli/dart/deprecations_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/cli/dart/errors_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';
import 'package:test_descriptor/test_descriptor.dart' as d;
Expand Down
1 change: 1 addition & 0 deletions test/cli/dart/repl_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/cli/dart/source_maps_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/cli/dart/update_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// OS X's modification time reporting is flaky, so we skip these tests on it.
@TestOn('vm && !mac-os')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/cli/dart/watch_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// File watching is inherently flaky at the OS level. To mitigate this, we do a
// few retries when the tests fail.
@Retry(3)
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/cli/dart_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'dart:convert';

Expand Down
1 change: 1 addition & 0 deletions test/cli/node/colon_args_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

@TestOn('vm')
@Tags(['node'])
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/cli/node/deprecations_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

@TestOn('vm')
@Tags(['node'])
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/cli/node/errors_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

@TestOn('vm')
@Tags(['node'])
library;

import 'package:test/test.dart';
import 'package:test_descriptor/test_descriptor.dart' as d;
Expand Down
1 change: 1 addition & 0 deletions test/cli/node/repl_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

@TestOn('vm')
@Tags(['node'])
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/cli/node/source_maps_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

@TestOn('vm')
@Tags(['node'])
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/cli/node/update_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// OS X's modification time reporting is flaky, so we skip these tests on it.
@TestOn('vm && !mac-os')
@Tags(['node'])
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/cli/node/watch_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// File watching is inherently flaky at the OS level. To mitigate this, we do a
// few retries when the tests fail.
@Retry(3)
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/cli/node_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

@TestOn('vm')
@Tags(['node'])
library;

import 'dart:convert';

Expand Down
1 change: 1 addition & 0 deletions test/compressed_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/dart_api/function_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/dart_api/importer_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'dart:convert';

Expand Down
1 change: 1 addition & 0 deletions test/dart_api/logger_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';
import 'package:source_span/source_span.dart';
Expand Down
1 change: 1 addition & 0 deletions test/dart_api/value/boolean_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/dart_api/value/calculation_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/dart_api/value/color_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/dart_api/value/function_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/dart_api/value/list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/dart_api/value/map_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/dart_api/value/null_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/dart_api/value/number_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'dart:math' as math;

Expand Down
1 change: 1 addition & 0 deletions test/dart_api/value/string_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/dart_api_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:package_config/package_config.dart';
import 'package:path/path.dart' as p;
Expand Down
1 change: 1 addition & 0 deletions test/deprecations_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/doc_comments_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:sass/src/ast/sass.dart';
import 'package:test/test.dart';
Expand Down
1 change: 1 addition & 0 deletions test/double_check_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'dart:io';
import 'dart:convert';
Expand Down
1 change: 1 addition & 0 deletions test/embedded/embedded_process.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'dart:async';
import 'dart:convert';
Expand Down
1 change: 1 addition & 0 deletions test/embedded/file_importer_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:path/path.dart' as p;
import 'package:test/test.dart';
Expand Down
1 change: 1 addition & 0 deletions test/embedded/function_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/embedded/importer_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://opensource.org/licenses/MIT.

@TestOn('vm')
library;

import 'package:source_maps/source_maps.dart' as source_maps;
import 'package:test/test.dart';
Expand Down
Loading

0 comments on commit 9f786f4

Please sign in to comment.