function getConfiguration()

in htmlhint-server/src/server.ts [81:105]


function getConfiguration(filePath: string): any {
    var options: any;
    if (settings.htmlhint) {
        if (settings.htmlhint.configFile && settings.htmlhint.options && Object.keys(settings.htmlhint.options).length > 0) {
            throw new Error(`The configuration settings for HTMLHint are invalid. Please specify either 'htmlhint.configFile' or 'htmlhint.options', but not both.`);
        }
        if (settings.htmlhint.configFile) {
            if (fs.existsSync(settings.htmlhint.configFile)) {
                options = loadConfigurationFile(settings.htmlhint.configFile)
            } else {
                const configFileHint = !path.isAbsolute(settings.htmlhint.configFile) ? ` (resolves to '${path.resolve(settings.htmlhint.configFile)}')` : '';
                throw new Error(`The configuration settings for HTMLHint are invalid. The file '${settings.htmlhint.configFile}'${configFileHint} specified in 'htmlhint.configFile' could not be found.`);
            }
        } else if (settings.htmlhint.options && Object.keys(settings.htmlhint.options).length > 0) {
            options = settings.htmlhint.options;
        } else {
            options = findConfigForHtmlFile(filePath);
        }
    } else {
        options = findConfigForHtmlFile(filePath);
    }

    options = options || {};
    return options;
}