Repository: eslint/eslint
File: tests/lib/source-code/source-code.js (JavaScript)

Code before:
                            LogicalExpression: checkEmpty,
                            ConditionalExpression: checkEmpty,
                            CallExpression: checkEmpty,
                            NewExpression: checkEmpty,
                            MemberExpression: checkEmpty,
                            SwitchCase: checkEmpty,
                            Identifier: checkEmpty,
                            Literal: checkEmpty,
                            ForOfStatement: checkEmpty,
                            ArrowFunctionExpression: checkEmpty,
                            YieldExpression: checkEmpty,
                            TemplateLiteral: checkEmpty,
                            TaggedTemplateExpression: checkEmpty,
                            TemplateElement: checkEmpty,
                            ObjectPattern: checkEmpty,
                            ArrayPattern: checkEmpty,
                            RestElement: checkEmpty,
                            AssignmentPattern: checkEmpty,
                            ClassBody: checkEmpty,
                            MethodDefinition: checkEmpty,
                            MetaProperty: checkEmpty
                        };

                        rule[type] = function(node) {
                            const expectedNames = expectedNamesList.shift();
                            const variables = context.getDeclaredVariables(node);

                            assert(Array.isArray(expectedNames));
                            assert(Array.isArray(variables));
                            assert.strictEqual(expectedNames.length, variables.length);
                            for (let i = variables.length - 1; i >= 0; i--) {
                                assert.strictEqual(expectedNames[i], variables[i].name);
                            }
                        };
                        return rule;
                    }
                }
            });
            linter.verify(code, {
                rules: { test: 2 },
                parserOptions: {
                    ecmaVersion: 6,
                    sourceType: "module"
                }
            });

            // Check all expected names are asserted.
            assert.strictEqual(0, expectedNamesList.length);
        }

        it("VariableDeclaration", () => {

Review comment (suggestion):
```suggestion
                            const variables = sourceCode.getDeclaredVariables(node);
```

Code after:
                         */
                        function checkEmpty(node) {
                            assert.strictEqual(0, sourceCode.getDeclaredVariables(node).length);
                        }
                        const rule = {
                            Program: checkEmpty,
                            EmptyStatement: checkEmpty,
                            BlockStatement: checkEmpty,
                            ExpressionStatement: checkEmpty,
                            LabeledStatement: checkEmpty,
                            BreakStatement: checkEmpty,
                            ContinueStatement: checkEmpty,
                            WithStatement: checkEmpty,
                            SwitchStatement: checkEmpty,
                            ReturnStatement: checkEmpty,
                            ThrowStatement: checkEmpty,
                            TryStatement: checkEmpty,
                            WhileStatement: checkEmpty,
                            DoWhileStatement: checkEmpty,
                            ForStatement: checkEmpty,
                            ForInStatement: checkEmpty,
                            DebuggerStatement: checkEmpty,
                            ThisExpression: checkEmpty,
                            ArrayExpression: checkEmpty,
                            ObjectExpression: checkEmpty,
                            Property: checkEmpty,
                            SequenceExpression: checkEmpty,
                            UnaryExpression: checkEmpty,
                            BinaryExpression: checkEmpty,
                            AssignmentExpression: checkEmpty,
                            UpdateExpression: checkEmpty,
                            LogicalExpression: checkEmpty,
                            ConditionalExpression: checkEmpty,
                            CallExpression: checkEmpty,
                            NewExpression: checkEmpty,
                            MemberExpression: checkEmpty,
                            SwitchCase: checkEmpty,
                            Identifier: checkEmpty,
                            Literal: checkEmpty,
                            ForOfStatement: checkEmpty,
                            ArrowFunctionExpression: checkEmpty,
                            YieldExpression: checkEmpty,
                            TemplateLiteral: checkEmpty,
                            TaggedTemplateExpression: checkEmpty,
                            TemplateElement: checkEmpty,
                            ObjectPattern: checkEmpty,
                            ArrayPattern: checkEmpty,
                            RestElement: checkEmpty,
                            AssignmentPattern: checkEmpty,
                            ClassBody: checkEmpty,
                            MethodDefinition: checkEmpty,