Identifier()

in packages/eslint-plugin/src/rules/best-practices/no-discouraged-words.ts [62:78]


      Identifier(node: TSESTree.Identifier) {
        const variableName = node.name;
        const variableNameViolation = discouragedWords.find(word =>
          variableName.match(new RegExp(word, 'i')),
        );

        if (!variableNameViolation) {
          // There is no violation here
          return;
        }

        // Report it as an error to ESLint
        context.report({
          node,
          message: `Usage of the word "${variableNameViolation}" is strongly discouraged. Please use a different word.`,
        });
      },