Skip to content

Commit 700c0a1

Browse files
authored
feat: add new warnings(max-params, max-nested-callbacks) (#37)
1 parent f02fb84 commit 700c0a1

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

lib/base.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ module.exports = {
208208
"linebreak-style": "warn",
209209
"max-depth": "warn",
210210
"max-len": ["warn", 150],
211+
"max-nested-callbacks": ["warn", 5],
212+
"max-params": ["warn", 7],
211213
"max-statements": ["warn", 40],
212214
"new-cap": "warn",
213215
"no-array-constructor": "warn",
@@ -331,7 +333,6 @@ module.exports = {
331333
// lines-between-class-members
332334
// max-lines
333335
// max-lines-per-function
334-
// max-nested-callbacks
335336
// max-params
336337
// max-statements-per-line
337338
// multiline-comment-style

test/base-test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ describe("base", () => {
2020
warnings: [
2121
"import/no-duplicates",
2222
"import/no-duplicates",
23-
"array-callback-return"
23+
"array-callback-return",
24+
"max-params",
25+
"max-nested-callbacks"
2426
]
2527
},
2628
"ok.js": {}

test/fixtures/base/warning.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,18 @@ alert(a + b);
55

66
[].map((v) => {
77
alert(v);
8+
});
9+
10+
function foo(c, d, e, f, g, h, i, j) {}
11+
12+
foo(() => {
13+
foo(() => {
14+
foo(() => {
15+
foo(() => {
16+
foo(() => {
17+
foo(() => {});
18+
});
19+
});
20+
});
21+
});
822
});

0 commit comments

Comments
 (0)