%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/node_modules/@next/eslint-plugin-next/lib/rules/
Upload File :
Create Path :
Current File : /var/www/html/node_modules/@next/eslint-plugin-next/lib/rules/no-sync-scripts.js

module.exports = function (context) {
  return {
    JSXOpeningElement(node) {
      if (node.name.name !== 'script') {
        return
      }
      if (node.attributes.length === 0) {
        return
      }
      const attributeNames = node.attributes
        .filter((attr) => attr.type === 'JSXAttribute')
        .map((attr) => attr.name.name)
      if (
        attributeNames.includes('src') &&
        !attributeNames.includes('async') &&
        !attributeNames.includes('defer')
      ) {
        context.report({
          node,
          message:
            'External synchronous scripts are forbidden. See: https://nextjs.org/docs/messages/no-sync-scripts',
        })
      }
    },
  }
}

module.exports.schema = []

Zerion Mini Shell 1.0