github-pages-deploy-action/node_modules/eslint/lib/rules/no-iterator.js

53 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2020-03-07 11:45:40 +08:00
/**
* @fileoverview Rule to flag usage of __iterator__ property
* @author Ian Christian Myers
*/
"use strict";
2020-05-15 05:33:08 +08:00
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const { getStaticPropertyName } = require("./utils/ast-utils");
2020-03-07 11:45:40 +08:00
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "disallow the use of the `__iterator__` property",
category: "Best Practices",
recommended: false,
url: "https://eslint.org/docs/rules/no-iterator"
},
2020-05-15 05:33:08 +08:00
schema: [],
messages: {
noIterator: "Reserved name '__iterator__'."
}
2020-03-07 11:45:40 +08:00
},
create(context) {
return {
MemberExpression(node) {
2020-05-15 05:33:08 +08:00
if (getStaticPropertyName(node) === "__iterator__") {
context.report({
node,
messageId: "noIterator"
});
2020-03-07 11:45:40 +08:00
}
}
};
}
};