From 2850e14172133d76737cdcf6f36e8d5f36c12d5f Mon Sep 17 00:00:00 2001 From: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com> Date: Sat, 9 May 2026 12:01:18 +0200 Subject: [PATCH] Unify linting: replace Stylelint and markdownlint with ESLint (#4148) We were running three separate lint tools (ESLint, Stylelint, markdownlint-cli2) and a separate Prettier step. This PR consolidates everything: `@eslint/css` and `@eslint/markdown` bring CSS and Markdown linting into ESLint, so one tool now covers JS, CSS, and Markdown. The Prettier step got merged into the lint scripts too, so there's now just `test:lint` to check things and `lint:fix` to fix them. Outcome: fewer tools to maintain, simpler/fewer scripts, fewer config files. As a side effect, the dependabot alerts https://github.com/MagicMirrorOrg/MagicMirror/security/dependabot/140 and https://github.com/MagicMirrorOrg/MagicMirror/security/dependabot/141 are resolved, as we no longer use the vulnerable `fast-uri` package (which was a dependency of `stylelint`). --- .github/CONTRIBUTING.md | 24 +- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .github/workflows/automated-tests.yaml | 5 +- .markdownlint.json | 6 - cspell.config.json | 1 - eslint.config.mjs | 21 + package-lock.json | 2354 +++++++----------------- package.json | 23 +- prettier.config.mjs | 6 - stylelint.config.mjs | 7 - 10 files changed, 743 insertions(+), 1706 deletions(-) delete mode 100644 .markdownlint.json delete mode 100644 stylelint.config.mjs diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 2f22cbf2..00c515e4 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -8,25 +8,10 @@ We hold our code to standard, and these standards are documented below. We use [prettier](https://prettier.io/) for automatic formatting a lot all our files. The configuration is in our `prettier.config.mjs` file. -To run prettier, use `node --run lint:prettier`. +And we use [ESLint](https://eslint.org) to lint our JavaScript, Markdown, and CSS files. The configuration is in our `eslint.config.mjs` file. -### JavaScript: Run ESLint - -We use [ESLint](https://eslint.org) to lint our JavaScript files. The configuration is in our `eslint.config.mjs` file. - -To run ESLint, use `node --run lint:js`. - -### CSS: Run StyleLint - -We use [StyleLint](https://stylelint.io) to lint our CSS. The configuration is in our `stylelint.config.mjs` file. - -To run StyleLint, use `node --run lint:css`. - -### Markdown: Run markdownlint - -We use [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) to lint our markdown files. The configuration is in our `.markdownlint.json` file. - -To run markdownlint, use `node --run lint:markdown`. +To check for formatting and linting errors, use `node --run test:lint` +To fix formatting and linting errors, use `node --run lint:fix`. ## Testing @@ -43,6 +28,7 @@ The `package.json` scripts expose finer-grained test commands: - `test:watch` – keep Vitest in watch mode for fast local feedback - `test:ui` – open the Vitest UI dashboard (needs OS file-watch support enabled) - `test:calendar` – run the legacy calendar debug helper -- `test:css`, `test:markdown`, `test:prettier`, `test:spelling`, `test:js` – lint-only scripts that enforce formatting, spelling, markdown style, and ESLint. +- `test:lint` – run linter and formatter checks +- `test:spelling` – run the spell checker You can invoke any script with `node --run