rexios_lints 9.0.0 copy "rexios_lints: ^9.0.0" to clipboard
rexios_lints: ^9.0.0 copied to clipboard

A collection of the linting rules I use for Flutter/Dart projects and packages

example/example.dart

// ignore_for_file: document_ignores

import 'dart:async';
import 'dart:io';

// ignore: prefer_single_quotes
const string = "";

Future<void> future() async {}

void unawaitedFutures() async {
  // ignore: unawaited_futures
  future();
  await future();
  unawaited(future());
}

void discardedFutures() {
  // ignore: discarded_futures
  future();
  unawaited(future());
}

void requireTrailingCommas(
    int param1,
    int param2,
    int param3,
    int param4,
    // ignore: require_trailing_commas
    int param5) {}

class UseSuperParametersBase {
  final int param;

  UseSuperParametersBase(this.param);
}

class UseSuperParameters extends UseSuperParametersBase {
  // ignore: use_super_parameters
  UseSuperParameters(int param) : super(param);
}

void preferFinal() {
  // ignore: prefer_final_in_for_each
  for (var i in []) {
    print(i);
  }

  // ignore: prefer_final_locals
  var i = 0;
  print(i);
}

void preferAsyncAwait() async {
  // expect_lint: prefer_async_await
  await Future.value().then((_) {});
}

void preferTimestamps() {
  // expect_lint: prefer_timestamps
  DateTime.now();
  DateTime.timestamp();
}

void doNotUseRawPaths() {
  // expect_lint: do_not_use_raw_paths
  Directory('path/to/directory');
  // expect_lint: do_not_use_raw_paths
  File('path/to/file');
  // expect_lint: do_not_use_raw_paths
  Link('path/to/entity');

  // expect_lint: do_not_use_raw_paths
  Directory('path\\to\\directory');
  File('file.txt');
}
4
likes
0
points
1.24k
downloads

Publisher

verified publisherrexios.dev

Weekly Downloads

A collection of the linting rules I use for Flutter/Dart projects and packages

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, analyzer_plugin, custom_lint, custom_lint_builder, flutter_lints, lints

More

Packages that depend on rexios_lints