Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix override for gjs files in recommended config #2891

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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