async function validateExtension(extensionWithFilename) {
  /** @type {string[]} */
  const errors = [];
  const { eventsBasedBehaviors, eventsFunctions } =
    extensionWithFilename.extension;

  /**
   * A list of all events functions of the extension.
   * @type {EventsFunction[]}
   */
  const allEventsFunctions = eventsFunctions.concat(
    eventsBasedBehaviors.flatMap(({ eventsFunctions }) => eventsFunctions)
  );

  /**
   * A list of all events functions that will be used by extension users (non-lifecycle and non-private functions).
   * @type {EventsFunction[]}
   */
  const publicEventsFunctions = allEventsFunctions.filter(
    ({ name, private: p }) => !lifecycleFunctions.has(name) && !p
  );

  // Ensure the rules are loaded before starting verification
  if (rules.length === 0) await loadRules;

  const promises = [];
  for (const rule of rules) {
    promises.push(
      rule.validate({
        allEventsFunctions,
        publicEventsFunctions,
        onError: (message) => errors.push(`[${rule.name}]: ${message}`),
        ...extensionWithFilename,
      })
    );
  }

  await Promise.all(promises);

  return errors;
}
/**
 * Check the extension for any properties that are not on the allow list.
 * @param {ExtensionWithFilename} extensionWithFilename
 * @returns {Promise<string[]>}
 */
Check the extension for any properties that are not on the allow list.
Check the extension for any properties that are not on the allow list .
async function validateExtension(extensionWithFilename) {
  const errors = [];
  const { eventsBasedBehaviors, eventsFunctions } =
    extensionWithFilename.extension;
  const allEventsFunctions = eventsFunctions.concat(
    eventsBasedBehaviors.flatMap(({ eventsFunctions }) => eventsFunctions)
  );
  const publicEventsFunctions = allEventsFunctions.filter(
    ({ name, private: p }) => !lifecycleFunctions.has(name) && !p
  );
  if (rules.length === 0) await loadRules;
  const promises = [];
  for (const rule of rules) {
    promises.push(
      rule.validate({
        allEventsFunctions,
        publicEventsFunctions,
        onError: (message) => errors.push(`[${rule.name}]: ${message}`),
        ...extensionWithFilename,
      })
    );
  }
  await Promise.all(promises);
  return errors;
}
async function validateExtension ( extensionWithFilename ) { const errors = [ ] ; const { eventsBasedBehaviors , eventsFunctions } = extensionWithFilename . extension ; const allEventsFunctions = eventsFunctions . concat ( eventsBasedBehaviors . flatMap ( ( { eventsFunctions } ) => eventsFunctions ) ) ; const publicEventsFunctions = allEventsFunctions . filter ( ( { name , private : p } ) => ! lifecycleFunctions . has ( name ) && ! p ) ; if ( rules . length === 0 ) await loadRules ; const promises = [ ] ; for ( const rule of rules ) { promises . push ( rule . validate ( { allEventsFunctions , publicEventsFunctions , onError : ( message ) => errors . push ( ` ${ rule . name } ${ message } ` ) , ... extensionWithFilename , } ) ) ; } await Promise . all ( promises ) ; return errors ; }
Check the extension for any properties that are not on the allow list.
Check the extension for any properties that are not on the allow list .
/** @type {string[]} */ /**
   * A list of all events functions of the extension.
   * @type {EventsFunction[]}
   */ /**
   * A list of all events functions that will be used by extension users (non-lifecycle and non-private functions).
   * @type {EventsFunction[]}
   */ // Ensure the rules are loaded before starting verification