diff --git a/Makefile b/Makefile index 8e5fa5e..efa2977 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ .PHONY: check-rules-are-up-to-date check-rules-are-up-to-date: - node ./scripts/print-all-rules.js + node ./scripts/print-all-rules.mjs git status | grep "rules"; test $$? -eq 1 .PHONY: check-all-rules-are-considered check-all-rules-are-considered: - node ./scripts/check-all-rules-are-considered.js + node ./scripts/check-all-rules-are-considered.mjs diff --git a/scripts/check-all-rules-are-considered.js b/scripts/check-all-rules-are-considered.mjs similarity index 88% rename from scripts/check-all-rules-are-considered.js rename to scripts/check-all-rules-are-considered.mjs index dff5cf3..4fe197a 100644 --- a/scripts/check-all-rules-are-considered.js +++ b/scripts/check-all-rules-are-considered.mjs @@ -1,4 +1,4 @@ -const fs = require("fs"); +import fs from "fs"; function setDifference(a, b) { const diffArr = [...a].filter((element) => !b.has(element)); @@ -12,7 +12,9 @@ function setDifference(a, b) { const content = fs.readFileSync("rules/stylelint", { encoding: "utf8" }); const allRules = content.split("\n").filter((line) => line !== ""); - const consideredRules = Object.keys(require("../config/stylelint").rules); + const mod = await import("../config/stylelint.mjs"); + + const consideredRules = Object.keys(mod.default.rules); const allRulesSet = new Set(allRules); const consideredRulesSet = new Set(consideredRules); diff --git a/scripts/print-all-rules.js b/scripts/print-all-rules.mjs similarity index 76% rename from scripts/print-all-rules.js rename to scripts/print-all-rules.mjs index 7feb705..a22e59b 100644 --- a/scripts/print-all-rules.js +++ b/scripts/print-all-rules.mjs @@ -1,6 +1,6 @@ -const fs = require("fs"); +import fs from "fs"; -const stylelint = require("stylelint"); +import stylelint from "stylelint"; const ruleNames = Object.keys(stylelint.rules); ruleNames.sort((a, b) => a.localeCompare(b));