Lint updates (#2247)

* Fix spacing

* Update lint dependencies

* Disable false positive rule

* Update header rule

* Install eslint-plugin-jsonc

* Update lint rules to include jsonc extension
This commit is contained in:
toasted-nutbread 2022-10-15 13:09:02 -04:00 committed by GitHub
parent 5e707248ce
commit 441b6882ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 549 additions and 322 deletions

View File

@ -1,6 +1,9 @@
{ {
"root": true, "root": true,
"extends": "eslint:recommended", "extends": [
"eslint:recommended",
"plugin:jsonc/recommended-with-json"
],
"parserOptions": { "parserOptions": {
"ecmaVersion": 8, "ecmaVersion": 8,
"sourceType": "script", "sourceType": "script",
@ -17,7 +20,8 @@
"plugins": [ "plugins": [
"no-unsanitized", "no-unsanitized",
"header", "header",
"jsdoc" "jsdoc",
"jsonc"
], ],
"ignorePatterns": [ "ignorePatterns": [
"/ext/lib/" "/ext/lib/"
@ -61,7 +65,7 @@
"array-bracket-spacing": ["error", "never"], "array-bracket-spacing": ["error", "never"],
"arrow-spacing": ["error", {"before": true, "after": true}], "arrow-spacing": ["error", {"before": true, "after": true}],
"block-spacing": ["error", "always"], "block-spacing": ["error", "always"],
"comma-spacing": ["error", { "before": false, "after": true }], "comma-spacing": ["error", {"before": false, "after": true}],
"computed-property-spacing": ["error", "never"], "computed-property-spacing": ["error", "never"],
"func-call-spacing": ["error", "never"], "func-call-spacing": ["error", "never"],
"function-paren-newline": ["error", "multiline-arguments"], "function-paren-newline": ["error", "multiline-arguments"],
@ -123,6 +127,48 @@
"jsdoc/tag-lines": "error", "jsdoc/tag-lines": "error",
"jsdoc/valid-types": "error", "jsdoc/valid-types": "error",
"jsonc/indent": ["error", 4],
"jsonc/array-bracket-newline": ["error", "consistent"],
"jsonc/array-bracket-spacing": ["error", "never"],
"jsonc/array-element-newline": ["error", "consistent"],
"jsonc/comma-style": ["error", "last"],
"jsonc/key-spacing": ["error", {"beforeColon": false, "afterColon": true, "mode": "strict"}],
"jsonc/no-octal-escape": "error",
"jsonc/object-curly-newline": ["error", {"consistent": true}],
"jsonc/object-curly-spacing": ["error", "never"],
"jsonc/object-property-newline": ["error", {"allowAllPropertiesOnSameLine": true}]
},
"overrides": [
{
"files": [
"*.json"
],
"parser": "jsonc-eslint-parser"
},
{
"files": [
"test/data/anki-note-builder-test-results.json",
"test/data/translator-test-results-note-data1.json",
"test/data/translator-test-results.json"
],
"rules": {
"jsonc/indent": ["error", 2]
}
},
{
"files": [
"test/data/dictionaries/valid-dictionary1/term_bank_1.json"
],
"rules": {
"jsonc/array-element-newline": ["off"],
"jsonc/object-property-newline": ["off"]
}
},
{
"files": [
"*.js"
],
"rules": {
"header/header": ["error", "block", [ "header/header": ["error", "block", [
"", "",
{"pattern": " \\* Copyright \\(C\\) (\\d+-)?2022 Yomichan Authors"}, {"pattern": " \\* Copyright \\(C\\) (\\d+-)?2022 Yomichan Authors"},
@ -141,8 +187,8 @@
" * along with this program. If not, see <https://www.gnu.org/licenses/>.", " * along with this program. If not, see <https://www.gnu.org/licenses/>.",
" " " "
]] ]]
}
}, },
"overrides": [
{ {
"files": [ "files": [
"ext/js/core.js", "ext/js/core.js",

View File

@ -157,7 +157,9 @@
<template id="kanji-info-table-item-template"><tr class="kanji-info-table-item"><th class="kanji-info-table-item-header"></th><td class="kanji-info-table-item-value"></td></tr></template> <template id="kanji-info-table-item-template"><tr class="kanji-info-table-item"><th class="kanji-info-table-item-header"></th><td class="kanji-info-table-item-value"></td></tr></template>
<template id="kanji-info-table-empty-template"><tr class="kanji-info-table-item kanji-info-table-item-empty"><td class="kanji-info-table-item-value-empty">No data found</td></tr></template> <template id="kanji-info-table-empty-template"><tr class="kanji-info-table-item kanji-info-table-item-empty"><td class="kanji-info-table-item-value-empty">No data found</td></tr></template>
<template id="kanji-gloss-item-template"><li class="kanji-gloss-item"><span class="kanji-gloss-content"></span></li></template> <template id="kanji-gloss-item-template"><li class="kanji-gloss-item"><span class="kanji-gloss-content"></span></li></template>
<!-- [html-validate-disable element-required-ancestor] -->
<template id="kanji-reading-template"><dd class="kanji-reading"></dd></template> <template id="kanji-reading-template"><dd class="kanji-reading"></dd></template>
<!-- [html-validate-enable element-required-ancestor] -->
<!-- Tag templates --> <!-- Tag templates -->
<template id="tag-template"><span class="tag"><span class="tag-label"><span class="tag-label-content"></span></span></span></template> <template id="tag-template"><span class="tag"><span class="tag-label"><span class="tag-label-content"></span></span></span></template>

770
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -39,16 +39,17 @@
"ajv": "^8.11.0", "ajv": "^8.11.0",
"browserify": "^17.0.0", "browserify": "^17.0.0",
"css": "^3.0.0", "css": "^3.0.0",
"eslint": "^8.15.0", "eslint": "^8.25.0",
"eslint-plugin-header": "^3.1.1", "eslint-plugin-header": "^3.1.1",
"eslint-plugin-jsdoc": "^39.2.9", "eslint-plugin-jsdoc": "^39.3.6",
"eslint-plugin-jsonc": "^2.4.0",
"eslint-plugin-no-unsanitized": "^4.0.1", "eslint-plugin-no-unsanitized": "^4.0.1",
"fake-indexeddb": "^3.1.7", "fake-indexeddb": "^3.1.7",
"html-validate": "^7.1.0", "html-validate": "^7.6.0",
"jsdom": "^19.0.0", "jsdom": "^19.0.0",
"parse5": "^7.0.0", "parse5": "^7.0.0",
"stylelint": "^14.8.2", "stylelint": "^14.14.0",
"stylelint-config-recommended": "^7.0.0", "stylelint-config-recommended": "^9.0.0",
"web-ext": "^6.8.0" "web-ext": "^6.8.0"
} }
} }