reactter_lint 1.0.0 copy "reactter_lint: ^1.0.0" to clipboard
reactter_lint: ^1.0.0 copied to clipboard

Reactter_lint is an analytics tool for Reactter that helps developers to encourage good coding practices and preventing frequent problems.

Reactter


Pub Publisher Reactter Lint Pub points MIT License

Reactter_lint is an analytics tool for Reactter that helps developers to encourage good coding practices and preventing frequent problems using the conventions Reactter.

Contents #

Quickstart #

Run this command in your root project:

dart pub add -d reactter_lint custom_lint
copied to clipboard

And then include these lines of code into analysis_options.yaml:

analyzer:
  plugins:
    - custom_lint
copied to clipboard

Then you can see suggestions in your IDE or you can run checks manually:

dart run custom_lint
copied to clipboard

Lints #

hook_late_convention #

The hook late must be attached an instance.

Bad

Cause: ReactterHook cannot be late without attaching an instance.

class AppController {
  final otherState = UseState(0);
  late final stateLate = UseState(otherState.value);
  ...
}
copied to clipboard

Good

Fix: Use Reactter.lazyState for attaching an instance.

class AppController {
  final otherState = UseState(0);
  late final stateLate = Reactter.lazyState(
    () => UseState(otherState.value),
    this,
  );
  ...
}
copied to clipboard

hook_name_convention #

The hook name should be prefixed with use.

Bad

Cause: The hook name is not prefixed with use.

class MyHook extends ReactterHook {
  ...
}
copied to clipboard

Good

Fix: Name hook using use preffix.

class UseMyHook extends ReactterHook {
  ...
}
copied to clipboard

invalid_hook_position #

The hook must be defined after the hook register.

Bad

Cause: The hook cannot be defined before the hook register.

class UseMyHook extends ReactterHook {
  final stateHook = UseState(0);
  final $ = ReactterHook.$register;
  ...
}
copied to clipboard

Good

Fix: Define it after the hook register.

class UseMyHook extends ReactterHook {
  final $ = ReactterHook.$register;
  final stateHook = UseState(0);
  ...
}
copied to clipboard

invalid_hook_register #

The hook register('$' field) must be final only.

Bad

Cause: The hook register cannot be defined using getter.

class MyHook extends ReactterHook {
  get $ => ReactterHook.$register;
  ...
}
copied to clipboard

Cause: The hook register cannot be defined using setter.

class UseMyHook extends ReactterHook {
  set $(_) => ReactterHook.$register;
  ...
}
copied to clipboard

Cause: The hook register cannot be defined using var keyword.

class UseMyHook extends ReactterHook {
  var $ = ReactterHook.$register;
  ...
}
copied to clipboard

Cause: The hook register cannot be defined using a type.

class UseMyHook extends ReactterHook {
  Object $ = ReactterHook.$register;
  ...
}
copied to clipboard

Good

Fix: Define it using final keyword.

class UseMyHook extends ReactterHook {
  final $ = ReactterHook.$register;
  ...
}
copied to clipboard
3
likes
140
points
83
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.10 - 2025.03.25

Reactter_lint is an analytics tool for Reactter that helps developers to encourage good coding practices and preventing frequent problems.

Homepage
Repository (GitHub)

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

analyzer, analyzer_plugin, custom_lint_builder

More

Packages that depend on reactter_lint