Skip to content

Commit

Permalink
Fix override for gjs files in recommended config (#2891)
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed May 23, 2023
1 parent 6691643 commit a8344ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/get-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ async function processLoadedConfigurations(workingDir, config, options) {
function processExtends(config) {
let extendedList = normalizeExtends(config);
let extendedRules = {};
let extendedOverrides = [];

if (extendedList) {
for (const extendName of extendedList) {
Expand All @@ -291,6 +292,10 @@ function processExtends(config) {

delete configuration.loadedConfigurations;

if (configuration.overrides) {
extendedOverrides = [...extendedOverrides, ...configuration.overrides];
}

if (configuration.rules) {
extendedRules = Object.assign({}, extendedRules, configuration.rules);
} else {
Expand All @@ -305,6 +310,7 @@ function processExtends(config) {
}

config.rules = Object.assign({}, extendedRules, config.rules);
config.overrides = [...extendedOverrides, ...(config.overrides || [])];
}
}

Expand Down
1 change: 1 addition & 0 deletions test/unit/get-config-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ describe('get-config', function () {
});

expect(actual.rules['no-debugger']).toEqual({ config: true, severity: 2 });
expect(actual.overrides[0]?.files).toEqual(['**/*.gjs', '**/*.gts']);
});

it('can extend and override a default configuration', async function () {
Expand Down

0 comments on commit a8344ed

Please sign in to comment.