Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Commit

Permalink
Upgrade to package:pedantic 1.9.0 (#641)
Browse files Browse the repository at this point in the history
Fix newly enforced lints:

- prefer_conditional_assignment
- prefer_if_null_operators
- unnecessary_this

Drop unused author field from pubspec.
  • Loading branch information
natebosch committed Dec 10, 2019
1 parent 10bf2b8 commit 5cbc172
Show file tree
Hide file tree
Showing 23 changed files with 85 additions and 96 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.3.5-dev

- Internal cleanup.

## 3.3.4

- Dropped `flutter_web_preview`, because you can now use the Flutter SDK to
Expand Down
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.1.8.0.yaml
include: package:pedantic/analysis_options.1.9.0.yaml
analyzer:
exclude:
- 'templates/**'
Expand Down
6 changes: 2 additions & 4 deletions lib/src/cli_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CliApp {
generators.sort();
}

io.Directory get cwd => _cwd != null ? _cwd : io.Directory.current;
io.Directory get cwd => _cwd ?? io.Directory.current;

/// An override for the directory to generate into; public for testing.
set cwd(io.Directory value) {
Expand Down Expand Up @@ -159,9 +159,7 @@ additional analytics to help us improve Stagehand [y/yes/no]?''');
var projectName = path.basename(dir.path);
projectName = normalizeProjectName(projectName);

if (target == null) {
target = _DirectoryGeneratorTarget(logger, dir);
}
target ??= _DirectoryGeneratorTarget(logger, dir);

_out('Creating $generatorName application `$projectName`:');

Expand Down
10 changes: 5 additions & 5 deletions lib/src/generators/console_full.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions lib/src/generators/package_simple.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 19 additions & 20 deletions lib/src/generators/server_shelf.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions lib/src/generators/web_angular.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions lib/src/generators/web_simple.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 28 additions & 29 deletions lib/src/generators/web_stagexl.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/src/version.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions lib/stagehand.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ abstract class Generator implements Comparable<Generator> {
void setEntrypoint(TemplateFile entrypoint) {
if (_entrypoint != null) throw StateError('entrypoint already set');
if (entrypoint == null) throw StateError('entrypoint is null');
this._entrypoint = entrypoint;
_entrypoint = entrypoint;
}

Future generate(String projectName, GeneratorTarget target,
Expand Down Expand Up @@ -116,7 +116,7 @@ abstract class Generator implements Comparable<Generator> {

@override
int compareTo(Generator other) =>
this.id.toLowerCase().compareTo(other.id.toLowerCase());
id.toLowerCase().compareTo(other.id.toLowerCase());

/// Return some user facing instructions about how to finish installation of
/// the template.
Expand Down Expand Up @@ -145,7 +145,7 @@ class TemplateFile {

TemplateFile(this.path, this.content);

TemplateFile.fromBinary(this.path, this._binaryData) : this.content = null;
TemplateFile.fromBinary(this.path, this._binaryData) : content = null;

FileContents runSubstitution(Map<String, String> parameters) {
if (path == 'pubspec.yaml' && parameters['author'] == '<your name>') {
Expand Down
3 changes: 1 addition & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ description: >
A scaffolding generator for your Dart projects. Stagehand helps you get set
up!
# After changing the version, run `pub run build_runner build`.
version: 3.3.4
version: 3.3.5-dev
homepage: https://github.com/dart-lang/stagehand
author: Dart Team <misc@dartlang.org>

environment:
# Make sure this Dart SDK version is no higher than the stable Flutter Dart
Expand Down
2 changes: 1 addition & 1 deletion templates/console-full/bin/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:__projectName__/__projectName__.dart' as __projectName__;

main(List<String> arguments) {
void main(List<String> arguments) {
print('Hello world: ${__projectName__.calculate()}!');
}
1 change: 0 additions & 1 deletion templates/console-full/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: __projectName__
description: A sample command-line application.
# version: 1.0.0
# homepage: https://www.example.com
# author: __author__ <__email__>

environment:
sdk: '>=2.5.0 <3.0.0'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:__projectName__/__projectName__.dart';

main() {
void main() {
var awesome = Awesome();
print('awesome: ${awesome.isAwesome}');
}
1 change: 0 additions & 1 deletion templates/package-simple/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: __projectName__
description: A starting point for Dart libraries or applications.
# version: 1.0.0
# homepage: https://www.example.com
# author: __author__ <__email__>

environment:
sdk: '>=2.5.0 <3.0.0'
Expand Down
2 changes: 1 addition & 1 deletion templates/server-shelf/bin/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:shelf/shelf_io.dart' as io;
// For Google Cloud Run, set _hostname to '0.0.0.0'.
const _hostname = 'localhost';

main(List<String> args) async {
void main(List<String> args) async {
var parser = ArgParser()..addOption('port', abbr: 'p');
var result = parser.parse(args);

Expand Down
1 change: 0 additions & 1 deletion templates/server-shelf/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: __projectName__
description: A web server built using the shelf package.
# version: 1.0.0
# homepage: https://www.example.com
# author: __author__ <__email__>

environment:
sdk: '>=2.5.0 <3.0.0'
Expand Down
1 change: 0 additions & 1 deletion templates/web-angular/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: __projectName__
description: A web app that uses AngularDart Components
# version: 1.0.0
# homepage: https://www.example.com
# author: __author__ <__email__>

environment:
sdk: '>=2.5.0 <3.0.0'
Expand Down
1 change: 0 additions & 1 deletion templates/web-simple/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: __projectName__
description: An absolute bare-bones web app.
# version: 1.0.0
#homepage: https://www.example.com
#author: __author__ <__email__>

environment:
sdk: '>=2.5.0 <3.0.0'
Expand Down
1 change: 0 additions & 1 deletion templates/web-stagexl/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: __projectName__
description: A simple StageXL web app.
# version: 1.0.0
#homepage: https://www.example.com
#author: __author__ <__email__>

environment:
sdk: '>=2.5.0 <3.0.0'
Expand Down
8 changes: 4 additions & 4 deletions templates/web-stagexl/web/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import 'dart:html' as html;
import 'package:stagexl/stagexl.dart';
import 'dart:math';

Future<Null> main() async {
StageOptions options = StageOptions()
Future<void> main() async {
var options = StageOptions()
..backgroundColor = Color.White
..renderEngine = RenderEngine.WebGL;

Expand All @@ -15,11 +15,11 @@ Future<Null> main() async {
renderLoop.addStage(stage);

var resourceManager = ResourceManager();
resourceManager.addBitmapData("dart", "images/dart@1x.png");
resourceManager.addBitmapData('dart', 'images/dart@1x.png');

await resourceManager.load();

var logoData = resourceManager.getBitmapData("dart");
var logoData = resourceManager.getBitmapData('dart');
var logo = Sprite();
logo.addChild(Bitmap(logoData));

Expand Down
1 change: 0 additions & 1 deletion test/validate_templates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ final _pubspecOrder = const [
'description',
'version',
'homepage',
'author(s)?',
'environment',
'dependencies',
'dev_dependencies',
Expand Down

0 comments on commit 5cbc172

Please sign in to comment.