Update to lints 3.0.0

This commit is contained in:
Simon Binder 2023-11-16 21:25:21 +01:00
parent 0a457e92e5
commit 220c7125a3
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
55 changed files with 88 additions and 108 deletions

View File

@ -29,7 +29,7 @@ class MyDatabase extends $MyDatabase {
@override
int get schemaVersion => 1;
MyDatabase(QueryExecutor e) : super(e);
MyDatabase(super.e);
// #docregion amountOfTodosInCategory
Stream<int> amountOfTodosInCategory(int id) {

View File

@ -18,7 +18,7 @@ class Todos extends Table {
@DriftDatabase(tables: [Todos])
class MyDatabase extends _$MyDatabase {
MyDatabase(QueryExecutor e) : super(e);
MyDatabase(super.e);
// #docregion start
@override

View File

@ -8,14 +8,14 @@ import 'package:drift_dev/api/migrations.dart';
const kDebugMode = true;
abstract class _$MyDatabase extends GeneratedDatabase {
_$MyDatabase(QueryExecutor executor) : super(executor);
_$MyDatabase(super.executor);
}
// #docregion
class MyDatabase extends _$MyDatabase {
// #enddocregion
MyDatabase(QueryExecutor executor) : super(executor);
MyDatabase(super.executor);
@override
Iterable<TableInfo<Table, dynamic>> get allTables =>

View File

@ -1,9 +1,8 @@
import 'package:drift/drift.dart';
import 'example.drift.dart';
class DartExample extends ExampleDrift {
DartExample(GeneratedDatabase attachedDatabase) : super(attachedDatabase);
DartExample(super.attachedDatabase);
// #docregion watchInCategory
Stream<List<Todo>> watchInCategory(int category) {

View File

@ -48,7 +48,7 @@ class ShoppingCartEntries {
@DriftDatabase(tables: [BuyableItems, ShoppingCarts])
class JsonBasedDatabase extends $JsonBasedDatabase {
JsonBasedDatabase(QueryExecutor e) : super(e);
JsonBasedDatabase(super.e);
@override
int get schemaVersion => 1;

View File

@ -31,7 +31,7 @@ class ShoppingCartEntries extends Table {
@DriftDatabase(tables: [BuyableItems, ShoppingCarts, ShoppingCartEntries])
class RelationalDatabase extends $RelationalDatabase {
RelationalDatabase(QueryExecutor e) : super(e);
RelationalDatabase(super.e);
@override
int get schemaVersion => 1;

View File

@ -28,7 +28,7 @@ DatabaseConnection connectOnWeb() {
// You can then use this method to open your database:
class MyWebDatabase extends _$MyWebDatabase {
MyWebDatabase._(QueryExecutor e) : super(e);
MyWebDatabase._(super.e);
factory MyWebDatabase() => MyWebDatabase._(connectOnWeb());
// ...

View File

@ -36,7 +36,7 @@ dependencies:
postgres: ^3.0.0-0
dev_dependencies:
lints: ^2.0.0
lints: ^3.0.0
build: ^2.1.0
build_runner: ^2.0.5
build_runner_core: ^7.2.7

View File

@ -11,7 +11,7 @@ class Users extends Table {
@DriftDatabase(tables: [Users])
class Database extends _$Database {
Database(QueryExecutor c) : super(c);
Database(super.c);
@override
int get schemaVersion => 1;

View File

@ -35,7 +35,7 @@ class SnippetsBuilder extends CodeExcerptBuilder {
}
class _DriftHighlighter extends Highlighter {
_DriftHighlighter(SourceFile file) : super(file);
_DriftHighlighter(super.file);
@override
void highlight() {

View File

@ -64,7 +64,7 @@ abstract class TodoItemWithCategoryNameView extends View {
TodoItemWithCategoryNameView,
])
class Database extends _$Database {
Database(QueryExecutor e) : super(e);
Database(super.e);
@override
int get schemaVersion => 2;

View File

@ -223,9 +223,9 @@ class VersionedVirtualTable extends VersionedTable
/// Create a virtual table by copying fields from [source] and applying a
/// [alias] to columns.
VersionedVirtualTable.aliased(
{required VersionedVirtualTable source, required String? alias})
{required VersionedVirtualTable super.source, required super.alias})
: moduleAndArgs = source.moduleAndArgs,
super.aliased(source: source, alias: alias);
super.aliased();
@override
VersionedVirtualTable createAlias(String alias) {

View File

@ -48,8 +48,8 @@ class NativeDatabase extends DelegatedDatabase {
// when changing this, also update the documentation in `drift_vm_database_factory`.
static const _cacheStatementsByDefault = false;
NativeDatabase._(DatabaseDelegate delegate, bool logStatements)
: super(delegate, isSequential: false, logStatements: logStatements);
NativeDatabase._(super.delegate, bool logStatements)
: super(isSequential: false, logStatements: logStatements);
/// Creates a database that will store its result in the [file], creating it
/// if it doesn't exist.
@ -253,15 +253,12 @@ class _NativeDelegate extends Sqlite3Delegate<Database> {
);
_NativeDelegate.opened(
Database db,
DatabaseSetup? setup,
bool closeUnderlyingWhenClosed,
Database super.db,
super.setup,
super.closeUnderlyingWhenClosed,
bool cachePreparedStatements,
) : file = null,
super.opened(
db,
setup,
closeUnderlyingWhenClosed,
cachePreparedStatements: cachePreparedStatements,
);

View File

@ -135,8 +135,7 @@ abstract class _BaseExecutor extends QueryExecutor {
}
class _RemoteQueryExecutor extends _BaseExecutor {
_RemoteQueryExecutor(DriftClient client, [int? executorId])
: super(client, executorId);
_RemoteQueryExecutor(super.client, [super.executorId]);
Completer<void>? _setSchemaVersion;
Future<bool>? _serverIsOpen;
@ -181,8 +180,7 @@ class _RemoteTransactionExecutor extends _BaseExecutor
implements TransactionExecutor {
final int? _outerExecutorId;
_RemoteTransactionExecutor(DriftClient client, this._outerExecutorId)
: super(client);
_RemoteTransactionExecutor(super.client, this._outerExecutorId);
Completer<bool>? _pendingOpen;
bool _done = false;

View File

@ -59,14 +59,13 @@ abstract class GeneratedDatabase extends DatabaseConnectionUser
final Type _$dontSendThisOverIsolates = Null;
/// Used by generated code
GeneratedDatabase(QueryExecutor executor, {StreamQueryStore? streamStore})
: super(executor, streamQueries: streamStore) {
GeneratedDatabase(super.executor, {StreamQueryStore? streamStore})
: super(streamQueries: streamStore) {
_whenConstructed();
}
/// Used by generated code to connect to a database that is already open.
GeneratedDatabase.connect(DatabaseConnection connection)
: super.fromConnection(connection) {
GeneratedDatabase.connect(super.connection) : super.fromConnection() {
_whenConstructed();
}

View File

@ -5,8 +5,7 @@ class DeleteStatement<T extends Table, D> extends Query<T, D>
with SingleTableQueryMixin<T, D> {
/// This constructor should be called by [DatabaseConnectionUser.delete] for
/// you.
DeleteStatement(DatabaseConnectionUser database, TableInfo<T, D> table)
: super(database, table);
DeleteStatement(super.database, TableInfo<T, D> super.table);
@override
void writeStartPart(GenerationContext ctx) {

View File

@ -30,10 +30,7 @@ class SimpleSelectStatement<T extends HasResultSet, D> extends Query<T, D>
/// Used internally by drift, users will want to call
/// [DatabaseConnectionUser.select] instead.
SimpleSelectStatement(
DatabaseConnectionUser database, ResultSetImplementation<T, D> table,
{this.distinct = false})
: super(database, table);
SimpleSelectStatement(super.database, super.table, {this.distinct = false});
/// The tables this select statement reads from.
@visibleForOverriding

View File

@ -10,12 +10,10 @@ class JoinedSelectStatement<FirstT extends HasResultSet, FirstD>
implements BaseSelectStatement {
/// Used internally by drift, users should use [SimpleSelectStatement.join]
/// instead.
JoinedSelectStatement(DatabaseConnectionUser database,
ResultSetImplementation<FirstT, FirstD> table, this._joins,
JoinedSelectStatement(super.database, super.table, this._joins,
[this.distinct = false,
this._includeMainTableInResult = true,
this._includeJoinedTablesInResult = true])
: super(database, table);
this._includeJoinedTablesInResult = true]);
/// Whether to generate a `SELECT DISTINCT` query that will remove duplicate
/// rows from the result set.

View File

@ -4,8 +4,7 @@ part of '../query_builder.dart';
class UpdateStatement<T extends Table, D> extends Query<T, D>
with SingleTableQueryMixin<T, D> {
/// Used internally by drift, construct an update statement
UpdateStatement(DatabaseConnectionUser database, TableInfo<T, D> table)
: super(database, table);
UpdateStatement(super.database, TableInfo<T, D> super.table);
late Map<String, Expression> _updatedFields;

View File

@ -31,8 +31,8 @@ export 'src/web/wasm_setup/types.dart';
/// how to obtain this file. A [working example](https://github.com/simolus3/drift/blob/04539882330d80519128fec1ceb120fb1623a831/examples/app/lib/database/connection/web.dart#L27-L36)
/// is also available in the drift repository.
class WasmDatabase extends DelegatedDatabase {
WasmDatabase._(DatabaseDelegate delegate, bool logStatements)
: super(delegate, isSequential: true, logStatements: logStatements);
WasmDatabase._(super.delegate, bool logStatements)
: super(isSequential: true, logStatements: logStatements);
/// Creates a wasm database at [path] in the virtual file system of the
/// [sqlite3] module.

View File

@ -28,7 +28,7 @@ dev_dependencies:
drift_testcases:
path: ../extras/integration_tests/drift_testcases
http: ^0.13.4
lints: ^2.0.0
lints: ^3.0.0
uuid: ^4.0.0
build_runner: ^2.0.0
test: ^1.17.0

View File

@ -6,7 +6,7 @@ import '../generated/todos.dart';
import '../test_utils/test_utils.dart';
class _FakeDb extends GeneratedDatabase {
_FakeDb(QueryExecutor executor) : super(executor);
_FakeDb(super.executor);
@override
MigrationStrategy get migration {

View File

@ -321,7 +321,7 @@ final class _FakeSchemaVersion extends VersionedSchema {
}
class _DefaultDb extends GeneratedDatabase {
_DefaultDb(QueryExecutor executor) : super(executor);
_DefaultDb(super.executor);
@override
List<TableInfo<Table, DataClass>> get allTables => [];

View File

@ -15,7 +15,7 @@ part 'custom_tables.g.dart';
},
)
class CustomTablesDb extends _$CustomTablesDb {
CustomTablesDb(QueryExecutor e) : super(e) {
CustomTablesDb(super.e) {
driftRuntimeOptions.dontWarnAboutMultipleDatabases = true;
}

View File

@ -257,7 +257,7 @@ class TodoDb extends _$TodoDb {
},
)
class SomeDao extends DatabaseAccessor<TodoDb> with _$SomeDaoMixin {
SomeDao(TodoDb db) : super(db);
SomeDao(super.db);
}
QueryExecutor get _nullExecutor =>

View File

@ -35,7 +35,7 @@ DatabaseConnection createConnection() {
}
class EmptyDb extends GeneratedDatabase {
EmptyDb(DatabaseConnection c) : super(c);
EmptyDb(DatabaseConnection super.c);
@override
final List<TableInfo> allTables = const [];
@override

View File

@ -495,8 +495,7 @@ void main() {
}
class _TestDatabase extends GeneratedDatabase {
_TestDatabase(QueryExecutor executor, this.schemaVersion, this.migration)
: super(executor);
_TestDatabase(super.executor, this.schemaVersion, this.migration);
@override
Iterable<TableInfo<Table, dynamic>> get allTables => const Iterable.empty();

View File

@ -61,7 +61,7 @@ CREATE TABLE IF NOT EXISTS todo_categories (
}
class _Database extends GeneratedDatabase {
_Database(QueryExecutor executor) : super(executor);
_Database(super.executor);
@override
Iterable<TableInfo<Table, dynamic>> get allTables => const Iterable.empty();

View File

@ -3,7 +3,7 @@ import 'dart:io';
import '../cli.dart';
class AnalyzeCommand extends MoorCommand {
AnalyzeCommand(DriftDevCli cli) : super(cli);
AnalyzeCommand(super.cli);
@override
String get description => 'Analyze and lint drift database code';

View File

@ -7,7 +7,7 @@ import '../../analysis/results/results.dart';
import '../cli.dart';
class IdentifyDatabases extends MoorCommand {
IdentifyDatabases(DriftDevCli cli) : super(cli);
IdentifyDatabases(super.cli);
@override
String get description =>

View File

@ -26,7 +26,7 @@ class MigrateCommand extends MoorCommand {
late final AnalysisContext context;
MigrateCommand(DriftDevCli cli) : super(cli);
MigrateCommand(super.cli);
@override
String get description => 'Migrate a project from moor to drift';

View File

@ -86,7 +86,8 @@ class DumpSchemaCommand extends Command {
try {
final elements = await extractDriftElementsFromDatabase(opened);
final userVersion = opened.select('pragma user_version').single[0] as int;
final userVersion =
opened.select('pragma user_version').single.columnAt(0) as int;
return _AnalyzedDatabase(elements, userVersion);
} finally {

View File

@ -85,7 +85,7 @@ class ModularAccessorWriter {
// Also make imports available
final imports = file.discovery?.importDependencies ?? const [];
for (final import in imports) {
final file = driver.cache.knownFiles[import];
final file = driver.cache.knownFiles[import.uri];
if (file != null && file.needsModularAccessor(driver)) {
final moduleClass = restOfClass.modularAccessor(import.uri);

View File

@ -50,7 +50,7 @@ dependencies:
string_scanner: ^1.1.1
dev_dependencies:
lints: ^2.0.0
lints: ^3.0.0
checked_yaml: ^2.0.1
test: ^1.16.0
test_descriptor: ^2.0.0

View File

@ -42,8 +42,8 @@ class _TestDatabase extends GeneratedDatabase {
@override
DriftDatabaseOptions options = DriftDatabaseOptions();
_TestDatabase.connect(DatabaseConnection connection)
: super.connect(connection);
_TestDatabase.connect(super.connection)
: super.connect();
}
void main() {

View File

@ -80,7 +80,7 @@ class _TestDatabase extends GeneratedDatabase {
@override
MigrationStrategy migration = MigrationStrategy();
_TestDatabase(QueryExecutor executor, this.schemaVersion) : super(executor);
_TestDatabase(super.executor, this.schemaVersion);
@override
Iterable<TableInfo<Table, DataClass>> get allTables {

View File

@ -18,7 +18,7 @@ dependencies:
dev_dependencies:
integration_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter_lints: ^3.0.0
flutter_test:
sdk: flutter
drift_testcases:

View File

@ -19,7 +19,7 @@ void main() {
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});
@override
Widget build(BuildContext context) {
@ -35,7 +35,7 @@ class MyApp extends StatelessWidget {
}
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePageState();
@ -95,7 +95,7 @@ class _AddEntryDialog extends StatefulWidget {
// database around, but tiny example only wants to show how to use encryption.
final MyEncryptedDatabase database;
const _AddEntryDialog({Key? key, required this.database}) : super(key: key);
const _AddEntryDialog({required this.database});
@override
State<_AddEntryDialog> createState() => _AddEntryDialogState();

View File

@ -19,7 +19,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter_lints: ^3.0.0
drift_dev: ^2.0.2
build_runner: ^2.2.0

View File

@ -21,7 +21,7 @@ class Database extends _$Database {
@override
int get schemaVersion => latestSchemaVersion;
Database(DatabaseConnection connection) : super(connection);
Database(DatabaseConnection super.connection);
@override
MigrationStrategy get migration {

View File

@ -10,6 +10,6 @@ dependencies:
drift_dev:
dev_dependencies:
lints: ^2.0.0
lints: ^3.0.0
build_runner: ^2.0.0
test: ^1.15.4

View File

@ -11,5 +11,5 @@ dependencies:
dev_dependencies:
build_runner: ^2.3.2
drift_dev:
lints: ^2.0.0
lints: ^3.0.0
test: ^1.16.0

View File

@ -14,5 +14,5 @@ dependencies:
dev_dependencies:
build_runner: ^2.1.11
build_web_compilers: ^4.0.0
lints: ^2.0.0
lints: ^3.0.0
drift_dev:

View File

@ -27,7 +27,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter_lints: ^3.0.0
flutter:
uses-material-design: true

View File

@ -11,7 +11,7 @@ dependencies:
mysql_client: ^0.0.27
dev_dependencies:
lints: ^2.0.0
lints: ^3.0.0
test: ^1.21.0
drift_testcases:
path: ../integration_tests/drift_testcases

View File

@ -88,7 +88,7 @@ class Database extends _$Database {
@override
final int schemaVersion;
Database(DatabaseConnection e, {this.schemaVersion = 2}) : super(e);
Database(DatabaseConnection super.e, {this.schemaVersion = 2});
Database.executor(QueryExecutor db) : this(DatabaseConnection(db));

View File

@ -15,4 +15,4 @@ dev_dependencies:
build_runner: ^2.1.11
drift_dev: ^2.0.0
json_serializable: ^6.2.0
lints: ^2.0.0
lints: ^3.0.0

View File

@ -23,5 +23,5 @@ dev_dependencies:
build_runner: ^2.4.5
build_web_compilers: ^4.0.0
drift_dev:
lints: ^2.0.0
lints: ^3.0.0
test: ^1.24.3

View File

@ -44,11 +44,10 @@ class UnresolvedReferenceError extends AnalysisError {
final Iterable<String> available;
UnresolvedReferenceError(
{required AnalysisErrorType type,
{required super.type,
required this.reference,
required this.available,
AstNode? relevantNode})
: super(type: type, relevantNode: relevantNode);
AstNode? super.relevantNode});
@override
String get message {

View File

@ -95,7 +95,7 @@ class NullColumnConstraint extends ColumnConstraint {
/// The `NULL` token forming this constraint.
Token? $null;
NullColumnConstraint(String? name, {this.$null}) : super(name);
NullColumnConstraint(super.name, {this.$null});
@override
Iterable<AstNode> get childNodes => const Iterable.empty();
@ -110,7 +110,7 @@ class NotNull extends ColumnConstraint {
Token? not;
Token? $null;
NotNull(String? name, {this.onConflict}) : super(name);
NotNull(super.name, {this.onConflict});
@override
final Iterable<AstNode> childNodes = const [];
@ -124,9 +124,8 @@ class PrimaryKeyColumn extends ColumnConstraint {
final ConflictClause? onConflict;
final OrderingMode? mode;
PrimaryKeyColumn(String? name,
{this.autoIncrement = false, this.mode, this.onConflict})
: super(name);
PrimaryKeyColumn(super.name,
{this.autoIncrement = false, this.mode, this.onConflict});
@override
Iterable<AstNode> get childNodes => const [];
@ -138,7 +137,7 @@ class PrimaryKeyColumn extends ColumnConstraint {
class UniqueColumn extends ColumnConstraint {
final ConflictClause? onConflict;
UniqueColumn(String? name, this.onConflict) : super(name);
UniqueColumn(super.name, this.onConflict);
@override
Iterable<AstNode> get childNodes => const [];
@ -150,7 +149,7 @@ class UniqueColumn extends ColumnConstraint {
class CheckColumn extends ColumnConstraint {
Expression expression;
CheckColumn(String? name, this.expression) : super(name);
CheckColumn(super.name, this.expression);
@override
Iterable<AstNode> get childNodes => [expression];
@ -164,7 +163,7 @@ class CheckColumn extends ColumnConstraint {
class Default extends ColumnConstraint {
Expression expression;
Default(String? name, this.expression) : super(name);
Default(super.name, this.expression);
@override
Iterable<AstNode> get childNodes => [expression];
@ -178,7 +177,7 @@ class Default extends ColumnConstraint {
class CollateConstraint extends ColumnConstraint {
final String collation;
CollateConstraint(String? name, this.collation) : super(name);
CollateConstraint(super.name, this.collation);
@override
final Iterable<AstNode> childNodes = const [];
@ -190,7 +189,7 @@ class CollateConstraint extends ColumnConstraint {
class ForeignKeyColumnConstraint extends ColumnConstraint {
ForeignKeyClause clause;
ForeignKeyColumnConstraint(String? name, this.clause) : super(name);
ForeignKeyColumnConstraint(super.name, this.clause);
@override
Iterable<AstNode> get childNodes => [clause];
@ -223,7 +222,7 @@ class MappedBy extends ColumnConstraint {
/// The Dart expression creating the type converter we use to map this token.
final InlineDartToken mapper;
MappedBy(String? name, this.mapper) : super(name);
MappedBy(super.name, this.mapper);
@override
final Iterable<AstNode> childNodes = const [];
@ -243,7 +242,7 @@ class JsonKey extends ColumnConstraint {
String get jsonKey => jsonNameToken.identifier;
JsonKey(String? name, this.jsonNameToken) : super(name);
JsonKey(super.name, this.jsonNameToken);
@override
void transformChildren<A>(Transformer<A> transformer, A arg) {}
@ -259,7 +258,7 @@ class DriftDartName extends ColumnConstraint {
String get dartName => identifier.identifier;
DriftDartName(String? name, this.identifier) : super(name);
DriftDartName(super.name, this.identifier);
@override
void transformChildren<A>(Transformer<A> transformer, A arg) {}

View File

@ -97,9 +97,8 @@ class KeyClause extends TableConstraint {
];
}
KeyClause(String? name,
{required this.isPrimaryKey, required this.columns, this.onConflict})
: super(name);
KeyClause(super.name,
{required this.isPrimaryKey, required this.columns, this.onConflict});
@override
bool constraintEquals(KeyClause other) {
@ -118,7 +117,7 @@ class KeyClause extends TableConstraint {
class CheckTable extends TableConstraint {
Expression expression;
CheckTable(String? name, this.expression) : super(name);
CheckTable(super.name, this.expression);
@override
bool constraintEquals(CheckTable other) => true;
@ -136,9 +135,8 @@ class ForeignKeyTableConstraint extends TableConstraint {
List<Reference> columns;
ForeignKeyClause clause;
ForeignKeyTableConstraint(String? name,
{required this.columns, required this.clause})
: super(name);
ForeignKeyTableConstraint(super.name,
{required this.columns, required this.clause});
@override
bool constraintEquals(ForeignKeyTableConstraint other) => true;

View File

@ -8,7 +8,7 @@ abstract class BaseSelectStatement extends CrudStatement with ResultSet {
@override
List<Column>? resolvedColumns;
BaseSelectStatement._(WithClause? withClause) : super(withClause);
BaseSelectStatement._(super.withClause);
}
/// Marker interface for classes that are a [BaseSelectStatement] but aren't a

View File

@ -114,20 +114,18 @@ class Fts5Table extends Table {
final String? contentRowId;
Fts5Table({
required String name,
required super.name,
required List<TableColumn> columns,
this.contentTable,
this.contentRowId,
CreateVirtualTableStatement? definition,
CreateVirtualTableStatement? super.definition,
}) : super(
name: name,
resolvedColumns: [
if (contentTable != null && contentRowId != null) RowId(),
...columns,
_Fts5RankColumn(),
_Fts5TableColumn(name),
],
definition: definition,
isVirtual: true,
);
}

View File

@ -508,7 +508,7 @@ class IdentifierToken extends Token {
}
abstract class VariableToken extends Token {
VariableToken(TokenType type, FileSpan span) : super(type, span);
VariableToken(super.type, super.span);
}
class QuestionMarkVariableToken extends Token {
@ -559,7 +559,7 @@ class KeywordToken extends Token {
/// Whether this token has been used as an identifier while parsing.
bool isIdentifier = false;
KeywordToken(TokenType type, FileSpan span) : super(type, span);
KeywordToken(super.type, super.span);
bool canConvertToIdentifier() {
// https://stackoverflow.com/a/45775719, but we don't parse indexed yet.

View File

@ -16,7 +16,7 @@ dependencies:
charcode: ^1.2.0
dev_dependencies:
lints: ^2.0.0
lints: ^3.0.0
test: ^1.17.4
path: ^1.8.0
ffi: ^2.0.0