Add basic linting of JSON files using eslint-plugin-json

By adding basic linting of JSON files, we can ensure that they're actually valid and prevent e.g. test-failures caused by *accidental* errors when editing the `test/test_manifest.json` file (something that I've done *many* times myself).

For now this simply uses the `recommended` configuration, but we can obviously tweak this later if/when needed. Please find additional information at https://github.com/azeemba/eslint-plugin-json
This commit is contained in:
Jonas Jenwald 2021-06-15 11:59:47 +02:00
parent 246d565e3b
commit 1cfaf07b82
5 changed files with 59 additions and 2 deletions

View File

@ -6,6 +6,7 @@
"plugins": [
"import",
"json",
"mozilla",
"no-unsanitized",
"sort-exports",
@ -13,6 +14,7 @@
],
"extends": [
"plugin:json/recommended",
"plugin:prettier/recommended"
],

View File

@ -1742,7 +1742,7 @@ gulp.task("lint", function (done) {
const esLintOptions = [
"node_modules/eslint/bin/eslint",
"--ext",
".js,.jsm",
".js,.jsm,.json",
".",
"--report-unused-disable-directives",
];

54
package-lock.json generated
View File

@ -4905,6 +4905,16 @@
}
}
},
"eslint-plugin-json": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-json/-/eslint-plugin-json-3.0.0.tgz",
"integrity": "sha512-7qoY5pbzBLEttJWy4/cDtULK3EKglgIwfXk5Yqp3StJaQ4Bu4Jmp0n2fJN5vBe/hLGaECupq3edn1j/k7O0bFA==",
"dev": true,
"requires": {
"lodash": "^4.17.21",
"vscode-json-languageservice": "^4.0.2"
}
},
"eslint-plugin-mozilla": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-mozilla/-/eslint-plugin-mozilla-2.10.0.tgz",
@ -7885,6 +7895,12 @@
"minimist": "^1.2.5"
}
},
"jsonc-parser": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz",
"integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==",
"dev": true
},
"jsonify": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
@ -16580,6 +16596,44 @@
"integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=",
"dev": true
},
"vscode-json-languageservice": {
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-4.1.4.tgz",
"integrity": "sha512-/UqaE58BVFdePM9l971L6xPRLlCLNk01aovf1Pp9hB/8pytmd2s9ZNEnS1JqYyQEJ1k5/fEBsWOdhQlNo4H7VA==",
"dev": true,
"requires": {
"jsonc-parser": "^3.0.0",
"minimatch": "^3.0.4",
"vscode-languageserver-textdocument": "^1.0.1",
"vscode-languageserver-types": "^3.16.0",
"vscode-nls": "^5.0.0",
"vscode-uri": "^3.0.2"
}
},
"vscode-languageserver-textdocument": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz",
"integrity": "sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA==",
"dev": true
},
"vscode-languageserver-types": {
"version": "3.16.0",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz",
"integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==",
"dev": true
},
"vscode-nls": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.0.0.tgz",
"integrity": "sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==",
"dev": true
},
"vscode-uri": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.2.tgz",
"integrity": "sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA==",
"dev": true
},
"watchpack": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.2.0.tgz",

View File

@ -22,6 +22,7 @@
"eslint-plugin-fetch-options": "^0.0.5",
"eslint-plugin-html": "^6.1.2",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-json": "^3.0.0",
"eslint-plugin-mozilla": "^2.10.0",
"eslint-plugin-no-unsanitized": "^3.1.5",
"eslint-plugin-prettier": "^3.4.0",

View File

@ -22,5 +22,5 @@
},
"files": [
"main.ts"
],
]
}