deno_lint icon indicating copy to clipboard operation
deno_lint copied to clipboard

Feature Request: Syntax for ignore-directives should allow for an explanation

Open binyamin opened this issue 3 years ago • 1 comments

Summary

When a programmer bypasses a configured linting rule, they should be able to document why they made an exception. This can improve code clarity, and should encourage future programmers only to ignore a rule when there's a clear reason for doing so.

Syntax

It could use a dash preceded by a space:

// deno-lint-ignore no-explicit-any - We don't want to restrict the value's type
type Dict = Record<string, any>;

Two dashes might be clearer, and easier to distinguish from rules when parsing.

// deno-lint-ignore no-explicit-any -- We don't want to restrict the value's type
type Dict = Record<string, any>;

binyamin avatar Sep 04 '22 18:09 binyamin

Makes sense, PRs are welcome!

bartlomieju avatar Sep 04 '22 19:09 bartlomieju

Hi, I am trying to do this one

And If i lucky can close the ticket. I think the document should be updated somewhere as well

chengr4 avatar Jan 18 '24 15:01 chengr4

@bartlomieju I think I only need to update Linter section in deno-docs. Does there any other place need updating?

BTW, maybe this issue can be closed

chengr4 avatar Jan 24 '24 00:01 chengr4

Thanks for pointing this out @chengr4. I think we should update https://github.com/denoland/deno_lint/blob/00c9025907ac0846ae2a85067219ebc428b7ac54/www/static/ignoring-rules.md?plain=1#L4 too.

bartlomieju avatar Jan 24 '24 00:01 bartlomieju

If we do not have any other issues, this issue can be closed.

chengr4 avatar Jan 28 '24 23:01 chengr4

Thanks for implementing this @chengr4!

bartlomieju avatar Jan 29 '24 00:01 bartlomieju