Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update: report location of func-names (fixes #12022) (#12028)
  • Loading branch information
g-plane authored and aladdin-add committed Jul 31, 2019
1 parent 02d7542 commit 5831767
Show file tree
Hide file tree
Showing 2 changed files with 282 additions and 40 deletions.
4 changes: 4 additions & 0 deletions lib/rules/func-names.js
Expand Up @@ -69,6 +69,8 @@ module.exports = {

create(context) {

const sourceCode = context.getSourceCode();

/**
* Returns the config option for the given node.
* @param {ASTNode} node - A node to get the config for.
Expand Down Expand Up @@ -130,6 +132,7 @@ module.exports = {
context.report({
node,
messageId: "unnamed",
loc: astUtils.getFunctionHeadLoc(node, sourceCode),
data: { name: astUtils.getFunctionNameWithKind(node) }
});
}
Expand All @@ -143,6 +146,7 @@ module.exports = {
context.report({
node,
messageId: "named",
loc: astUtils.getFunctionHeadLoc(node, sourceCode),
data: { name: astUtils.getFunctionNameWithKind(node) }
});
}
Expand Down

0 comments on commit 5831767

Please sign in to comment.