Skip to content

Commit 8c3acd2

Browse files
authored
Merge pull request #11 from htmlacademy/feature/check-unused-params
Unused function args validation
2 parents 4075db5 + 6ca782e commit 8c3acd2

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

es5.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ module.exports = {
8484
// Variables
8585
// http://eslint.org/docs/rules/#variables
8686
// ---------------------------------------
87-
'no-unused-vars': ['error', {args: 'none'}], // eslint:recommended
87+
'no-unused-vars': ['error', {args: 'all', argsIgnorePattern: '^_'}], // check that all args are used¬
8888
'no-delete-var': 'error', // eslint:recommended
8989
'no-label-var': 'error',
9090
'no-shadow': 'error',

test/es5/space-in-parens.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
'use strict';
22

33
var fun = function (variable) {
4-
4+
return variable;
55
};
66

7-
fun(function () {});
7+
fun(function () {
8+
});
89

910
fun(4, (4 + 5), 7);
1011

test/es5/unused-params.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use strict';
2+
3+
var bar = function (param2) {
4+
return param2;
5+
};
6+
7+
var foo = function () {
8+
bar();
9+
};
10+
11+
var myObject = {
12+
method1: function () {
13+
return '12';
14+
},
15+
methodWithIgnoredParam: function (_ignore) {
16+
return 42;
17+
}
18+
};
19+
20+
bar(function () {
21+
foo(function () {
22+
myObject.method1();
23+
myObject.methodWithIgnoredParam(122);
24+
});
25+
});

0 commit comments

Comments
 (0)