How to use the jsdoctypeparser.publish function in jsdoctypeparser

To help you get started, we’ve selected a few jsdoctypeparser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gajus / eslint-plugin-jsdoc / src / rules / checkTypes.js View on Github external
) {
            preferred = strictNativeType;
            invalidTypes.push([nodeName, preferred]);
            break;
          }
        }
      }

      // For fixer
      if (preferred) {
        adjustNames(type, preferred, isGenericMatch, nodeName, node, parentNode);
      }
    });

    if (invalidTypes.length) {
      const fixedType = publish(typeAst);

      const tagName = jsdocTag.tag;
      invalidTypes.forEach(([badType, preferredType = '', message]) => {
        const fix = (fixer) => {
          return fixer.replaceText(
            jsdocNode,
            sourceCode.getText(jsdocNode).replace(
              `{${jsdocTag.type}}`,
              `{${fixedType}}`,
            ),
          );
        };

        const tagValue = jsdocTag.name ? ` "${jsdocTag.name}"` : '';

        report(