Disable the no-inline-comment
rule
#221
Replies: 3 comments
-
I personally don't use inline comments because I think it's easier to read code when comments are on a new line. Variable names should probably be improved if an inline comment is necessary. I don't really have an opinion about having this rule enabled or not 😅. |
Beta Was this translation helpful? Give feedback.
-
I've seen this used on two occasions in our current project. First is when you have short lists or objects, that have short comments after them. export type ApiService =
| 'bucket' // For static files
| 'content' // Main content
| 'identity' // To get app token
| 'notification' // To listen to SSE events
| 'search' // ElasticSearch API
| 'user'; // Technically identity API, but specific for user endpoints that cannot be cached Or when using ternary conditions
Personally I run into this rule more often than I like, especially in the first case mentioned above (also when defining objects, or passing function params), but mostly when writing some demo code (which admittedly is not in a normal project context). The problem that might arise when disabling it though, is that people that don't do it "correct" automatically (knowing when better to use or avoid inline comments), will get PR feedback or other people changing their comments later to "improve" it, which is a waste of effort. So I don't feel strongly about either option, just a slight personal preference for myself. |
Beta Was this translation helpful? Give feedback.
-
My personal opinion here as well. The examples above are good. |
Beta Was this translation helpful? Give feedback.
-
There is a proposal to disable the
no-inline-comments
rule.Pleas see the documentation
Beta Was this translation helpful? Give feedback.
All reactions