* 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)
| 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, |
no test coverage detected
searching dependent graphs…