Skip to main content

padding-line-between-statements

danger
This rule will soon be moved to eslint-stylistic. See What About Formatting? for more information.

Require or disallow padding lines between statements.

🔧

Some problems reported by this rule are automatically fixable by the --fix ESLint command line option.

This rule extends the base eslint/padding-line-between-statements rule. It adds support for TypeScript constructs such as interface and type.

How to Use

.eslintrc.cjs
module.exports = {
"rules": {
// Note: you must disable the base rule as it can report incorrect errors
"padding-line-between-statements": "off",
"@typescript-eslint/padding-line-between-statements": "error"
}
};
Try this rule in the playground ↗

Options

See eslint/padding-line-between-statements options.

In addition to options provided by ESLint, interface and type can be used as statement types.

For example, to add blank lines before interfaces and type definitions:

{
// Example - Add blank lines before interface and type definitions.
"padding-line-between-statements": "off",
"@typescript-eslint/padding-line-between-statements": [
"error",
{
"blankLine": "always",
"prev": "*",
"next": ["interface", "type"]
}
]
}

Note: ESLint cjs-export and cjs-import statement types are renamed to exports and require respectively.

Resources

Taken with ❤️ from ESLint core