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`).
1.4 KiB
Contribution Policy for MagicMirror²
Thanks for contributing to MagicMirror²!
We hold our code to standard, and these standards are documented below.
Linters
We use prettier for automatic formatting a lot all our files. The configuration is in our prettier.config.mjs file.
And we use ESLint to lint our JavaScript, Markdown, and CSS files. The configuration is in our eslint.config.mjs file.
To check for formatting and linting errors, use node --run test:lint
To fix formatting and linting errors, use node --run lint:fix.
Testing
We use Vitest for JavaScript testing.
To run all tests, use node --run test.
The package.json scripts expose finer-grained test commands:
test:unit– run unit tests onlytest:e2e– execute browser-driven end-to-end teststest:electron– launch the Electron-based regression suitetest:coverage– collect coverage while running every suitetest:watch– keep Vitest in watch mode for fast local feedbacktest:ui– open the Vitest UI dashboard (needs OS file-watch support enabled)test:calendar– run the legacy calendar debug helpertest:lint– run linter and formatter checkstest: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.