How to use the @hint/utils-types.Severity.off function in @hint/utils-types

To help you get started, we’ve selected a few @hint/utils-types 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-performance-budget / src / hint.ts View on Github external
const config: NetworkConfig | null = getConfiguration();

            /* istanbul ignore if */
            if (!config) {
                return;
            }

            const loadTime = getBestCaseScenario(config);

            debug(`Ideal load time: ${loadTime}s`);


            if (typeof config.load === 'number') {
                const severity = calculateSeverity(loadTime, config.load);

                if (severity !== Severity.off) {
                    context.report(
                        resource,
                        getMessage(severity === Severity.hint ? 'toLoadAllResourcesLess' : 'toLoadAllResourcesMore', context.language, [config.id, loadTime.toFixed(1), (loadTime - config.load).toFixed(1), config.load.toString()]),
                        { severity });
                }
            }
        };
github webhintio / hint / packages / hint-no-vulnerable-javascript-libraries / src / hint.ts View on Github external
const reportLibrary = (library: Library, vulns: Vulnerability[], resource: string) => {
            let vulnerabilities = vulns;


            debug('Filtering vulnerabilities');
            let maxSeverity = Severity.off;

            vulnerabilities = vulnerabilities.filter((vulnerability) => {
                const { severity } = vulnerability;
                let fails = false;

                maxSeverity = Math.max(maxSeverity, toSeverity(severity as SnykSeverity));

                switch (minimumSeverity) {
                    case 'medium':
                        fails = severity === 'medium' || severity === 'high';
                        break;
                    case 'high':
                        fails = severity === 'high';
                        break;
                    // priority is low, so everything needs to be reported
                    default:
github webhintio / hint / packages / hint-performance-budget / src / hint.ts View on Github external
const calculateSeverity = (loadTime: number, configurationLoadTime: number): Severity => {
            const percentage = (loadTime * 100) / configurationLoadTime;

            if (percentage < 90) {
                return Severity.off;
            } else if (percentage < 100) {
                return Severity.hint;
            } else if (percentage < 150) {
                return Severity.warning;
            }

            return Severity.error;
        };