How to use the @hint/utils.loadResource function in @hint/utils

To help you get started, we’ve selected a few @hint/utils 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 webhintio / hint / packages / hint / src / lib / utils / resource-loader.ts View on Github external
const loadedResources = items.reduce((loaded, resourceId) => {
        try {
            const resource = loadResource(resourceId, type, configurations, true);

            loaded.push(resource);
        } catch (e) {
            const name = isFullPackageName(resourceId, type) ? resourceId : `${type}-${resourceId}`;

            if (e.status === ResourceErrorStatus.NotCompatible) {
                incompatible.push(name);
            } else if (e.status === ResourceErrorStatus.NotFound) {
                missing.push(name);
            } else {
                throw e;
            }
        }

        return loaded;
    }, [] as any[]);