reactpy-flake8
A Flake8 plugin that enforces the "rules of hooks" for ReactPy.
The implementation is based on React's own ESLint plugin for hooks.
Install
pip install reactpy-flake8
Developer Installation
pip install -r requirements.txt
pip install -e .
Run the tests
nox -s test
Errors
| Code | Message |
|---|---|
| REACTPY100 | Hook is defined as a closure |
| REACTPY101 | Hook was used outside component or hook definition |
| REACTPY102 | Hook was used inside a conditional or loop statement |
| REACTPY103 | Hook was used after an early return |
| REACTPY200 | A hook's dependency is not destructured - dependencies should be refered to directly, not via an attribute or key of an object |
| REACTPY201 | Hook dependency args should be a literal list, tuple or None |
| REACTPY202 | Hook dependency is not specified |
Options
All options my be used as CLI flags where _ characters are replaced with -. For
example, exhaustive_hook_deps would become --exhaustive-hook-deps.
| Option | Type | Default | Description |
|---|---|---|---|
exhaustive_hook_deps |
Boolean | False |
Enable REACTPY2** errors (recommended) |
component_decorator_pattern |
Regex | ^(component|[\w\.]+\.component)$ |
The pattern which should match the component decorators. Useful if
you import the @component decorator under an alias.
|
hook_function_pattern |
Regex | ^_*use_\w+$ |
The pattern which should match the name of hook functions. Best used if you
have existing functions with use_* names that are not hooks.
|
Metadata
Release files for reactpy-flake8 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| reactpy_flake8-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for reactpy_flake8-0.7.0-py3-none-any.whl |
Release files / reactpy_flake8-0.7.0-py3-none-any.whl
| Download URL | reactpy_flake8-0.7.0-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cddd7f768577f5c4d9758b930fc7ed06c2fb512a7b9c49c3613db9da8977121b
|
|
BLAKE2b-256 checksum How to use checksums |
09b8426598b4d7ed5b38aba93ef54d94816f5043647f94f1f340280b8b268c85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Security for reactpy-flake8 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.