Skip to content

Commit 9b44085

Browse files
committed
Prepare stylelint for ESM-only by dynamic importing.
1 parent 1e982ce commit 9b44085

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

Lombiq.NodeJs.Extensions/scripts/lint-styles.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/* eslint-disable-next-line import/no-unresolved -- ESLint does not know where to find external modules. */
2-
const stylelint = require('stylelint');
3-
41
const { handleWarningObject, handleErrorMessage } = require('./handle-error');
52

63
function formatResult(result) {
@@ -38,10 +35,17 @@ const options = {
3835
formatter: (results) => results.forEach(formatResult),
3936
};
4037

41-
stylelint
42-
.lint(options)
43-
.catch((error) => {
44-
process.stdout.write(error + '\n');
45-
handleErrorMessage(error);
46-
process.exit(1);
47-
});
38+
(async function main() {
39+
const { default: stylelint } = await import('stylelint');
40+
41+
stylelint
42+
.lint(options)
43+
.catch((error) => {
44+
process.stdout.write(error + '\n');
45+
handleErrorMessage(error);
46+
process.exit(1);
47+
});
48+
})().catch((error) => {
49+
handleErrorMessage(error);
50+
process.exit(1);
51+
});

0 commit comments

Comments
 (0)