How to use the @hint/utils-string.mergeIgnoreIncludeArrays function in @hint/utils-string

To help you get started, we’ve selected a few @hint/utils-string 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-no-html-only-headers / src / hint.ts View on Github external
const validate = ({ element, resource, response }: FetchEnd) => {
            // This check does not make sense for data URI.

            if (isDataURI(resource)) {
                debug(`Check does not apply for data URI: ${resource}`);

                return;
            }

            if (!willBeTreatedAsHTML(response)) {
                let headersToValidate = unneededHeaders;

                if (exceptionMediaTypes.includes(response.mediaType)) {
                    headersToValidate = mergeIgnoreIncludeArrays(headersToValidate, exceptionHeaders, []);
                }
                const headers = includedHeaders(response.headers, headersToValidate);
                const numberOfHeaders = headers.length;

                if (numberOfHeaders > 0) {
                    let message: string;

                    if (numberOfHeaders === 1) {
                        message = getMessage('unneededHeader', context.language, prettyPrintArray(headers));
                    } else {
                        message = getMessage('unneededHeaders', context.language, prettyPrintArray(headers));
                    }

                    context.report(resource, message, { element, severity: Severity.warning });
                }
            }
github webhintio / hint / packages / hint-no-html-only-headers / src / hint.ts View on Github external
const loadHintConfigs = () => {
            const includeHeaders = (context.hintOptions && context.hintOptions.include) || [];
            const ignoreHeaders = (context.hintOptions && context.hintOptions.ignore) || [];

            unneededHeaders = mergeIgnoreIncludeArrays(unneededHeaders, ignoreHeaders, includeHeaders);
        };
github webhintio / hint / packages / hint-no-disallowed-headers / src / hint.ts View on Github external
const loadHintConfigs = () => {
            includeHeaders = (context.hintOptions && context.hintOptions.include) || [];
            ignoreHeaders = (context.hintOptions && context.hintOptions.ignore) || [];

            disallowedHeaders = mergeIgnoreIncludeArrays(disallowedHeaders, ignoreHeaders, includeHeaders);
        };