Skip to content

Commit dbbc1c9

Browse files
authored
Migrate to pkg:lints (#161)
1 parent 38ff5ab commit dbbc1c9

33 files changed

+98
-71
lines changed

acyclic_steps/analysis_options.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml

acyclic_steps/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies:
1010
meta: ^1.1.7
1111
dev_dependencies:
1212
test: ^1.5.1
13-
pedantic: ^1.4.0
13+
lints: ^1.0.0
1414
environment:
1515
sdk: '>=2.12.0 <3.0.0'
1616

canonical_json/analysis_options.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml

canonical_json/lib/src/decoder.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ class Decoder {
194194
if (_value != char('"')) {
195195
throw _fail('expected key in map');
196196
}
197-
final key_start = _offset;
197+
final keyStart = _offset;
198198
final key = _readRawString();
199199
_require(':', 'expected ":" separate key and value in map');
200-
entries.add(_RawMapEntry(key, _readValue(), key_start));
200+
entries.add(_RawMapEntry(key, _readValue(), keyStart));
201201
} while (_try(','));
202202
_require('}', 'expected "," or "}" in map');
203203
// Validate that keys are sorted

canonical_json/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ dependencies:
1111
unorm_dart: ^0.2.0
1212
dev_dependencies:
1313
test: ^1.5.1
14-
pedantic: ^1.4.0
14+
lints: ^1.0.0
1515
environment:
1616
sdk: '>=2.12.0 <3.0.0'

canonical_json/test/canonical_json_test.dart

+32-26
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ void main() {
3737

3838
final prng = Random(42);
3939
for (var i = 0; i < 50; i++) {
40-
final chars = '{}[]abcd \0""""\\\\\\\\\$\$\'\''.split('');
40+
final chars = '{}[]abcd 0""""\\\\\\\\\$\$\'\''.split('');
4141
chars.shuffle(prng);
4242
testValue('shuffled string ($i)', chars.join(''));
4343
testValue('shuffled map key ($i)', {chars.join(''): 42});
4444
}
4545

46-
[
46+
for (var data in [
4747
'""',
4848
'"hello world"',
4949
r'"test\"test"',
@@ -67,21 +67,23 @@ void main() {
6767
'-120',
6868
'"Äffin"',
6969
// Test valid canonical JSON cases.
70-
].forEach((String data) => test('isValidCanonicalJSON($data)', () {
71-
final value = json.decode(data);
72-
final encoded = canonicalJson.encode(value);
73-
expect(utf8.decode(encoded), equals(data));
74-
final decoded = canonicalJson.decode(encoded);
75-
expect(decoded, equals(value));
76-
final encodedAgain = canonicalJson.encode(decoded);
77-
expect(encodedAgain, encoded);
78-
// TODO: Use json.fuse(utf8) when: http://dartbug.com/46205 is fixed!
79-
// final decodedJson = json.fuse(utf8).decode(encoded);
80-
final decodedJson = json.decode(utf8.decode(encoded));
81-
expect(decodedJson, equals(value));
82-
}));
70+
]) {
71+
test('isValidCanonicalJSON($data)', () {
72+
final value = json.decode(data);
73+
final encoded = canonicalJson.encode(value);
74+
expect(utf8.decode(encoded), equals(data));
75+
final decoded = canonicalJson.decode(encoded);
76+
expect(decoded, equals(value));
77+
final encodedAgain = canonicalJson.encode(decoded);
78+
expect(encodedAgain, encoded);
79+
// TODO: Use json.fuse(utf8) when: http://dartbug.com/46205 is fixed!
80+
// final decodedJson = json.fuse(utf8).decode(encoded);
81+
final decodedJson = json.decode(utf8.decode(encoded));
82+
expect(decodedJson, equals(value));
83+
});
84+
}
8385

84-
[
86+
for (var data in [
8587
'42.1',
8688
't',
8789
'f',
@@ -118,19 +120,23 @@ void main() {
118120
'-0',
119121
'"A\u0308ffin"', // not unicode normalization form C
120122
// Test invalid canonical JSON cases.
121-
].forEach((String data) => test('isInvalidCanonicalJSON($data)', () {
122-
final raw = utf8.encode(data);
123-
expect(() => canonicalJson.decode(raw),
124-
throwsA(TypeMatcher<InvalidCanonicalJsonException>()));
125-
}));
123+
]) {
124+
test('isInvalidCanonicalJSON($data)', () {
125+
final raw = utf8.encode(data);
126+
expect(() => canonicalJson.decode(raw),
127+
throwsA(TypeMatcher<InvalidCanonicalJsonException>()));
128+
});
129+
}
126130

127-
[
131+
for (var data in [
128132
1.2,
129133
-0.0,
130-
].forEach((Object data) => test('cannotBeCanonicalized($data)', () {
131-
expect(() => canonicalJson.encode(data),
132-
throwsA(TypeMatcher<ArgumentError>()));
133-
}));
134+
]) {
135+
test('cannotBeCanonicalized($data)', () {
136+
expect(() => canonicalJson.encode(data),
137+
throwsA(TypeMatcher<ArgumentError>()));
138+
});
139+
}
134140

135141
test('unicode normalization form C', () {
136142
final nonFormC = 'A\u0308\uFB03n';

chunked_stream/analysis_options.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml
2+
3+
analyzer:
4+
errors:
5+
deprecated_member_use_from_same_package: ignore

chunked_stream/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ dependencies:
1010
meta: ^1.3.0
1111
dev_dependencies:
1212
test: ^1.16.0
13-
pedantic: ^1.4.0
13+
lints: ^1.0.0
1414
environment:
1515
sdk: ">=2.12.0 <3.0.0"

http_methods/analysis_options.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml

http_methods/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ environment:
1010
sdk: '>=2.12.0 <3.0.0'
1111
dev_dependencies:
1212
test: ^1.16.0
13-
pedantic: ^1.10.0
13+
lints: ^1.0.0

neat_cache/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## v2.0.2-dev
2+
13
## v2.0.1
24
* Fixed issue when adding multiple commands without waiting for them to complete first.
35

neat_cache/analysis_options.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml

neat_cache/lib/src/providers/resp.dart

+6-2
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ class RespClient {
228228
_pending.clear();
229229
final e = RedisConnectionException._('redis client forcibly closed');
230230
final st = StackTrace.current;
231-
pending.forEach((c) => c.completeError(e, st));
231+
for (var c in pending) {
232+
c.completeError(e, st);
233+
}
232234
}
233235
await _input.cancel();
234236

@@ -247,7 +249,9 @@ class RespClient {
247249
final pending = _pending.toList(growable: false);
248250
_pending.clear();
249251
scheduleMicrotask(() {
250-
pending.forEach((c) => c.completeError(e, st));
252+
for (var c in pending) {
253+
c.completeError(e, st);
254+
}
251255
});
252256

253257
if (!_closed.isCompleted) {

neat_cache/pubspec.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: neat_cache
2-
version: 2.0.1
2+
version: 2.0.2-dev
33
description: |
44
A neat cache abstraction for wrapping in-memory or redis caches.
55
homepage: https://github.com/google/dart-neats/tree/master/neat_cache
@@ -13,6 +13,6 @@ dependencies:
1313
meta: ^1.4.0
1414
dev_dependencies:
1515
test: ^1.5.1
16-
pedantic: ^1.4.0
16+
lints: ^1.0.0
1717
environment:
1818
sdk: '>=2.12.0 <3.0.0'
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml

neat_periodic_task/lib/neat_periodic_task.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
library neat_periodic_task;
1616

1717
import 'dart:async' show Future, Completer, scheduleMicrotask, TimeoutException;
18-
import 'package:retry/retry.dart' show RetryOptions;
18+
1919
import 'package:logging/logging.dart' show Logger;
20+
import 'package:retry/retry.dart' show RetryOptions;
2021
import 'package:slugid/slugid.dart' show Slugid;
22+
2123
import 'src/neat_status.dart' show NeatTaskStatus;
2224

2325
final _log = Logger('neat_periodic_task');
@@ -88,11 +90,9 @@ class _NeatStatusProviderWithRetry extends NeatStatusProvider {
8890
final RetryOptions _r;
8991
_NeatStatusProviderWithRetry(this._provider, this._r);
9092
@override
91-
Future<List<int>?> get() =>
92-
_r.retry(() => _provider.get(), retryIf: (e) => e is Exception);
93+
Future<List<int>?> get() => _r.retry(() => _provider.get());
9394
@override
94-
Future<bool> set(List<int> status) =>
95-
_r.retry(() => _provider.set(status), retryIf: (e) => e is Exception);
95+
Future<bool> set(List<int> status) => _r.retry(() => _provider.set(status));
9696
}
9797

9898
/// Interface for a periodic task.

neat_periodic_task/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies:
1515
collection: ^1.15.0
1616
dev_dependencies:
1717
test: ^1.16.5
18-
pedantic: ^1.10.0
18+
lints: ^1.0.0
1919
build_runner: ^1.3.1
2020
build_verify: ^1.1.1
2121
json_serializable: ^4.0.2

pem/analysis_options.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml

pem/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies:
1111
petitparser: ^4.0.2
1212
dev_dependencies:
1313
test: ^1.16.5
14-
pedantic: ^1.10.0
14+
lints: ^1.0.0
1515
environment:
1616
sdk: '>=2.12.0 <3.0.0'
1717

retry/analysis_options.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml

retry/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ repository: https://github.com/google/dart-neats.git
88
issue_tracker: https://github.com/google/dart-neats/labels/pkg:retry
99
dev_dependencies:
1010
test: ^1.16.0-nullsafety.13
11-
pedantic: ^1.4.0
11+
lints: ^1.0.0
1212
environment:
1313
sdk: ">=2.12.0 <3.0.0"

safe_url_check/analysis_options.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml

safe_url_check/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ dependencies:
1515

1616
dev_dependencies:
1717
test: ^1.5.1
18-
pedantic: ^1.4.0
18+
lints: ^1.0.0
1919
build_runner: ^1.7.2
2020
build_version: ^2.0.1

sanitize_html/analysis_options.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml

sanitize_html/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies:
1111
meta: ^1.1.7
1212
dev_dependencies:
1313
test: ^1.5.1
14-
pedantic: ^1.4.0
14+
lints: ^1.0.0
1515
markdown: ^4.0.0
1616
environment:
1717
sdk: '>=2.12.0 <3.0.0'

shelf_router/analysis_options.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml

shelf_router/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212
http_methods: ^1.1.0
1313
dev_dependencies:
1414
test: ^1.16.0
15-
pedantic: ^1.10.0
15+
lints: ^1.0.0
1616
http: ^0.13.0
1717
environment:
1818
sdk: '>=2.12.0 <3.0.0'

shelf_router_generator/analysis_options.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml
22

33
analyzer:
44
strong-mode:

shelf_router_generator/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dev_dependencies:
2121
build_runner: ^2.0.0
2222
build_verify: ^2.0.0
2323
http: ^0.13.0
24-
pedantic: ^1.4.0
24+
lints: ^1.0.0
2525
test: ^1.5.3
2626

2727
environment:

shelf_router_generator/test/server/service.dart

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
// @dart=2.12
1616

1717
import 'dart:async' show Future, FutureOr;
18+
1819
import 'package:shelf/shelf.dart';
1920
import 'package:shelf_router/shelf_router.dart';
21+
2022
import 'api.dart';
2123
import 'unrelatedannotation.dart';
2224

@@ -39,7 +41,7 @@ class Service {
3941

4042
@Route.get('/hi/<user>')
4143
Future<Response> _hi(Request request) async {
42-
final name = params(request, 'user');
44+
final name = request.params['user'];
4345
return Response.ok('hi $name');
4446
}
4547

slugid/analysis_options.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml

slugid/lib/slugid.dart

+7-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121
library slugid;
2222

2323
import 'dart:convert';
24-
import 'src/random.dart';
2524
import 'dart:typed_data';
25+
2626
import 'package:convert/convert.dart';
2727
import 'package:meta/meta.dart' show sealed;
2828

29+
import 'src/random.dart';
30+
2931
final _uuidPattern = RegExp(
3032
r'[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}');
3133

@@ -119,7 +121,7 @@ class Slugid {
119121
///
120122
/// This method also accepts string representations of slugids and UUIDs.
121123
@override
122-
bool operator ==(dynamic other) {
124+
bool operator ==(Object other) {
123125
// If other is a string we try to decode it.
124126
if (other is String) {
125127
try {
@@ -139,4 +141,7 @@ class Slugid {
139141
}
140142
return false;
141143
}
144+
145+
@override
146+
int get hashCode => Object.hashAll(_bytes);
142147
}

slugid/pubspec.yaml

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
name: slugid
2-
version: 1.1.0
2+
version: 1.1.1
33
description: |
44
A URL-safe base64 encoding for UUIDv4 stripped of padding. Useful when
55
embedding short random UUIDs in URLs.
66
homepage: https://github.com/google/dart-neats/tree/master/slugid
77
repository: https://github.com/google/dart-neats.git
88
issue_tracker: https://github.com/google/dart-neats/labels/pkg:slugid
9+
10+
environment:
11+
sdk: '>=2.14.0 <3.0.0'
12+
913
dependencies:
10-
convert: ^3.0.0-nullsafety.0
11-
meta: ^1.3.0-nullsafety.6
14+
convert: ^3.0.0
15+
meta: ^1.3.0
16+
1217
dev_dependencies:
13-
test: ^1.16.0-nullsafety.12
14-
pedantic: ^1.10.0-nullsafety.3
15-
environment:
16-
sdk: '>=2.12.0 <3.0.0'
18+
test: ^1.16.0
19+
lints: ^1.0.0
20+

0 commit comments

Comments
 (0)