From 6b0888c96554136e4f4ecf03cc52359b1974ede2 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Wed, 8 Nov 2023 11:05:52 -0800 Subject: [PATCH] Update to latest lints and fix (#122) Also bump min SDK to Dart 3.1 --- .github/workflows/test-package.yml | 4 ++-- CHANGELOG.md | 4 ++++ analysis_options.yaml | 21 +-------------------- lib/src/int64.dart | 4 ++-- lib/src/utilities.dart | 8 ++++---- pubspec.yaml | 6 +++--- test/int64_test.dart | 2 -- test/int_64_vm_test.dart | 1 + 8 files changed, 17 insertions(+), 33 deletions(-) diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml index 5f67d5b..626b709 100644 --- a/.github/workflows/test-package.yml +++ b/.github/workflows/test-package.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - sdk: [2.19.0, dev] + sdk: [3.1.0, dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d @@ -47,7 +47,7 @@ jobs: matrix: # Add macos-latest and/or windows-latest if relevant for this package. os: [ubuntu-latest] - sdk: [2.19.0, dev] + sdk: [3.1.0, dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d diff --git a/CHANGELOG.md b/CHANGELOG.md index f731296..3698145 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.1.1-wip + +* Require Dart `^3.1.0` + ## 1.1.0 * Add `tryParseRadix`, `tryParseInt` and `tryParseHex` static methods diff --git a/analysis_options.yaml b/analysis_options.yaml index 2e3ed19..76f6d6a 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,4 +1,4 @@ -include: package:lints/recommended.yaml +include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: language: @@ -6,36 +6,17 @@ analyzer: linter: rules: - - avoid_catching_errors - - avoid_dynamic_calls - avoid_private_typedef_functions - avoid_returning_null - avoid_unused_constructor_parameters - cancel_subscriptions - cascade_invocations - - comment_references - - directives_ordering - join_return_with_assignment - - lines_longer_than_80_chars - missing_whitespace_between_adjacent_strings - no_adjacent_strings_in_list - no_runtimeType_toString - - only_throw_errors - package_api_docs - - prefer_asserts_in_initializer_lists - - prefer_const_constructors - prefer_const_declarations - prefer_expression_function_bodies - - prefer_interpolation_to_compose_strings - - prefer_relative_imports - - sort_pub_dependencies - - test_types_in_equals - - throw_in_finally - - type_annotate_public_apis - - unnecessary_lambdas - - unnecessary_null_aware_assignments - - unnecessary_parenthesis - unnecessary_raw_strings - - unnecessary_statements - - use_is_even_rather_than_modulo - use_string_buffers diff --git a/lib/src/int64.dart b/lib/src/int64.dart index e4e2ba4..bbfcbd9 100644 --- a/lib/src/int64.dart +++ b/lib/src/int64.dart @@ -267,7 +267,7 @@ class Int64 implements IntX { // Returns the [Int64] representation of the specified value. Throws // [ArgumentError] for non-integer arguments. - static Int64 _promote(value) { + static Int64 _promote(Object value) { if (value is Int64) { return value; } else if (value is int) { @@ -968,7 +968,7 @@ class Int64 implements IntX { // Implementation of '~/', '%' and 'remainder'. - static Int64 _divide(Int64 a, other, int what) { + static Int64 _divide(Int64 a, Object other, int what) { Int64 b = _promote(other); if (b.isZero) { throw UnsupportedError('Division by zero'); diff --git a/lib/src/utilities.dart b/lib/src/utilities.dart index d603b57..8b3957c 100644 --- a/lib/src/utilities.dart +++ b/lib/src/utilities.dart @@ -16,12 +16,12 @@ int validateRadix(int radix) => /// not a valid digit in any radix in the range 2 through 36. int decodeDigit(int c) { // Hex digit char codes - const int c0 = 48; // '0'.codeUnitAt(0) - const int ca = 97; // 'a'.codeUnitAt(0) + const c0 = 48; // '0'.codeUnitAt(0) + const ca = 97; // 'a'.codeUnitAt(0) - int digit = c ^ c0; + var digit = c ^ c0; if (digit < 10) return digit; - int letter = (c | 0x20) - ca; + var letter = (c | 0x20) - ca; if (letter >= 0) { // Returns values above 36 for invalid digits. // The value is checked against the actual radix where the return diff --git a/pubspec.yaml b/pubspec.yaml index 3180c25..76d5868 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,13 +1,13 @@ name: fixnum -version: 1.1.0 +version: 1.1.1-wip description: >- Library for 32- and 64-bit signed fixed-width integers with consistent behavior between native and JS runtimes. repository: https://github.com/dart-lang/fixnum environment: - sdk: '>=2.19.0 <3.0.0' + sdk: ^3.1.0 dev_dependencies: - lints: ^2.0.0 + dart_flutter_team_lints: ^2.0.0 test: ^1.16.0 diff --git a/test/int64_test.dart b/test/int64_test.dart index bb5ac7a..e74d893 100644 --- a/test/int64_test.dart +++ b/test/int64_test.dart @@ -7,8 +7,6 @@ // // ignore_for_file: omit_local_variable_types -library int64test; - import 'package:fixnum/fixnum.dart'; import 'package:test/test.dart'; diff --git a/test/int_64_vm_test.dart b/test/int_64_vm_test.dart index 2ab161e..2d28da3 100644 --- a/test/int_64_vm_test.dart +++ b/test/int_64_vm_test.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. @TestOn('vm') +library; import 'package:fixnum/fixnum.dart'; import 'package:test/test.dart';