Appearance
Disallows comments on the same line as code.
Comments placed at the end of a line of code can make code harder to read. They can easily be missed when scanning vertically, and they make lines longer. Moving comments to their own lines makes them more prominent and reduces line length.
Examples of incorrect code for this rule:
var a = 1; // inline comment var b = 2; /* another inline comment */
Examples of correct code for this rule:
// comment on its own line var a = 1; /* block comment on its own line */ var b = 2;
This rule accepts a configuration object with the following properties:
type: string | null
string | null
A regex pattern to ignore certain inline comments.
Comments matching this pattern will not be reported.
Example configuration:
{ "no-inline-comments": ["error", { "ignorePattern": "webpackChunkName" }] }
To enable this rule using the config file or in the CLI, you can use:
{ "rules": { "no-inline-comments": "error" } }
oxlint --deny no-inline-comments
eslint/no-inline-comments Pedantic
What it does
Disallows comments on the same line as code.
Why is this bad?
Comments placed at the end of a line of code can make code harder to read. They can easily be missed when scanning vertically, and they make lines longer. Moving comments to their own lines makes them more prominent and reduces line length.
Examples
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Configuration
This rule accepts a configuration object with the following properties:
ignorePattern
type:
string | nullA regex pattern to ignore certain inline comments.
Comments matching this pattern will not be reported.
Example configuration:
How to use
To enable this rule using the config file or in the CLI, you can use:
References