-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(Docs): Add lint ignore conversion guide (#969)
A user requested a comparison of ignore capabilities and styles for some of our top python linters. For now, I've added repo docs on this for: - ruff - mypy - markdownlint - eslint
- Loading branch information
1 parent
a08ca29
commit 868bdc1
Showing
6 changed files
with
295 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# markdownlint | ||
|
||
## Ignores | ||
|
||
Here is a conversion guide for | ||
[markdownlint-style ignores](https://github.com/DavidAnson/markdownlint/blob/main/README.md#configuration) | ||
and [trunk-ignores](https://docs.trunk.io/code-quality/linters/ignoring-issues-and-files): | ||
|
||
### Same Line | ||
|
||
```markdown | ||
# (name)[link] <!-- trunk-ignore(markdownlint) --> | ||
|
||
# (name)[link] <!-- markdownlint-disable-line --> | ||
``` | ||
|
||
### Next Line | ||
|
||
```markdown | ||
<!-- trunk-ignore(markdownlint) --> | ||
|
||
# (name)[link] | ||
|
||
<!-- markdownlint-disable-next-line --> | ||
|
||
# (name)[link] | ||
``` | ||
|
||
### Specific Issue | ||
|
||
```markdown | ||
<!-- trunk-ignore(markdownlint/MD011) --> | ||
|
||
# (name)[link] | ||
|
||
<!-- markdownlint-disable-next-line MD011 --> | ||
|
||
# (name)[link] | ||
``` | ||
|
||
### Multiple Issues | ||
|
||
```markdown | ||
<!-- trunk-ignore(markdownlint/MD001,markdownlint/MD011) --> | ||
|
||
# (name)[link] | ||
|
||
<!-- markdownlint-disable-next-line MD001 MD011 --> | ||
|
||
# (name)[link] | ||
``` | ||
|
||
### Blocks | ||
|
||
```markdown | ||
<!-- trunk-ignore-begin(markdownlint/MD011) --> | ||
|
||
# (name)[link] | ||
|
||
<!-- trunk-ignore-end(markdownlint/MD011) --> | ||
|
||
<!-- markdownlint-disable MD011 --> | ||
|
||
# (name)[link] | ||
|
||
<!-- markdownlint-enable MD011 --> | ||
``` | ||
|
||
### Whole File | ||
|
||
```markdown | ||
<!-- trunk-ignore-all(markdownlint/MD011) --> | ||
|
||
# (name)[link] | ||
|
||
<!-- markdownlint-disable MD011 --> | ||
|
||
# (name)[link] | ||
``` | ||
|
||
### Notes | ||
|
||
Specific rules and multi-file ignores can be specified in a | ||
[markdownlint config file](https://github.com/DavidAnson/markdownlint#optionsconfig). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# mypy | ||
|
||
## Ignores | ||
|
||
Here is a conversion guide for | ||
[mypy-style ignores](https://mypy.readthedocs.io/en/stable/common_issues.html#spurious-errors-and-locally-silencing-the-checker) | ||
and [trunk-ignores](https://docs.trunk.io/code-quality/linters/ignoring-issues-and-files): | ||
|
||
### Same Line | ||
|
||
```python | ||
x: str = 1 # trunk-ignore(mypy) | ||
|
||
x: str = 1 # type: ignore | ||
``` | ||
|
||
### Next Line | ||
|
||
```python | ||
# trunk-ignore(mypy) | ||
x: str = 1 | ||
|
||
# Unsupported in mypy | ||
x: str = 1 | ||
``` | ||
|
||
### Specific Issue | ||
|
||
```python | ||
x: str = 1 # trunk-ignore(mypy/assignment) | ||
|
||
x: str = 1 # type: ignore[assignment] | ||
``` | ||
|
||
### Multiple Issues | ||
|
||
```python | ||
x: str = 1 # trunk-ignore(mypy/assignment,mypy/note) | ||
|
||
x: str = 1 # type: ignore[assignment, note] | ||
``` | ||
|
||
### Blocks | ||
|
||
```python | ||
# trunk-ignore-begin(mypy/assigment) | ||
x: str = 1 | ||
# trunk-ignore-end(mypy/assigment) | ||
|
||
# Unsupported in mypy | ||
x: str = 1 | ||
``` | ||
|
||
### Whole File | ||
|
||
```python | ||
# trunk-ignore-all(mypy/assigment) | ||
x: str = 1 | ||
|
||
# mypy: disable-error-code="assignment" | ||
x: str = 1 | ||
``` | ||
|
||
### Notes | ||
|
||
The applied linter rules can be specified in a | ||
[mypy config file](https://mypy.readthedocs.io/en/stable/config_file.html#example-mypy-ini). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# ruff | ||
|
||
## Ignores | ||
|
||
Here is a conversion guide for | ||
[ruff-style ignores](https://docs.astral.sh/ruff/linter/#disabling-fixes) and | ||
[trunk-ignores](https://docs.trunk.io/code-quality/linters/ignoring-issues-and-files): | ||
|
||
### Same Line | ||
|
||
```python | ||
x = 1 # trunk-ignore(ruff) | ||
|
||
x = 1 # noqa | ||
``` | ||
|
||
### Next Line | ||
|
||
```python | ||
# trunk-ignore(ruff) | ||
x = 1 | ||
|
||
# Unsupported in ruff | ||
x = 1 | ||
``` | ||
|
||
### Specific Issue | ||
|
||
```python | ||
x = 1 # trunk-ignore(ruff/F841) | ||
|
||
x = 1 # noqa: F841 | ||
``` | ||
|
||
### Multiple Issues | ||
|
||
```python | ||
x = 1 # trunk-ignore(ruff/E741,ruff/F841) | ||
|
||
x = 1 # noqa: E741, F841 | ||
``` | ||
|
||
### Blocks | ||
|
||
```python | ||
# trunk-ignore-begin(ruff/F841) | ||
x = 1 | ||
# trunk-ignore-end(ruff/F841) | ||
|
||
# Unsupported in ruff | ||
x = 1 | ||
``` | ||
|
||
### Whole File | ||
|
||
```python | ||
# trunk-ignore-all(ruff/F841) | ||
x = 1 | ||
|
||
# ruff: noqa: F841 | ||
x = 1 | ||
``` | ||
|
||
### Notes | ||
|
||
You can also configure which rules to use and which files to apply them to using | ||
[ruff config files](https://docs.astral.sh/ruff/settings/#lint_per-file-ignores). |