]> git.proxmox.com Git - pve-eslint.git/blob - eslint/tests/fixtures/testers/rule-tester/no-var.js
96a410fe78a793845ec767085684f22999a28e52
[pve-eslint.git] / eslint / tests / fixtures / testers / rule-tester / no-var.js
1 /**
2 * @fileoverview Rule to remove var statement
3 * @author Nicholas C. Zakas
4 */
5
6 //------------------------------------------------------------------------------
7 // Rule Definition
8 //------------------------------------------------------------------------------
9
10 "use strict";
11
12 module.exports = {
13 meta: {
14 fixable: "code",
15 schema: []
16 },
17 create(context) {
18 var sourceCode = context.getSourceCode();
19
20 return {
21 "VariableDeclaration": function(node) {
22 if (node.kind === "var") {
23 context.report({
24 node: node,
25 loc: sourceCode.getFirstToken(node).loc,
26 message: "Bad var.",
27 fix: function(fixer) {
28 return fixer.remove(sourceCode.getFirstToken(node));
29 }
30 })
31 }
32 }
33 };
34 }
35 };