Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This change makes rule-tester check messageId directly by value provided instead of the current behavior, which is to check the messageId's message value against the message returned from the rule at runtime.
- Loading branch information
1 parent
ea6fb17
commit 0bc4a38
Showing
6 changed files
with
151 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"use strict"; | ||
module.exports.withMetaWithData = { | ||
meta: { | ||
messages: { | ||
avoidFoo: "Avoid using variables named '{{ name }}'.", | ||
unused: "An unused key" | ||
} | ||
}, | ||
create(context) { | ||
return { | ||
Identifier(node) { | ||
if (node.name === "foo") { | ||
context.report({ | ||
node, | ||
messageId: "avoidFoo", | ||
data: { | ||
name: "foo" | ||
} | ||
}); | ||
} | ||
} | ||
}; | ||
} | ||
}; | ||
|
||
module.exports.withMessageOnly = { | ||
create(context) { | ||
return { | ||
Identifier(node) { | ||
if (node.name === "foo") { | ||
context.report({ node, message: "Avoid using variables named 'foo'."}); | ||
} | ||
} | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters