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.2 KB
|
Line | |
---|
1 | /**
|
---|
2 | * @fileoverview A rule to disallow negated left operands of the `in` operator
|
---|
3 | * @author Michael Ficarra
|
---|
4 | * @deprecated in ESLint v3.3.0
|
---|
5 | */
|
---|
6 |
|
---|
7 | "use strict";
|
---|
8 |
|
---|
9 | //------------------------------------------------------------------------------
|
---|
10 | // Rule Definition
|
---|
11 | //------------------------------------------------------------------------------
|
---|
12 |
|
---|
13 | /** @type {import('../shared/types').Rule} */
|
---|
14 | module.exports = {
|
---|
15 | meta: {
|
---|
16 | type: "problem",
|
---|
17 |
|
---|
18 | docs: {
|
---|
19 | description: "Disallow negating the left operand in `in` expressions",
|
---|
20 | recommended: false,
|
---|
21 | url: "https://eslint.org/docs/latest/rules/no-negated-in-lhs"
|
---|
22 | },
|
---|
23 |
|
---|
24 | replacedBy: ["no-unsafe-negation"],
|
---|
25 |
|
---|
26 | deprecated: true,
|
---|
27 | schema: [],
|
---|
28 |
|
---|
29 | messages: {
|
---|
30 | negatedLHS: "The 'in' expression's left operand is negated."
|
---|
31 | }
|
---|
32 | },
|
---|
33 |
|
---|
34 | create(context) {
|
---|
35 |
|
---|
36 | return {
|
---|
37 |
|
---|
38 | BinaryExpression(node) {
|
---|
39 | if (node.operator === "in" && node.left.type === "UnaryExpression" && node.left.operator === "!") {
|
---|
40 | context.report({ node, messageId: "negatedLHS" });
|
---|
41 | }
|
---|
42 | }
|
---|
43 | };
|
---|
44 |
|
---|
45 | }
|
---|
46 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.