Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (config) {
// ensure plugins are properly loaded first
if (config.plugins) {
Plugins.loadAll(config.plugins);
}
// remove parser from config if it is the default parser
if (config.parser === defaultOptions.parser) {
config.parser = null;
}
// include full path of parser if present
if (config.parser) {
config.parser = resolveModule.sync(config.parser, {basedir: basedir});
}
// validate the configuration before continuing
validator.validate(config, filePath);
// If an `extends` property is defined, it represents a configuration file to use as
// a "parent". Load the referenced file and merge the configuration recursively.
if (config.extends) {
config = applyExtends(config, filePath, basedir);
}
if (config.env && applyEnvironments) {
// Merge in environment-specific globals and parserOptions.
config = ConfigOps.applyEnvironments(config);
}
private internalTemplateResolver(): CompatResolver {
let resolver = new CompatResolver({
root: this.root,
modulePrefix: this.modulePrefix(),
options: this.options,
activePackageRules: this.activeRules(),
resolvableExtensions: this.resolvableExtensions(),
});
// It's ok that this isn't a fully configured template compiler. We're only
// using it to parse component snippets out of rules.
resolver.astTransformer(
new TemplateCompiler({
compilerPath: resolveSync(this.templateCompilerPath(), { basedir: this.root }),
EmberENV: {},
plugins: {},
})
);
return resolver;
}
clientsClaim: true,
exclude: [/\.map$/, /asset-manifest\.json$/],
importWorkboxFrom: 'cdn',
navigateFallback: publicUrl + '/index.html',
navigateFallbackBlacklist: [
// Exclude URLs starting with /_, as they're likely an API call
new RegExp('^/_'),
// Exclude URLs containing a dot, as they're likely a resource in
// public/ and not a SPA route
new RegExp('/[^/]+\\.[^/]+$')
]
}),
// TypeScript type checking
useTypeScript &&
new ForkTsCheckerWebpackPlugin({
typescript: resolve.sync('typescript', {
basedir: paths.appNodeModules
}),
async: false,
checkSyntacticErrors: true,
tsconfig: paths.appTsConfig,
compilerOptions: {
module: 'esnext',
moduleResolution: 'node',
resolveJsonModule: true,
isolatedModules: true,
noEmit: true,
jsx: 'preserve'
},
reportFiles: [
'**',
'!**/*.json',
function detectFlowVersion() {
try {
const flowPackageJsonPath = resolve.sync('flow-bin/package.json', {basedir: process.cwd()});
const flowPackageJson = require(flowPackageJsonPath); // eslint-disable-line import/no-dynamic-require
return flowPackageJson.version;
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
error('Warning: Flow version was set to "detect" in eslint-plugin-react settings, ' +
'but the "flow-bin" package is not installed. Assuming latest Flow version for linting.');
return '999.999.999';
}
throw e;
}
}
init() {
this._super.init && this._super.init.apply(this, arguments);
this._bootstrapPath = path.dirname(resolve.sync('bootstrap-sass/package.json')) + '/assets';
},
return;
}
if (aliases[value] !== undefined) {
value = aliases[value];
} else {
for (const key of Object.keys(aliases)) {
if (value.startsWith(`${key}/`)) {
value = value.replace(`${key}/`, `${aliases[key]}/`);
break;
}
}
}
try {
resolve.sync(value, {
basedir: fileDir,
extensions,
paths: process.env.NODE_PATH
? [process.env.NODE_PATH]
: undefined
});
} catch (e) {
return e.message;
}
}
resolve (packageName) {
let result;
try {
result = resolve(packageName, { basedir: process.cwd() });
result = require(result);
} catch (e) {
try {
result = require(packageName);
} catch (err) {}
}
return result;
},
function resolveFn(module, basePath, dirname) {
try {
return resolve(module, {
basedir: path.join(basePath, dirname || '')
})
} catch (e) {}
}
private impliedAddonAssets(type: keyof ImplicitAssetPaths): string[] {
let result: Array = [];
for (let addon of sortBy(this.adapter.allActiveAddons, this.scriptPriority.bind(this))) {
let implicitScripts = addon.meta[type];
if (implicitScripts) {
let styles = [];
let options = { basedir: addon.root };
for (let mod of implicitScripts) {
if (type === 'implicit-styles') {
styles.push(resolve.sync(mod, options));
} else {
result.push(resolve.sync(mod, options));
}
}
if (styles.length) {
result = [...styles, ...result];
}
}
}
return result;
}
function usingReact() {
try {
const reactPath = resolve.sync('react', { basedir: process.cwd() })
require(reactPath)
return true
} catch (e) {
return false
}
}