Skip to content

Commit

Permalink
Add tests to verify .markdownlint.cjs/mjs and .markdownlint-cli2.cjs/…
Browse files Browse the repository at this point in the history
…mjs can return the configuration/options object from a Promise, update documentation.
  • Loading branch information
DavidAnson committed Nov 20, 2023
1 parent d60f996 commit 64d28d3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ of the rules within.

- The format of this file is a [CommonJS module][commonjs-module] (`.cjs`) or
[ECMAScript module][ecmascript-module] (`.mjs`) that exports the object
described above for `.markdownlint-cli2.jsonc`.
described above for `.markdownlint-cli2.jsonc` (directly or from a `Promise`).
- Instead of passing a `String` to identify the module name/path to load for
`customRules`, `markdownItPlugins`, and `outputFormatters`, the corresponding
`Object` or `Function` can be provided directly.
Expand Down Expand Up @@ -392,7 +392,8 @@ of the rules within.

- The format of this file is a [CommonJS module][commonjs-module] (`.cjs`) or
[ECMAScript module][ecmascript-module] (`.mjs`) that exports the
[`markdownlint` `config` object][markdownlint-config].
[`markdownlint` `config` object][markdownlint-config] (directly or from a
`Promise`).
- Other details are the same as for `jsonc`/`json` files described above.
- For example: [`.markdownlint.cjs`][markdownlint-cjs] or
[`.markdownlint.mjs`][markdownlint-mjs]
Expand Down
4 changes: 2 additions & 2 deletions test/markdownlint-cjs/dir/subdir/.markdownlint.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

"use strict";

module.exports = {
module.exports = Promise.resolve({
"first-line-heading": false
};
});
4 changes: 2 additions & 2 deletions test/markdownlint-cli2-cjs/dir/subdir/.markdownlint-cli2.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

"use strict";

module.exports = {
module.exports = Promise.resolve({
"config": {
"first-line-heading": false
}
};
});
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @ts-check

"use strict";

module.exports = {
const options = Promise.resolve({
"config": {
"first-line-heading": false
}
};
});

export default options;
4 changes: 2 additions & 2 deletions test/markdownlint-mjs/dir/subdir/.markdownlint.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check

const config = {
const config = Promise.resolve({
"first-line-heading": false
};
});

export default config;

0 comments on commit 64d28d3

Please sign in to comment.