• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
12module.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        messages: {
26            unexpectedWith: "Unexpected use of 'with' statement."
27        }
28    },
29
30    create(context) {
31
32        return {
33            WithStatement(node) {
34                context.report({ node, messageId: "unexpectedWith" });
35            }
36        };
37
38    }
39};
40