Skip to content

Commit 670853d

Browse files
authored
Require Dart 3.0, update lints (dart-archive/io#109)
1 parent 55e4c0d commit 670853d

12 files changed

+76
-46
lines changed

pkgs/io/.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
sdk: [dev, 2.18.0]
23+
sdk: [dev, 3.0.0]
2424
steps:
2525
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
2626
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
@@ -47,7 +47,7 @@ jobs:
4747
matrix:
4848
# Add macos-latest and/or windows-latest if relevant for this package.
4949
os: [ubuntu-latest]
50-
sdk: [dev, 2.18.0]
50+
sdk: [dev, 3.0.0]
5151
steps:
5252
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
5353
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f

pkgs/io/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.5-wip
2+
3+
* Require Dart 3.0.
4+
15
## 1.0.4
26

37
* Updates to the readme.

pkgs/io/analysis_options.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,40 @@
1+
# https://dart.dev/guides/language/analysis-options
12
include: package:dart_flutter_team_lints/analysis_options.yaml
3+
4+
analyzer:
5+
language:
6+
strict-casts: true
7+
strict-inference: true
8+
strict-raw-types: true
9+
10+
linter:
11+
rules:
12+
- avoid_bool_literals_in_conditional_expressions
13+
- avoid_classes_with_only_static_members
14+
- avoid_private_typedef_functions
15+
- avoid_redundant_argument_values
16+
- avoid_returning_null
17+
- avoid_returning_null_for_future
18+
- avoid_returning_this
19+
- avoid_unused_constructor_parameters
20+
- avoid_void_async
21+
- cancel_subscriptions
22+
- comment_references
23+
- join_return_with_assignment
24+
- literal_only_boolean_expressions
25+
- missing_whitespace_between_adjacent_strings
26+
- no_adjacent_strings_in_list
27+
- no_runtimeType_toString
28+
- package_api_docs
29+
- prefer_const_constructors
30+
- prefer_const_declarations
31+
- prefer_expression_function_bodies
32+
- prefer_final_locals
33+
- prefer_relative_imports
34+
- test_types_in_equals
35+
- unnecessary_await_in_return
36+
- unnecessary_breaks
37+
- use_if_null_to_convert_nulls_to_bools
38+
- use_raw_strings
39+
- use_string_buffers
40+
- use_super_parameters

pkgs/io/lib/src/ansi_code.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'dart:async';
66
import 'dart:io' as io;
77

88
const _ansiEscapeLiteral = '\x1B';
9-
const _ansiEscapeForScript = '\\033';
9+
const _ansiEscapeForScript = r'\033';
1010

1111
/// Whether formatted ANSI output is enabled for [wrapWith] and [AnsiCode.wrap].
1212
///
@@ -136,14 +136,12 @@ String? wrapWith(String? value, Iterable<AnsiCode> codes,
136136
throw ArgumentError.value(codes, 'codes',
137137
'Cannot contain more than one foreground color code.');
138138
}
139-
break;
140139
case AnsiCodeType.background:
141140
background++;
142141
if (background > 1) {
143142
throw ArgumentError.value(codes, 'codes',
144143
'Cannot contain more than one foreground color code.');
145144
}
146-
break;
147145
case AnsiCodeType.reset:
148146
throw ArgumentError.value(
149147
codes, 'codes', 'Cannot contain reset codes.');

pkgs/io/lib/src/permissions.dart

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,13 @@ bool _hasPermission(
3434
return (stat.mode & (1 << index)) != 0;
3535
}
3636

37-
int _permissionBitIndex(_FilePermission permission, _FilePermissionRole role) {
38-
switch (permission) {
39-
case _FilePermission.setUid:
40-
return 11;
41-
case _FilePermission.setGid:
42-
return 10;
43-
case _FilePermission.sticky:
44-
return 9;
45-
default:
46-
return (role.index * 3) + permission.index;
47-
}
48-
}
37+
int _permissionBitIndex(_FilePermission permission, _FilePermissionRole role) =>
38+
switch (permission) {
39+
_FilePermission.setUid => 11,
40+
_FilePermission.setGid => 10,
41+
_FilePermission.sticky => 9,
42+
_ => (role.index * 3) + permission.index
43+
};
4944

5045
/// Returns whether [path] is considered an executable file on this OS.
5146
///

pkgs/io/lib/src/process_manager.dart

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ class _ForwardingSpawn extends Spawn {
215215
}
216216

217217
_ForwardingSpawn._delegate(
218-
io.Process delegate,
218+
super.delegate,
219219
this._stdInSub,
220220
this._stdOutSub,
221221
this._stdErrSub,
222222
this._stdOut,
223223
this._stdErr,
224-
) : super._(delegate);
224+
) : super._();
225225

226226
@override
227227
void _onClosed() {
@@ -240,24 +240,16 @@ class _ForwardingSpawn extends Spawn {
240240

241241
class _UnixProcessManager extends ProcessManager {
242242
const _UnixProcessManager(
243-
Stream<List<int>> stdin,
244-
io.IOSink stdout,
245-
io.IOSink stderr,
246-
) : super._(
247-
stdin,
248-
stdout,
249-
stderr,
250-
);
243+
super.stdin,
244+
super.stdout,
245+
super.stderr,
246+
) : super._();
251247
}
252248

253249
class _WindowsProcessManager extends ProcessManager {
254250
const _WindowsProcessManager(
255-
Stream<List<int>> stdin,
256-
io.IOSink stdout,
257-
io.IOSink stderr,
258-
) : super._(
259-
stdin,
260-
stdout,
261-
stderr,
262-
);
251+
super.stdin,
252+
super.stdout,
253+
super.stderr,
254+
) : super._();
263255
}

pkgs/io/lib/src/shell_words.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ List<String> shellSplit(String command) {
4747

4848
hasToken = true;
4949
token.writeCharCode(scanner.readChar());
50-
break;
5150

5251
case $singleQuote:
5352
hasToken = true;
@@ -59,7 +58,6 @@ List<String> shellSplit(String command) {
5958
_checkUnmatchedQuote(scanner, firstQuote);
6059
token.writeCharCode(scanner.readChar());
6160
}
62-
break;
6361

6462
case $doubleQuote:
6563
hasToken = true;
@@ -99,7 +97,6 @@ List<String> shellSplit(String command) {
9997
token.writeCharCode(scanner.readChar());
10098
}
10199
}
102-
break;
103100

104101
case $hash:
105102
// Section 2.3: If the current character is a '#' [and the previous
@@ -115,7 +112,6 @@ List<String> shellSplit(String command) {
115112
while (!scanner.isDone && scanner.peekChar() != $lf) {
116113
scanner.readChar();
117114
}
118-
break;
119115

120116
case $space:
121117
case $tab:
@@ -124,7 +120,6 @@ List<String> shellSplit(String command) {
124120
if (hasToken) results.add(token.toString());
125121
hasToken = false;
126122
token.clear();
127-
break;
128123

129124
default:
130125
hasToken = true;

pkgs/io/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ name: io
22
description: >-
33
Utilities for the Dart VM Runtime including support for ANSI colors, file
44
copying, and standard exit code values.
5-
version: 1.0.4
5+
version: 1.0.5-wip
66
repository: https://github.com/dart-lang/io
77

88
environment:
9-
sdk: ">=2.12.0 <3.0.0"
9+
sdk: ^3.0.0
1010

1111
dependencies:
1212
meta: ^1.3.0
1313
path: ^1.8.0
1414
string_scanner: ^1.1.0
1515

1616
dev_dependencies:
17-
dart_flutter_team_lints: ^0.1.0
17+
dart_flutter_team_lints: ^1.0.0
1818
test: ^1.16.0
1919
test_descriptor: ^2.0.0

pkgs/io/test/ansi_code_test.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
@TestOn('vm')
6+
library;
7+
68
import 'dart:io';
9+
710
import 'package:io/ansi.dart';
811
import 'package:test/test.dart';
912

1013
const _ansiEscapeLiteral = '\x1B';
11-
const _ansiEscapeForScript = '\\033';
14+
const _ansiEscapeForScript = r'\033';
1215
const sampleInput = 'sample input';
1316

1417
void main() {

pkgs/io/test/copy_path_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
@TestOn('vm')
6+
library;
7+
68
import 'package:io/io.dart';
79
import 'package:path/path.dart' as p;
810
import 'package:test/test.dart';

0 commit comments

Comments
 (0)