Replace assign/clone helpers with object spread syntax.

This commit is contained in:
David Anson 2019-05-05 22:27:01 -07:00
parent 684416a902
commit 1b8b15693f
6 changed files with 51 additions and 55 deletions

View file

@ -271,7 +271,7 @@ function getEnabledRulesPerLineNumber(
if (!noInlineConfig) {
let match = helpers.inlineCommentRe.exec(line);
if (match) {
enabledRules = helpers.clone(enabledRules);
enabledRules = { ...enabledRules };
while (match) {
forMatch(match);
match = helpers.inlineCommentRe.exec(line);
@ -613,7 +613,10 @@ function readConfig(file, parsers, callback) {
if (errr) {
return callback(errr);
}
return callback(null, helpers.assign(extendsConfig, config));
return callback(null, {
...extendsConfig,
...config
});
});
}
return callback(null, config);
@ -639,9 +642,13 @@ function readConfigSync(file, parsers) {
const configExtends = config.extends;
if (configExtends) {
delete config.extends;
return helpers.assign(
readConfigSync(path.resolve(path.dirname(file), configExtends), parsers),
config);
return {
...readConfigSync(
path.resolve(path.dirname(file), configExtends),
parsers
),
...config
};
}
return config;
}