MCPcopy
hub / github.com/eslint/eslint / verify

Function verify

tests/lib/languages/js/source-code/source-code.js:1706–1814  ·  view source on GitHub ↗

* Assert `sourceCode.getDeclaredVariables(node)` is valid. * @param {string} code A code to check. * @param {string} type A type string of ASTNode. This method checks variables on the node of the type. * @param {Array >} expectedNamesList An array of expected variable names. Th

(code, type, expectedNamesList)

Source from the content-addressed store, hash-verified

1704 * @returns {void}
1705 */
1706 function verify(code, type, expectedNamesList) {
1707 linter.verify(code, {
1708 plugins: {
1709 test: {
1710 rules: {
1711 checker: {
1712 create(context) {
1713 const sourceCode = context.sourceCode;
1714
1715 /**
1716 * Assert `sourceCode.getDeclaredVariables(node)` is empty.
1717 * @param {ASTNode} node A node to check.
1718 * @returns {void}
1719 */
1720 function checkEmpty(node) {
1721 assert.strictEqual(
1722 0,
1723 sourceCode.getDeclaredVariables(
1724 node,
1725 ).length,
1726 );
1727 }
1728 const rule = {
1729 Program: checkEmpty,
1730 EmptyStatement: checkEmpty,
1731 BlockStatement: checkEmpty,
1732 ExpressionStatement: checkEmpty,
1733 LabeledStatement: checkEmpty,
1734 BreakStatement: checkEmpty,
1735 ContinueStatement: checkEmpty,
1736 WithStatement: checkEmpty,
1737 SwitchStatement: checkEmpty,
1738 ReturnStatement: checkEmpty,
1739 ThrowStatement: checkEmpty,
1740 TryStatement: checkEmpty,
1741 WhileStatement: checkEmpty,
1742 DoWhileStatement: checkEmpty,
1743 ForStatement: checkEmpty,
1744 ForInStatement: checkEmpty,
1745 DebuggerStatement: checkEmpty,
1746 ThisExpression: checkEmpty,
1747 ArrayExpression: checkEmpty,
1748 ObjectExpression: checkEmpty,
1749 Property: checkEmpty,
1750 SequenceExpression: checkEmpty,
1751 UnaryExpression: checkEmpty,
1752 BinaryExpression: checkEmpty,
1753 AssignmentExpression: checkEmpty,
1754 UpdateExpression: checkEmpty,
1755 LogicalExpression: checkEmpty,
1756 ConditionalExpression: checkEmpty,
1757 CallExpression: checkEmpty,
1758 NewExpression: checkEmpty,
1759 MemberExpression: checkEmpty,
1760 SwitchCase: checkEmpty,
1761 Identifier: checkEmpty,
1762 Literal: checkEmpty,
1763 ForOfStatement: checkEmpty,

Callers 1

source-code.jsFile · 0.70

Calls 1

verifyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…