-
-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
template-indent
: Support member expression paths in tags
and `fun…
…ctions` (#2346)
- Loading branch information
Showing
7 changed files
with
75 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
const {isNodeMatches} = require('../utils/is-node-matches.js'); | ||
|
||
/** | ||
Check if the given node is a tagged template literal. | ||
@param {Node} node - The AST node to check. | ||
@param {string[]} tags - The object name or key paths. | ||
@returns {boolean} | ||
*/ | ||
function isTaggedTemplateLiteral(node, tags) { | ||
if ( | ||
node.type !== 'TemplateLiteral' | ||
|| node.parent.type !== 'TaggedTemplateExpression' | ||
|| node.parent.quasi !== node | ||
) { | ||
return false; | ||
} | ||
|
||
if (tags) { | ||
return isNodeMatches(node.parent.tag, tags); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
module.exports = isTaggedTemplateLiteral; |
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