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

Package update #75

Merged
merged 3 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 4 additions & 2 deletions .github/workflows/contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ jobs:
contributor_list:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: cjdenio/contributor_list@master
- name: Checkout Repository
uses: actions/checkout@v4
- name: Contributor List
uses: cjdenio/contributor_list@master
with:
commit_message: 📝 Update contributors list
max_contributors: 10
24 changes: 14 additions & 10 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,28 @@ on:
- pull_request

jobs:
dartfmt:
format:
runs-on: ubuntu-latest
container:
image: google/dart:latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Dart SDK
uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Run format
run: dartfmt --dry-run --set-exit-if-changed .
run: dart format --set-exit-if-changed .

import_sorter:
runs-on: ubuntu-latest
container:
image: google/dart:latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Dart SDK
uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Run import_sorter
run: |
pub get
pub run import_sorter:main --exit-if-changed
dart pub get
dart run import_sorter:main --exit-if-changed
14 changes: 8 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ jobs:
build:
runs-on: ubuntu-latest

container:
image: google/dart:latest

steps:
- uses: actions/checkout@v2
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Dart SDK
uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Install dependencies
run: pub get
run: dart pub get
- name: Run tests
run: pub run test
run: dart pub run test
19 changes: 19 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
include: package:flutter_lints/flutter.yaml
vkammerer marked this conversation as resolved.
Show resolved Hide resolved


analyzer:
errors:
prefer_const_constructors: error
annotate_overrides: error
prefer_single_quotes: error
sort_pub_dependencies: error
invalid_annotation_target: ignore

linter:
rules:
prefer_double_quotes: false
sort_pub_dependencies: true
annotate_overrides: true
file_names: false
overridden_fields: false
prefer_single_quotes: true
6 changes: 3 additions & 3 deletions bin/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,18 @@ void main(List<String> args) {

// Outputting results
if (sortedFiles.length > 1) {
stdout.write("\n");
stdout.write('\n');
}
for (int i = 0; i < sortedFiles.length; i++) {
final file = dartFiles[sortedFiles[i]];
stdout.write(
'${sortedFiles.length == 1 ? '\n' : ''}┃ ${i == sortedFiles.length - 1 ? '┗' : '┣'}━━ ${success} Sorted imports for ${file?.path.replaceFirst(currentPath, '')}/');
String filename = file!.path.split(Platform.pathSeparator).last;
stdout.write(filename + "\n");
stdout.write(filename + '\n');
}

if (sortedFiles.length == 0) {
stdout.write("\n");
stdout.write('\n');
}
stdout.write(
'┗━━ ${success} Sorted ${sortedFiles.length} files in ${stopwatch.elapsed.inSeconds}.${stopwatch.elapsedMilliseconds} seconds\n');
Expand Down
4 changes: 0 additions & 4 deletions example/example_app/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// 🎯 Dart imports:
import 'dart:async';
import 'dart:io';
import 'dart:js';

// 🐦 Flutter imports:
import 'package:flutter/cupertino.dart';
Expand All @@ -17,7 +14,6 @@ import 'package:provider/provider.dart';

// 🌎 Project imports:
import 'package:example_app/anotherFile2.dart';
import 'anotherFile.dart';

void main() {
runApp(MyApp());
Expand Down
4 changes: 2 additions & 2 deletions lib/files.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ Map<String, File> dartFiles(String currentPath, List<String> args) {
var onlyCertainFiles = false;
for (final arg in args) {
if (!onlyCertainFiles) {
onlyCertainFiles = arg.endsWith("dart");
onlyCertainFiles = arg.endsWith('dart');
}
}

if (onlyCertainFiles) {
final patterns = args.where((arg) => !arg.startsWith("-"));
final patterns = args.where((arg) => !arg.startsWith('-'));
final filesToKeep = <String, File>{};

for (final fileName in dartFiles.keys) {
Expand Down
10 changes: 6 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ authors:
- Flutter Community <[email protected]>

environment:
sdk: ">=2.12.0 <3.0.0"
sdk: ">=2.12.0 <4.0.0"

dependencies:
args: ^2.0.0
tint: ^2.0.0
yaml: ^3.1.0
args: ^2.4.2
tint: ^2.0.1
yaml: ^3.1.2

dev_dependencies:
test: ^1.16.7
lints: ^3.0.0


import_sorter:
emojis: true