Skip to content

Commit 3bf0689

Browse files
committed
docs: modify some docs
1 parent 6eb5172 commit 3bf0689

File tree

1 file changed

+6
-55
lines changed

1 file changed

+6
-55
lines changed

crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_function.rs

Lines changed: 6 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -16,80 +16,31 @@ use std::num::NonZeroU8;
1616
declare_lint_rule! {
1717
/// Restrict the number of lines of code in a function.
1818
///
19-
/// This rule checks the number of lines in a function body and reports a diagnostic if it exceeds a specified limit.
19+
/// This rule checks the number of lines in a function body and reports a diagnostic if it exceeds a specified limit. Remember that this rule only counts the lines of code in the function body, not the entire function declaration.
2020
/// Some people consider large functions a code smell. Large functions tend to do a lot of things and can make it hard following what’s going on. Many coding style guides dictate a limit of the number of lines that a function can comprise of. This rule can help enforce that style.
2121
///
2222
/// ## Examples
2323
///
24-
/// When maximum number of lines is set to `2` with the following option, the following code will be considered invalid:
25-
/// ```json,options
26-
/// {
27-
/// "options": {
28-
/// "maxLines": 2
29-
/// }
30-
/// }
31-
/// ```
32-
///
3324
/// ### Invalid
3425
///
35-
/// ```js,expect_diagnostic,use_options
36-
/// function foo () {
37-
/// const x = 0;
38-
/// const y = 1;
39-
/// const z = 2;
40-
/// };
41-
/// ```
26+
/// The following example will show diagnostic when you set the maxLines limit to 3, however the default value is 50.
4227
///
43-
/// ```js,expect_diagnostic,use_options
44-
/// const bar = () => {
28+
/// ```js
29+
/// function foo () {
4530
/// const x = 0;
4631
/// const y = 1;
4732
/// const z = 2;
33+
/// return x + y + z;
4834
/// };
4935
/// ```
5036
///
51-
/// ```js,expect_diagnostic,use_options
52-
/// class Baz {
53-
/// foo() {
54-
/// const x = 0;
55-
/// const y = 0;
56-
/// const z = 2;
57-
/// };
58-
/// };
59-
/// ```
60-
///
61-
/// ```js,expect_diagnostic,use_options
62-
/// (() => {
63-
/// const x = 0;
64-
/// const y = 0;
65-
/// const z = 0;
66-
/// })();
67-
/// ```
68-
///
6937
/// ### Valid
7038
///
71-
/// ```js,use_options
39+
/// ```js
7240
/// function foo () {
7341
/// const x = 0;
7442
/// const y = 1;
7543
/// };
76-
///
77-
/// const bar = () => {
78-
/// const x = 0;
79-
/// const y = 1;
80-
/// };
81-
///
82-
/// class Baz {
83-
/// foo() {
84-
/// const x = 0;
85-
/// const y = 0;
86-
/// };
87-
/// };
88-
///
89-
/// (() => {
90-
/// const x = 0;
91-
/// const y = 0;
92-
/// })();
9344
/// ```
9445
///
9546
/// ## Options

0 commit comments

Comments
 (0)