lines-around-comment
danger
We strongly recommend you do not use this rule or any other formatting linter rules. Use a separate dedicated formatter instead. See What About Formatting? for more information.
Require empty lines around comments.
🔧
Some problems reported by this rule are automatically fixable by the --fix ESLint command line option.
Rule Details
This rule extends the base eslint/lines-around-comment rule.
It adds support for TypeScript syntax.
See the ESLint documentation for more details on the lines-around-comment rule.
How to Use
.eslintrc.cjs
module.exports = {
  "rules": {
    // Note: you must disable the base rule as it can report incorrect errors
    "lines-around-comment": "off",
    "@typescript-eslint/lines-around-comment": "error"
  }
};
Options
See eslint/lines-around-comment options.
In addition to the options supported by the lines-around-comment rule in ESLint core, the rule adds the following options:
- allowEnumEnd: truedoesn't require a blank line after an enum body block end
- allowEnumStart: truedoesn't require a blank line before an enum body block start
- allowInterfaceEnd: truedoesn't require a blank line before an interface body block end
- allowInterfaceStart: truedoesn't require a blank line after an interface body block start
- allowModuleEnd: truedoesn't require a blank line before a module body block end
- allowModuleStart: truedoesn't require a blank line after a module body block start
- allowTypeEnd: truedoesn't require a blank line before a type literal block end
- allowTypeStart: truedoesn't require a blank line after a type literal block start
Resources
Taken with ❤️ from ESLint core