How to use the @hint/utils.normalizeHints 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 / config.ts View on Github external
}

        // In case the user uses the --watch flag when running hint
        if (options && options.watch && userConfig.connector && userConfig.connector.options) {
            userConfig.connector.options.watch = options.watch;
        }

        updateConfigWithOptionsValues(userConfig, options);

        if (userConfig.formatters && !Array.isArray(userConfig.formatters)) {
            userConfig.formatters = [userConfig.formatters];
        }

        const browsers = browserslist(config.browserslist);
        const ignoredUrls = loadIgnoredUrls(userConfig);
        const hints = Configuration.cleanHints(normalizeHints(userConfig.hints!)); // `userConfig.hints` should not be `null` due to `validateConfig` check above

        return new Configuration(userConfig, browsers, ignoredUrls, hints);
    }
github webhintio / hint / packages / hint / src / lib / cli / analyze.ts View on Github external
const getHintsForTelemetry = (hints?: HintsConfigObject | (string | any)[]) => {
    if (!hints) {
        return null;
    }

    const normalizedHints = normalizeHints(hints);
    const result = {} as HintsConfigObject;

    for (const [hintId, severity] of Object.entries(normalizedHints)) {
        result[hintId] = typeof severity === 'string' ? severity : (severity as [HintSeverity, any])[0];
    }

    return result;
};
github webhintio / hint / packages / hint / src / lib / config.ts View on Github external
const configurations = userConfig.extends.map((config) => {
        const loadedConfiguration = resourceLoader.loadConfiguration(config, [parentConfig]);

        if (!validateConfig(loadedConfiguration)) {
            throw new Error(`Configuration package "${config}" is not valid`);
        }

        loadedConfiguration.hints = normalizeHints(loadedConfiguration.hints);

        return composeConfig(loadedConfiguration, config);
    });