-
Notifications
You must be signed in to change notification settings - Fork 915
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(load): resolve plugins from extended configs (#1976)
* test(load): adds test for loading plugins from an extended config * fix(load): loads plugins from extended configs * refactor: clean up a loading test * test(load): adds test for including a shareable config with a local plugin * test: adds more realistic test-scenarios * Update @commitlint/load/src/load.ts Co-authored-by: Cedric van Putten <me@bycedric.com> Co-authored-by: Julius Celik <julius.celik@digitalroute.com> Co-authored-by: Cedric van Putten <me@bycedric.com>
- Loading branch information
1 parent
50ae7c1
commit d0f0eb9
Showing
8 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
@commitlint/load/fixtures/extends-with-local-plugins/commitlint.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: ['./config-with-local-plugin'], | ||
}; |
21 changes: 21 additions & 0 deletions
21
...nt/load/fixtures/extends-with-local-plugins/config-with-local-plugin/commitlint.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module.exports = { | ||
extends: [], | ||
plugins: [{ | ||
rules: { | ||
'hello-world-rule': ({ subject }) => { | ||
const HELLO_WORLD = 'Hello World'; | ||
return [ | ||
subject.includes(HELLO_WORLD), | ||
`Your subject should contain ${HELLO_WORLD} message` | ||
]; | ||
}, | ||
'is-positive': ({ subject }) => { | ||
const POSITIVE_EMOJI = ':)'; | ||
return [ | ||
subject.includes(POSITIVE_EMOJI), | ||
`Your subject should contain ${POSITIVE_EMOJI} message` | ||
]; | ||
} | ||
} | ||
}] | ||
}; |
1 change: 1 addition & 0 deletions
1
@commitlint/load/fixtures/extends-with-local-plugins/config-with-local-plugin/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./commitlint.config.js'); |
3 changes: 3 additions & 0 deletions
3
@commitlint/load/fixtures/extends-with-plugins/commitlint.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: ['./config-with-plugins'], | ||
}; |
3 changes: 3 additions & 0 deletions
3
@commitlint/load/fixtures/extends-with-plugins/config-with-plugins/commitlint.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
plugins: ['example', '@scope/example'] | ||
}; |
1 change: 1 addition & 0 deletions
1
@commitlint/load/fixtures/extends-with-plugins/config-with-plugins/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./commitlint.config.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters