Add support for linting of JSON files

This commit is contained in:
Tom Hughes 2025-03-09 11:09:02 +00:00
parent f4009e32da
commit 2950468380
3 changed files with 37 additions and 3 deletions

View file

@ -2,9 +2,9 @@ import globals from "globals";
import js from "@eslint/js";
import erb from "eslint-plugin-erb";
import stylisticJs from "@stylistic/eslint-plugin-js";
import json from "@eslint/json";
export default [
js.configs.recommended,
erb.configs.recommended,
{
ignores: [
@ -18,6 +18,7 @@ export default [
plugins: {
"@stylistic": stylisticJs
},
ignores: ["**/*.json"],
languageOptions: {
ecmaVersion: 2021,
sourceType: "script",
@ -44,6 +45,7 @@ export default [
reportUnusedDisableDirectives: "off"
},
rules: {
...js.configs.recommended.rules,
"@stylistic/array-bracket-newline": ["error", "consistent"],
"@stylistic/array-bracket-spacing": "error",
"@stylistic/block-spacing": "error",
@ -169,7 +171,16 @@ export default [
sourceType: "module"
},
rules: {
"sort-keys": ["error", "asc", { minKeys: 5 }]
"sort-keys": ["error", "asc", { minKeys: 6 }]
}
},
{
plugins: {
json: json
},
files: ["**/*.json"],
ignores: ["package-lock.json"],
language: "json/json",
...json.configs.recommended
}
];

View file

@ -10,6 +10,7 @@
"osm-community-index": "^5.2.0"
},
"devDependencies": {
"@eslint/json": "^0.10.0",
"@stylistic/eslint-plugin-js": "^4.0.0",
"@types/jquery": "^3.5.0",
"@types/leaflet": "^1.9.0",

View file

@ -33,6 +33,13 @@
resolved "https://registry.yarnpkg.com/@eslint/config-helpers/-/config-helpers-0.1.0.tgz#62f1b7821e9d9ced1b3f512c7ea731825765d1cc"
integrity sha512-kLrdPDJE1ckPo94kmPPf9Hfd0DU0Jw6oKYrhe+pwSC0iTUInmTa+w6fw8sGgcfkFJGNdWOUeOaDM4quW4a7OkA==
"@eslint/core@^0.10.0":
version "0.10.0"
resolved "https://registry.yarnpkg.com/@eslint/core/-/core-0.10.0.tgz#23727063c21b335f752dbb3a16450f6f9cbc9091"
integrity sha512-gFHJ+xBOo4G3WRlR1e/3G8A6/KZAH6zcE/hkLRCZTi/B9avAG365QhFA8uOGzTMqgTghpn7/fSnscW++dpMSAw==
dependencies:
"@types/json-schema" "^7.0.15"
"@eslint/core@^0.12.0":
version "0.12.0"
resolved "https://registry.yarnpkg.com/@eslint/core/-/core-0.12.0.tgz#5f960c3d57728be9f6c65bd84aa6aa613078798e"
@ -60,12 +67,22 @@
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.22.0.tgz#4ff53649ded7cbce90b444b494c234137fa1aa3d"
integrity sha512-vLFajx9o8d1/oL2ZkpMYbkLv8nDB6yaIwFNt7nI4+I80U/z03SxmfOMsLbvWr3p7C+Wnoh//aOu2pQW8cS0HCQ==
"@eslint/json@^0.10.0":
version "0.10.0"
resolved "https://registry.yarnpkg.com/@eslint/json/-/json-0.10.0.tgz#35ca1d731a4e75f70db48d0f25dfef107568d38e"
integrity sha512-aW0181XofoAwuB0sI263bhwnvAlb6OGnGGxHjTZQNLFErfsAXCnwRD+Uxx6/pK73XtKuQ2w1wbhiTJ2BC/erAQ==
dependencies:
"@eslint/core" "^0.10.0"
"@eslint/plugin-kit" "^0.2.5"
"@humanwhocodes/momoa" "^3.3.4"
natural-compare "^1.4.0"
"@eslint/object-schema@^2.1.6":
version "2.1.6"
resolved "https://registry.yarnpkg.com/@eslint/object-schema/-/object-schema-2.1.6.tgz#58369ab5b5b3ca117880c0f6c0b0f32f6950f24f"
integrity sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==
"@eslint/plugin-kit@^0.2.7":
"@eslint/plugin-kit@^0.2.5", "@eslint/plugin-kit@^0.2.7":
version "0.2.7"
resolved "https://registry.yarnpkg.com/@eslint/plugin-kit/-/plugin-kit-0.2.7.tgz#9901d52c136fb8f375906a73dcc382646c3b6a27"
integrity sha512-JubJ5B2pJ4k4yGxaNLdbjrnk9d/iDz6/q8wOilpIowd6PJPgaxCuHBnBszq7Ce2TyMrywm5r4PnKm6V3iiZF+g==
@ -91,6 +108,11 @@
resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c"
integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==
"@humanwhocodes/momoa@^3.3.4":
version "3.3.8"
resolved "https://registry.yarnpkg.com/@humanwhocodes/momoa/-/momoa-3.3.8.tgz#b00630bf689b6f758419c029e15a4be25c12179b"
integrity sha512-/3PZzor2imi/RLLcnHztkwA79txiVvW145Ve2cp5dxRcH5qOUNJPToasqLFHniTfw4B4lT7jGDdBOPXbXYlIMQ==
"@humanwhocodes/retry@^0.3.0":
version "0.3.1"
resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.3.1.tgz#c72a5c76a9fbaf3488e231b13dc52c0da7bab42a"