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.3 KB
|
Line | |
---|
1 | /**
|
---|
2 | * @fileoverview Rule to flag usage of __iterator__ property
|
---|
3 | * @author Ian Christian Myers
|
---|
4 | */
|
---|
5 |
|
---|
6 | "use strict";
|
---|
7 |
|
---|
8 | //------------------------------------------------------------------------------
|
---|
9 | // Requirements
|
---|
10 | //------------------------------------------------------------------------------
|
---|
11 |
|
---|
12 | const { getStaticPropertyName } = require("./utils/ast-utils");
|
---|
13 |
|
---|
14 | //------------------------------------------------------------------------------
|
---|
15 | // Rule Definition
|
---|
16 | //------------------------------------------------------------------------------
|
---|
17 |
|
---|
18 | /** @type {import('../shared/types').Rule} */
|
---|
19 | module.exports = {
|
---|
20 | meta: {
|
---|
21 | type: "suggestion",
|
---|
22 |
|
---|
23 | docs: {
|
---|
24 | description: "Disallow the use of the `__iterator__` property",
|
---|
25 | recommended: false,
|
---|
26 | url: "https://eslint.org/docs/latest/rules/no-iterator"
|
---|
27 | },
|
---|
28 |
|
---|
29 | schema: [],
|
---|
30 |
|
---|
31 | messages: {
|
---|
32 | noIterator: "Reserved name '__iterator__'."
|
---|
33 | }
|
---|
34 | },
|
---|
35 |
|
---|
36 | create(context) {
|
---|
37 |
|
---|
38 | return {
|
---|
39 |
|
---|
40 | MemberExpression(node) {
|
---|
41 |
|
---|
42 | if (getStaticPropertyName(node) === "__iterator__") {
|
---|
43 | context.report({
|
---|
44 | node,
|
---|
45 | messageId: "noIterator"
|
---|
46 | });
|
---|
47 | }
|
---|
48 | }
|
---|
49 | };
|
---|
50 |
|
---|
51 | }
|
---|
52 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.