@nolint syntax attribute - #239
Conversation
|
Are attributes supported outside statements yet? You would need to support everything, including expressions, in order for this to be better than a comment. It also feels weird to both repeatedly mention the use case for external tooling and linters and also say:
In which case, custom tooling has to not support this, since they don't want their names being linted. I think that problem clears up with namespacing (e.g. |
this RFC proposes allowing that for an
sorry, i don't think i communicated too well. might need to update the body a bit. i was thinking A) ignore it entirely B) specify all of the lints we care about that was what i meant when i wrote "emit a configurable warning in and of itself"
this seems nicer than what i originally had in mind / mentioned above. it'd probably require changing the p.s., |
|
If we built this system using comments as an extension to How about this: We change the meaning of We also add a new hot comment blah blah
--!nolint A
lint A is disabled here
--!nolint B, C
A, B, and C are disabled here
--!poplint
Only A is disabled here
--!poplint
-- back to default settings |
among many other things. I don't think comments do this job well on their own, or I would've opened with one of the comment-based alternatives I already listed. I'm very much in favor of not relying on mid-file hot comments for developer experience, especially as someone who has been unsatisfied with comment-based silencing in external linters and other languages. Is extending the language a dealbreaker? |
mmm. I don't think so.
|
|
|
||
| ## Alternatives | ||
|
|
||
| - `@lint` / `@[lint { name = true } ]`. This is more coherent with `.config.luau` files. most cases for inline lint |
There was a problem hiding this comment.
Rust uses allow which seems a bit strange if you're reading it in a spec, but when you're reading actual code, #[allow(unused)] reads very clearly.
There was a problem hiding this comment.
i think i'll probably remove the alternative which is highlighted because it makes almost no sense. i'll also add an alternative for allow, but i think @nolint makes more sense in the context of luau because you wouldn't be forced to specify specific lint rules. @[allow("LocalUnused")] or similar would be nice, but @allow call() on its own reads in a way that irks me a bit.
Co-authored-by: Andy Friesen <andy.friesen@gmail.com>
rendered