mirror of
https://github.com/MichMich/MagicMirror.git
synced 2026-07-06 06:12:26 -07:00
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`).
This commit is contained in:
committed by
GitHub
parent
67db41cfcb
commit
2850e14172
+5
-19
@@ -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 <script>` (or `npm run <script>`). Individual files can still be targeted directly, e.g. `npx vitest run tests/e2e/env_spec.js`.
|
||||
|
||||
@@ -10,7 +10,7 @@ Hello and thank you for wanting to contribute to the MagicMirror² project!
|
||||
> - What does the pull request accomplish? Use a list if needed.
|
||||
> - If it includes major visual changes please add screenshots.
|
||||
>
|
||||
> 3. Please run `node --run lint:prettier` before submitting so that
|
||||
> 3. Please run `node --run lint:fix` before submitting so that
|
||||
> style issues are fixed.
|
||||
|
||||
**Note**: Sometimes the development moves very fast. It is highly
|
||||
|
||||
@@ -33,10 +33,7 @@ jobs:
|
||||
node --run install-mm:dev
|
||||
- name: "Run linter tests"
|
||||
run: |
|
||||
node --run test:prettier
|
||||
node --run test:js
|
||||
node --run test:css
|
||||
node --run test:markdown
|
||||
node --run test:lint
|
||||
test:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 30
|
||||
|
||||
Reference in New Issue
Block a user