From 07768c3a88e2b139ae37210b662a44ea2aeeac0b Mon Sep 17 00:00:00 2001 From: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com> Date: Sun, 1 Dec 2024 15:26:23 +0100 Subject: [PATCH] Reactivate eslint-plugin-package-json (#3643) Somehow the plugin get lost when we moved to ESLint flat config. Now I reactivated it. One rules caused sorting the scripts. If this is not okay, I can undo this and switch off the rule. Thank's @bugsounet for the pinging in https://github.com/MagicMirrorOrg/MagicMirror/pull/3637#issuecomment-2509771362. --- CHANGELOG.md | 9 +++++---- eslint.config.mjs | 3 +++ package.json | 34 +++++++++++++++++----------------- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61f2416109..62d02f6179 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,11 +14,12 @@ _This release is scheduled to be released on 2025-01-01._ ### Added - [core] Add wayland and windows start options to `package.json` (#3594) -- [linter] re-added `eslint-plugin-import`now that it supports ESLint v9 (#3586) -- [docs] Added step for npm publishing in release process (#3595) -- [core] Add GitHub workflow to run spellcheck a few days before each release. +- [docs] Add step for npm publishing in release process (#3595) +- [core] Add GitHub workflow to run spellcheck a few days before each release (#3623) - [core] Add intest flag to index.html to pass to module js for test mode detection (needed by #3630) -- [compliments] add support for refreshing remote compliments file, and testcases +- [compliments] add support for refreshing remote compliments file, and testcases (#3630) +- [linter] Re-add `eslint-plugin-import`now that it supports ESLint v9 (#3586) +- [linter] Re-activate `eslint-plugin-package-json` to lint `package.json` ### Removed diff --git a/eslint.config.mjs b/eslint.config.mjs index 54aad11a81..e8800a5144 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,12 +1,14 @@ import eslintPluginImport from "eslint-plugin-import"; import eslintPluginJest from "eslint-plugin-jest"; import eslintPluginJs from "@eslint/js"; +import eslintPluginPackageJson from "eslint-plugin-package-json/configs/recommended"; import eslintPluginStylistic from "@stylistic/eslint-plugin"; import globals from "globals"; const config = [ eslintPluginJs.configs.recommended, eslintPluginImport.flatConfigs.recommended, + eslintPluginPackageJson, { files: ["**/*.js"], languageOptions: { @@ -106,6 +108,7 @@ const config = [ "@stylistic/quote-props": ["error", "as-needed"], "func-style": "off", "import/namespace": "off", + "import/no-unresolved": "off", "max-lines-per-function": ["error", 100], "no-magic-numbers": "off", "one-var": "off", diff --git a/package.json b/package.json index 7bce12efcd..372b3196a4 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,18 @@ ], "main": "js/electron.js", "scripts": { + "config:check": "node js/check_config.js", + "install-fonts": "echo \"Installing fonts ...\n\" && cd fonts && npm install --loglevel=error --no-audit --no-fund --no-update-notifier", + "install-mm": "npm install --no-audit --no-fund --no-update-notifier --only=prod --omit=dev", + "install-mm:dev": "npm install --no-audit --no-fund --no-update-notifier", + "install-vendor": "echo \"Installing vendor files ...\n\" && cd vendor && npm install --loglevel=error --no-audit --no-fund --no-update-notifier", + "lint:css": "stylelint 'css/main.css' 'fonts/*.css' 'modules/default/**/*.css' 'vendor/*.css' --config .stylelintrc.json --fix", + "lint:js": "eslint . --fix", + "lint:prettier": "prettier . --write", + "lint:staged": "lint-staged", + "postinstall": "npm run install-vendor && npm run install-fonts && echo \"MagicMirror² installation finished successfully! \n\"", + "prepare": "[ -f node_modules/.bin/husky ] && husky || echo no husky installed.", + "server": "node ./serveronly", "start": "npm run start:x11", "start:dev": "npm run start -- dev", "start:wayland": "WAYLAND_DISPLAY=\"${WAYLAND_DISPLAY:=wayland-1}\" ./node_modules/.bin/electron js/electron.js --enable-features=UseOzonePlatform --ozone-platform=wayland", @@ -32,28 +44,16 @@ "start:windows:dev": "npm run start:windows -- dev", "start:x11": "DISPLAY=\"${DISPLAY:=:0}\" ./node_modules/.bin/electron js/electron.js", "start:x11:dev": "npm run start -- dev", - "server": "node ./serveronly", - "install-mm": "npm install --no-audit --no-fund --no-update-notifier --only=prod --omit=dev", - "install-mm:dev": "npm install --no-audit --no-fund --no-update-notifier", - "install-vendor": "echo \"Installing vendor files ...\n\" && cd vendor && npm install --loglevel=error --no-audit --no-fund --no-update-notifier", - "install-fonts": "echo \"Installing fonts ...\n\" && cd fonts && npm install --loglevel=error --no-audit --no-fund --no-update-notifier", - "postinstall": "npm run install-vendor && npm run install-fonts && echo \"MagicMirror² installation finished successfully! \n\"", "test": "NODE_ENV=test jest -i --forceExit", + "test:calendar": "node ./modules/default/calendar/debug.js", "test:coverage": "NODE_ENV=test jest --coverage -i --verbose false --forceExit", - "test:electron": "NODE_ENV=test jest --selectProjects electron -i --forceExit", + "test:css": "stylelint 'css/main.css' 'fonts/*.css' 'modules/default/**/*.css' 'vendor/*.css' --config .stylelintrc.json", "test:e2e": "NODE_ENV=test jest --selectProjects e2e -i --forceExit", - "test:unit": "NODE_ENV=test jest --selectProjects unit", - "test:prettier": "prettier . --check", + "test:electron": "NODE_ENV=test jest --selectProjects electron -i --forceExit", "test:js": "eslint .", - "test:css": "stylelint 'css/main.css' 'fonts/*.css' 'modules/default/**/*.css' 'vendor/*.css' --config .stylelintrc.json", - "test:calendar": "node ./modules/default/calendar/debug.js", + "test:prettier": "prettier . --check", "test:spelling": "cspell . --gitignore", - "config:check": "node js/check_config.js", - "lint:prettier": "prettier . --write", - "lint:js": "eslint . --fix", - "lint:css": "stylelint 'css/main.css' 'fonts/*.css' 'modules/default/**/*.css' 'vendor/*.css' --config .stylelintrc.json --fix", - "lint:staged": "lint-staged", - "prepare": "[ -f node_modules/.bin/husky ] && husky || echo no husky installed." + "test:unit": "NODE_ENV=test jest --selectProjects unit" }, "lint-staged": { "*": "prettier --write",