UNPKG

603 BJavaScriptView Raw
1/**
2 * @fileoverview Rule to flag when deleting variables
3 * @author Ilya Volodin
4 */
5
6"use strict";
7
8//------------------------------------------------------------------------------
9// Rule Definition
10//------------------------------------------------------------------------------
11
12module.exports = function(context) {
13
14 return {
15
16 "UnaryExpression": function(node) {
17 if (node.operator === "delete" && node.argument.type === "Identifier") {
18 context.report(node, "Variables should not be deleted.");
19 }
20 }
21 };
22
23};
24
25module.exports.schema = [];