5763661584c061cc6b4814d0630f8bb69c3f7d93
[dotfiles/.git] / no-with.js
1 /**
2  * @fileoverview Rule to flag use of with statement
3  * @author Nicholas C. Zakas
4  */
5
6 "use strict";
7
8 //------------------------------------------------------------------------------
9 // Rule Definition
10 //------------------------------------------------------------------------------
11
12 module.exports = {
13     meta: {
14         type: "suggestion",
15
16         docs: {
17             description: "disallow `with` statements",
18             category: "Best Practices",
19             recommended: true,
20             url: "https://eslint.org/docs/rules/no-with"
21         },
22
23         schema: []
24     },
25
26     create(context) {
27
28         return {
29             WithStatement(node) {
30                 context.report({ node, message: "Unexpected use of 'with' statement." });
31             }
32         };
33
34     }
35 };