Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
filePath: string | undefined;
} {
// if specify Config module, use it
if (configFilePath) {
try {
const modulePath = moduleResolver.resolveConfigPackageName(configFilePath);
return {
config: moduleInterop(require(modulePath)),
filePath: modulePath
};
} catch (error) {
// not found config module
}
}
// auto or specify path to config file
const result = rcFile(configFileName, {
configFileName: configFilePath,
defaultExtension: [".json", ".js", ".yml"],
packageJSON: {
fieldName: "textlint"
},
cwd
});
if (result === undefined) {
return {
config: {},
filePath: undefined
};
}
return {
config: result.config,
filePath: result.filePath
function getNcurc({configFileName, configFilePath, packageFile} = {}) {
const file = rcFile('ncurc', {
configFileName: configFileName || '.ncurc',
defaultExtension: ['.json', '.yml', '.js'],
cwd: configFilePath ||
(packageFile ? path.dirname(packageFile) : undefined)
});
return file && file.config;
}