noExcessiveLinesPerFile
Summary
Section titled “Summary”- Rule available since:
v2.3.12 - Diagnostic Category:
lint/style/noExcessiveLinesPerFile - This rule isn’t recommended, so you need to enable it.
- This rule doesn’t have a fix.
- The default severity of this rule is information.
How to configure
Section titled “How to configure”{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": "error" } } }}Description
Section titled “Description”Restrict the number of lines in a file.
Large files tend to do many things and can make it hard to follow what’s going on. This rule can help enforce a limit on the number of lines in a file.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”The following example will show a diagnostic when maxLines is set to 2:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 2 } } } } }}.a { color: red; }.b { color: blue; }.c { color: green; }code-block.css:1:1 lint/style/noExcessiveLinesPerFile ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ This file has too many lines (3). Maximum allowed is 2.
> 1 │ .a { color: red; }
│ ^^^^^^^^^^^^^^^^^^
> 2 │ .b { color: blue; }
> 3 │ .c { color: green; }
│ ^^^^^^^^^^^^^^^^^^^^
4 │
ℹ Consider splitting this file into smaller files.
.a { color: red; }.b { color: blue; }Options
Section titled “Options”maxLines
Section titled “maxLines”This option sets the maximum number of lines allowed in a file. If the file exceeds this limit, a diagnostic will be reported.
Default: 300
Examples
Section titled “Examples”The default value for maxLines is 300. The following example shows how to set the
maxLines option to a smaller value. It reports a diagnostic because the file has more
than 4 lines:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 4 } } } } }}.a { color: red; }.b { color: blue; }.c { color: green; }.d { color: yellow; }.e { color: purple; }code-block.css:1:1 lint/style/noExcessiveLinesPerFile ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ This file has too many lines (5). Maximum allowed is 4.
> 1 │ .a { color: red; }
│ ^^^^^^^^^^^^^^^^^^
> 2 │ .b { color: blue; }
> 3 │ .c { color: green; }
> 4 │ .d { color: yellow; }
> 5 │ .e { color: purple; }
│ ^^^^^^^^^^^^^^^^^^^^^
6 │
ℹ Consider splitting this file into smaller files.
skipBlankLines
Section titled “skipBlankLines”When this option is set to true, blank lines are not counted towards the maximum line limit.
Default: false
Examples
Section titled “Examples”The following example shows how skipBlankLines can prevent a diagnostic by excluding blank
lines from the total count:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 2, "skipBlankLines": true } } } } }}.a { color: red; }
.b { color: blue; }Suppressions
Section titled “Suppressions”If you need to exceed the line limit in a specific file, you can suppress this rule at the top of the file:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 2 } } } } }}/* biome-ignore-all lint/style/noExcessiveLinesPerFile: generated file */.a { color: red; }.b { color: blue; }.c { color: green; }Related links
Section titled “Related links”Summary
Section titled “Summary”- Rule available since:
v2.3.12 - Diagnostic Category:
lint/style/noExcessiveLinesPerFile - This rule isn’t recommended, so you need to enable it.
- This rule doesn’t have a fix.
- The default severity of this rule is information.
How to configure
Section titled “How to configure”{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": "error" } } }}Description
Section titled “Description”Restrict the number of lines in a file.
Large files tend to do many things and can make it hard to follow what’s going on. This rule can help enforce a limit on the number of lines in a file.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”The following example will show a diagnostic when maxLines is set to 2:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 2 } } } } }}query Foo { id }query Bar { id }query Baz { id }query Foo { id }query Bar { id }Options
Section titled “Options”maxLines
Section titled “maxLines”This option sets the maximum number of lines allowed in a file. If the file exceeds this limit, a diagnostic will be reported.
Default: 300
Examples
Section titled “Examples”The default value for maxLines is 300. The following example shows how to set the
maxLines option to a smaller value. It reports a diagnostic because the file has more
than 4 lines:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 4 } } } } }}query Foo { id }query Bar { id }query Baz { id }query Qux { id }query Quux { id }skipBlankLines
Section titled “skipBlankLines”When this option is set to true, blank lines are not counted towards the maximum line limit.
Default: false
Examples
Section titled “Examples”The following example shows how skipBlankLines can prevent a diagnostic by excluding blank
lines from the total count:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 2, "skipBlankLines": true } } } } }}query Foo { id }
query Bar { id }Suppressions
Section titled “Suppressions”If you need to exceed the line limit in a specific file, you can suppress this rule at the top of the file:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 2 } } } } }}query Foo { id }query Bar { id }query Baz { id }Related links
Section titled “Related links”Summary
Section titled “Summary”- Rule available since:
v2.3.12 - Diagnostic Category:
lint/style/noExcessiveLinesPerFile - This rule isn’t recommended, so you need to enable it.
- This rule doesn’t have a fix.
- The default severity of this rule is information.
- Sources:
- Inspired from
max-lines
- Inspired from
How to configure
Section titled “How to configure”{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": "error" } } }}Description
Section titled “Description”Restrict the number of lines in a file.
Large files tend to do many things and can make it hard to follow what’s going on. This rule can help enforce a limit on the number of lines in a file.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”The following example will show a diagnostic when maxLines is set to 2:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 2 } } } } }}const a = 1;const b = 2;const c = 3;code-block.js:1:1 lint/style/noExcessiveLinesPerFile ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ This file has too many lines (3). Maximum allowed is 2.
> 1 │ const a = 1;
│ ^^^^^^^^^^^^
> 2 │ const b = 2;
> 3 │ const c = 3;
│ ^^^^^^^^^^^^
4 │
ℹ Consider splitting this file into smaller files.
const a = 1;const b = 2;Options
Section titled “Options”maxLines
Section titled “maxLines”This option sets the maximum number of lines allowed in a file. If the file exceeds this limit, a diagnostic will be reported.
Default: 300
Examples
Section titled “Examples”The default value for maxLines is 300. The following example shows how to set the
maxLines option to a smaller value. It reports a diagnostic because the file has more
than 4 lines:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 4 } } } } }}const a = 1;const b = 2;const c = 3;const d = 4;const e = 5;code-block.js:1:1 lint/style/noExcessiveLinesPerFile ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ This file has too many lines (5). Maximum allowed is 4.
> 1 │ const a = 1;
│ ^^^^^^^^^^^^
> 2 │ const b = 2;
> 3 │ const c = 3;
> 4 │ const d = 4;
> 5 │ const e = 5;
│ ^^^^^^^^^^^^
6 │
ℹ Consider splitting this file into smaller files.
skipBlankLines
Section titled “skipBlankLines”When this option is set to true, blank lines are not counted towards the maximum line limit.
Default: false
Examples
Section titled “Examples”The following example shows how skipBlankLines can prevent a diagnostic by excluding blank
lines from the total count:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 2, "skipBlankLines": true } } } } }}const a = 1;
const b = 2;Suppressions
Section titled “Suppressions”If you need to exceed the line limit in a specific file, you can suppress this rule at the top of the file:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 2 } } } } }}// biome-ignore-all lint/style/noExcessiveLinesPerFile: generated fileconst a = 1;const b = 2;const c = 3;Related links
Section titled “Related links”Summary
Section titled “Summary”- Rule available since:
v2.5.0 - Diagnostic Category:
lint/style/noExcessiveLinesPerFile - This rule isn’t recommended, so you need to enable it.
- This rule doesn’t have a fix.
- The default severity of this rule is information.
How to configure
Section titled “How to configure”{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": "error" } } }}Description
Section titled “Description”Restrict the number of lines in a file.
Large files tend to do many things and can make it hard to follow what’s going on. This rule can help enforce a limit on the number of lines in a file.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”The following example will show a diagnostic when maxLines is set to 2:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 2 } } } } }}<div></div><span></span><p></p><div></div><span></span>Options
Section titled “Options”maxLines
Section titled “maxLines”This option sets the maximum number of lines allowed in a file. If the file exceeds this limit, a diagnostic will be reported.
Default: 300
Examples
Section titled “Examples”The default value for maxLines is 300. The following example shows how to set the
maxLines option to a smaller value. It reports a diagnostic because the file has more
than 4 lines:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 4 } } } } }}<div>Line 1</div><div>Line 2</div><div>Line 3</div><div>Line 4</div><div>Line 5</div>skipBlankLines
Section titled “skipBlankLines”When this option is set to true, blank lines are not counted towards the maximum line limit.
Default: false
Examples
Section titled “Examples”The following example shows how skipBlankLines can prevent a diagnostic by excluding blank
lines from the total count:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 2, "skipBlankLines": true } } } } }}<div></div>
<span></span>Suppressions
Section titled “Suppressions”If you need to exceed the line limit in a specific file, you can suppress this rule at the top of the file:
{ "linter": { "rules": { "style": { "noExcessiveLinesPerFile": { "options": { "maxLines": 2 } } } } }}<!-- biome-ignore-all lint/style/noExcessiveLinesPerFile: generated file --><div></div><span></span><p></p>Related links
Section titled “Related links”Summary
Section titled “Summary”- Diagnostic Category:
lint/nursery/noExcessiveLinesPerFile - This rule doesn’t have a fix.
- The default severity of this rule is information.
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noExcessiveLinesPerFile": "error" } } }}Description
Section titled “Description”Restrict the number of lines in a file.
Large files tend to do many things and can make it hard to follow what’s going on. This rule can help enforce a limit on the number of lines in a file.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”The following example will show a diagnostic when maxLines is set to 2:
{ "linter": { "rules": { "nursery": { "noExcessiveLinesPerFile": { "options": { "maxLines": 2 } } } } }}<div></div><span></span><p></p><div></div><span></span>Options
Section titled “Options”maxLines
Section titled “maxLines”This option sets the maximum number of lines allowed in a file. If the file exceeds this limit, a diagnostic will be reported.
Default: 300
Examples
Section titled “Examples”The default value for maxLines is 300. The following example shows how to set the
maxLines option to a smaller value. It reports a diagnostic because the file has more
than 4 lines:
{ "linter": { "rules": { "nursery": { "noExcessiveLinesPerFile": { "options": { "maxLines": 4 } } } } }}<div>Line 1</div><div>Line 2</div><div>Line 3</div><div>Line 4</div><div>Line 5</div>skipBlankLines
Section titled “skipBlankLines”When this option is set to true, blank lines are not counted towards the maximum line limit.
Default: false
Examples
Section titled “Examples”The following example shows how skipBlankLines can prevent a diagnostic by excluding blank
lines from the total count:
{ "linter": { "rules": { "nursery": { "noExcessiveLinesPerFile": { "options": { "maxLines": 2, "skipBlankLines": true } } } } }}<div></div>
<span></span>Suppressions
Section titled “Suppressions”If you need to exceed the line limit in a specific file, you can suppress this rule at the top of the file:
{ "linter": { "rules": { "nursery": { "noExcessiveLinesPerFile": { "options": { "maxLines": 2 } } } } }}<!-- biome-ignore lint/nursery/noExcessiveLinesPerFile: generated file --><div></div><span></span><p></p>Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.