This limitation poses a problem for Prettier and similar tools which autoformat code and comments based on line length and other criteria. For instance, Prettier will automatically re-format the above code like this:
This approach is compatible with Prettier and follows a convention used by other tools including TypeScript (// ts-ignore) and ESLint. It is resilient to future formatting changes. In my opinion, it is also more readable. :)
Describe alternatives you've considered
Sometimes code can be re-written to make Prettier happy:
Is your feature request related to a problem? Please describe.
eng-disable
comments must be placed on the same line as the relevant code, e.g.:This limitation poses a problem for Prettier and similar tools which autoformat code and comments based on line length and other criteria. For instance, Prettier will automatically re-format the above code like this:
Describe the solution you'd like
The ability to put the comment above the relevant line:
This approach is compatible with Prettier and follows a convention used by other tools including TypeScript (
// ts-ignore
) and ESLint. It is resilient to future formatting changes. In my opinion, it is also more readable. :)Describe alternatives you've considered
Sometimes code can be re-written to make Prettier happy:
But this is not always desirable or guaranteed to work due to line length restrictions.