Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit ed4518d

Browse files
markeloghzoo
authored andcommitted
Fix: disallowUnusedParams - correctly output unused param name
Fixes #1859 Closes gh-1865
1 parent 56a32f7 commit ed4518d

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

lib/rules/disallow-unused-params.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ module.exports.prototype = {
102102
var param = params[index];
103103

104104
errors.cast({
105-
message: 'Param `' + value.name + '` is not used',
105+
message: 'Param `' + value.param.name + '` is not used',
106106
line: param.loc.start.line,
107107
column: param.loc.start.column,
108108
additional: {

test/specs/rules/disallow-unused-params.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ describe('rules/disallow-unused-params', function() {
2323
)).to.have.no.errors();
2424
});
2525

26+
it('should report unused param', function() {
27+
expect(checker.checkString(
28+
'function fun(test) { }'
29+
)).to.have.error('Param `test` is not used');
30+
});
31+
2632
reportAndFix({
2733
name: 'function a(b) {}',
2834
rules: config,

0 commit comments

Comments
 (0)