source: imaps-frontend/node_modules/eslint/lib/rules/no-new.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.0 KB
RevLine 
[d565449]1/**
2 * @fileoverview Rule to flag statements with function invocation preceded by
3 * "new" and not part of assignment
4 * @author Ilya Volodin
5 */
6
7"use strict";
8
9//------------------------------------------------------------------------------
10// Rule Definition
11//------------------------------------------------------------------------------
12
13/** @type {import('../shared/types').Rule} */
14module.exports = {
15 meta: {
16 type: "suggestion",
17
18 docs: {
19 description: "Disallow `new` operators outside of assignments or comparisons",
20 recommended: false,
21 url: "https://eslint.org/docs/latest/rules/no-new"
22 },
23
24 schema: [],
25
26 messages: {
27 noNewStatement: "Do not use 'new' for side effects."
28 }
29 },
30
31 create(context) {
32
33 return {
34 "ExpressionStatement > NewExpression"(node) {
35 context.report({
36 node: node.parent,
37 messageId: "noNewStatement"
38 });
39 }
40 };
41
42 }
43};
Note: See TracBrowser for help on using the repository browser.