You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The order of the current extends resolution is counterintuitive, extends are usually resolved from left to right, but it is currently resolved from right to left.
Expected Behavior
extends should be resolved from left to right.
Current Behavior
extends is currently resolved from right to left.
Affected packages
@commitlint/resolve-extends
Possible Solution
Change the order of the extends resolution.
Steps to Reproduce (for bugs)
Add the following test case to /@commitlint/resolve-extends/src/index.test.ts:
test('extends rules from left to right with overlap',()=>{constinput={extends: ['left','right']};constrequire=(id: string)=>{switch(id){case'left':
return{rules: {a: true}};case'right':
return{rules: {a: false,b: true}};default:
return{};}};constctx={resolve: id,require: jest.fn(require)}asResolveExtendsContext;constactual=resolveExtends(input,ctx);constexpected={extends: ['left','right'],rules: {a: false,b: true,},};expect(actual).toEqual(expected);});
● extends rules from left to right with overlap
expect(received).toEqual(expected) // deep equality
- Expected - 1
+ Received + 1
@@ -2,9 +2,9 @@
"extends": Array [
"left",
"right",
],
"rules": Object {
- "a": false,
+ "a": true,
"b": true,
},
}
Context
I'd like to have a base config and extend it as needed, for example I want to use the base config most of the time:
{"extends": ["my-config"]}
and override it if the repository has some sharable special requirements:
The order of the current
extends
resolution is counterintuitive,extends
are usually resolved from left to right, but it is currently resolved from right to left.Expected Behavior
extends
should be resolved from left to right.Current Behavior
extends
is currently resolved from right to left.Affected packages
@commitlint/resolve-extends
Possible Solution
Change the order of the
extends
resolution.Steps to Reproduce (for bugs)
Add the following test case to
/@commitlint/resolve-extends/src/index.test.ts
:Context
I'd like to have a base config and extend it as needed, for example I want to use the base config most of the time:
and override it if the repository has some sharable special requirements:
Your Environment
commitlint --version
The text was updated successfully, but these errors were encountered: