Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to package lints 2.0 #1679

Merged
merged 2 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,4 @@ analyzer:
linter:
rules:
- avoid_private_typedef_functions
- await_only_futures
- depend_on_referenced_packages
- implementation_imports
- prefer_generic_function_type_aliases
- prefer_single_quotes
- prefer_typing_uninitialized_variables
- unnecessary_const
- unnecessary_new
2 changes: 1 addition & 1 deletion integration_tests/nnbd_opted_in/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: nnbd_opted_in
environment:
sdk: '>=2.12.0 <3.0.0'
dev_dependencies:
lints: ^1.0.0
lints: '>=1.0.0 <3.0.0'
test: any
dependency_overrides:
test:
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/nnbd_opted_out/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: nnbd_opted_out
environment:
sdk: '>=2.11.0 <3.0.0'
dev_dependencies:
lints: ^1.0.0
lints: '>=1.0.0 <3.0.0'
test: any
dependency_overrides:
test:
Expand Down
2 changes: 2 additions & 0 deletions pkgs/test/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 1.20.3-dev

## 1.20.2

* Drop `dart2js-path` command line argument.
Expand Down
24 changes: 12 additions & 12 deletions pkgs/test/lib/src/runner/browser/platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class BrowserPlatform extends PlatformPlugin
final _secret = Uri.encodeComponent(randomBase64(24));

/// The URL for this server.
Uri get url => _server.url.resolve(_secret + '/');
Uri get url => _server.url.resolve('$_secret/');

/// A [OneOffHandler] for servicing WebSocket connections for
/// [BrowserManager]s.
Expand Down Expand Up @@ -167,7 +167,7 @@ class BrowserPlatform extends PlatformPlugin
var path = p.fromUri(request.url);

if (path.endsWith('.html')) {
var test = p.withoutExtension(path) + '.dart';
var test = '${p.withoutExtension(path)}.dart';
var scriptBase = htmlEscape.convert(p.basename(test));
var link = '<link rel="x-dart-test" href="$scriptBase">';
var testName = htmlEscape.convert(test);
Expand Down Expand Up @@ -215,7 +215,7 @@ class BrowserPlatform extends PlatformPlugin
throw ArgumentError('$browser is not a browser.');
}

var htmlPathFromTestPath = p.withoutExtension(path) + '.html';
var htmlPathFromTestPath = '${p.withoutExtension(path)}.html';
if (File(htmlPathFromTestPath).existsSync()) {
if (_config.customHtmlTemplatePath != null &&
p.basename(htmlPathFromTestPath) ==
Expand Down Expand Up @@ -262,7 +262,7 @@ class BrowserPlatform extends PlatformPlugin

if (_closed) return null;
suiteUrl = url.resolveUri(
p.toUri(p.withoutExtension(p.relative(path, from: _root)) + '.html'));
p.toUri('${p.withoutExtension(p.relative(path, from: _root))}.html'));
}

if (_closed) return null;
Expand Down Expand Up @@ -297,7 +297,7 @@ class BrowserPlatform extends PlatformPlugin
print('"pub serve" is compiling $path...');
});

var sourceMapUrl = dartUrl.replace(path: dartUrl.path + '.js.map');
var sourceMapUrl = dartUrl.replace(path: '${dartUrl.path}.js.map');

try {
var request = await _http!.getUrl(sourceMapUrl);
Expand Down Expand Up @@ -347,7 +347,7 @@ class BrowserPlatform extends PlatformPlugin
Future<void> _compileSuite(String dartPath, SuiteConfiguration suiteConfig) {
return _compileFutures.putIfAbsent(dartPath, () async {
var dir = Directory(_compiledDir!).createTempSync('test_').path;
var jsPath = p.join(dir, p.basename(dartPath) + '.browser_test.dart.js');
var jsPath = p.join(dir, '${p.basename(dartPath)}.browser_test.dart.js');
var bootstrapContent = '''
${suiteConfig.metadata.languageVersionComment ?? await rootPackageLanguageVersionComment}
import "package:test/src/bootstrap/browser.dart";
Expand All @@ -362,29 +362,29 @@ class BrowserPlatform extends PlatformPlugin
await _compilers.compile(bootstrapContent, jsPath, suiteConfig);
if (_closed) return;

var bootstrapUrl = p.toUri(p.relative(dartPath, from: _root)).path +
var bootstrapUrl = '${p.toUri(p.relative(dartPath, from: _root)).path}'
'.browser_test.dart';
_jsHandler.add(bootstrapUrl, (request) {
return shelf.Response.ok(bootstrapContent,
headers: {'Content-Type': 'application/dart'});
});

var jsUrl = p.toUri(p.relative(dartPath, from: _root)).path +
var jsUrl = '${p.toUri(p.relative(dartPath, from: _root)).path}'
'.browser_test.dart.js';
_jsHandler.add(jsUrl, (request) {
return shelf.Response.ok(File(jsPath).readAsStringSync(),
headers: {'Content-Type': 'application/javascript'});
});

var mapUrl = p.toUri(p.relative(dartPath, from: _root)).path +
var mapUrl = '${p.toUri(p.relative(dartPath, from: _root)).path}'
'.browser_test.dart.js.map';
_jsHandler.add(mapUrl, (request) {
return shelf.Response.ok(File(jsPath + '.map').readAsStringSync(),
return shelf.Response.ok(File('$jsPath.map').readAsStringSync(),
headers: {'Content-Type': 'application/json'});
});

if (suiteConfig.jsTrace) return;
var mapPath = jsPath + '.map';
var mapPath = '$jsPath.map';
_mappers[dartPath] = JSStackTraceMapper(File(mapPath).readAsStringSync(),
mapUrl: p.toUri(mapPath),
sdkRoot: Uri.parse('org-dartlang-sdk:///sdk'),
Expand All @@ -396,7 +396,7 @@ class BrowserPlatform extends PlatformPlugin
String dartPath, SuiteConfiguration suiteConfig) async {
if (suiteConfig.jsTrace) return;
var mapPath = p.join(
suiteConfig.precompiledPath!, dartPath + '.browser_test.dart.js.map');
suiteConfig.precompiledPath!, '$dartPath.browser_test.dart.js.map');
var mapFile = File(mapPath);
if (mapFile.existsSync()) {
_mappers[dartPath] = JSStackTraceMapper(mapFile.readAsStringSync(),
Expand Down
2 changes: 1 addition & 1 deletion pkgs/test/lib/src/runner/browser/safari.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Safari extends Browser {
// want it to load.
var redirect = p.join(dir, 'redirect.html');
File(redirect).writeAsStringSync(
'<script>location = ' + jsonEncode(url.toString()) + '</script>');
'<script>location = ${jsonEncode(url.toString())}</script>');

var process = await Process.start(
settings.executable, settings.arguments.toList()..add(redirect));
Expand Down
Loading