Skip to main content


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

Require or disallow padding lines between statements.


此规则报告的一些问题可通过 --fix ESLint 命令行选项自动修复

此规则扩展了基本 eslint/padding-line-between-statements 规则。 它增加了对 TypeScript 构造(例如 interfacetype)的支持。

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


除了 ESLint 提供的选项外,还可以使用 interfacetype 作为语句类型。

英: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": [
"blankLine": "always",
"prev": "*",
"next": ["interface", "type"]

注意: ESLint cjs-exportcjs-import 语句类型分别重命名为 exportsrequire

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


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"
在线运行试试这个规则 ↗


参见 eslint/padding-line-between-statements 选项


摘自 ❤️ ESLint 内核