2 * @fileoverview Rule to enforce description with the `Symbol` object
8 //------------------------------------------------------------------------------
10 //------------------------------------------------------------------------------
12 const astUtils = require("./utils/ast-utils");
14 //------------------------------------------------------------------------------
16 //------------------------------------------------------------------------------
24 description: "require symbol descriptions",
25 category: "ECMAScript 6",
27 url: "https://eslint.org/docs/rules/symbol-description"
32 expected: "Expected Symbol to have a description."
39 * Reports if node does not conform the rule in case rule is set to
40 * report missing description
41 * @param {ASTNode} node A CallExpression node to check.
44 function checkArgument(node) {
45 if (node.arguments.length === 0) {
55 const scope = context.getScope();
56 const variable = astUtils.getVariableByName(scope, "Symbol");
58 if (variable && variable.defs.length === 0) {
59 variable.references.forEach(reference => {
60 const node = reference.identifier;
62 if (astUtils.isCallee(node)) {
63 checkArgument(node.parent);