1
Fork 0

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,
"extends": "eslint:recommended",
"extends": [
"eslint:recommended",
"plugin:jsonc/recommended-with-json"
],
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "script",
@ -17,7 +20,8 @@
"plugins": [
"no-unsanitized",
"header",
"jsdoc"
"jsdoc",
"jsonc"
],
"ignorePatterns": [
"/ext/lib/"
@ -61,7 +65,7 @@
"array-bracket-spacing": ["error", "never"],
"arrow-spacing": ["error", {"before": true, "after": true}],
"block-spacing": ["error", "always"],
"comma-spacing": ["error", { "before": false, "after": true }],
"comma-spacing": ["error", {"before": false, "after": true}],
"computed-property-spacing": ["error", "never"],
"func-call-spacing": ["error", "never"],
"function-paren-newline": ["error", "multiline-arguments"],
@ -123,26 +127,68 @@
"jsdoc/tag-lines": "error",
"jsdoc/valid-types": "error",
"header/header": ["error", "block", [
"",
{"pattern": " \\* Copyright \\(C\\) (\\d+-)?2022 Yomichan Authors"},
" *",
" * This program is free software: you can redistribute it and/or modify",
" * it under the terms of the GNU General Public License as published by",
" * the Free Software Foundation, either version 3 of the License, or",
" * (at your option) any later version.",
" *",
" * This program is distributed in the hope that it will be useful,",
" * but WITHOUT ANY WARRANTY; without even the implied warranty of",
" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
" * GNU General Public License for more details.",
" *",
" * You should have received a copy of the GNU General Public License",
" * along with this program. If not, see <https://www.gnu.org/licenses/>.",
" "
]]
"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", [
"",
{"pattern": " \\* Copyright \\(C\\) (\\d+-)?2022 Yomichan Authors"},
" *",
" * This program is free software: you can redistribute it and/or modify",
" * it under the terms of the GNU General Public License as published by",
" * the Free Software Foundation, either version 3 of the License, or",
" * (at your option) any later version.",
" *",
" * This program is distributed in the hope that it will be useful,",
" * but WITHOUT ANY WARRANTY; without even the implied warranty of",
" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
" * GNU General Public License for more details.",
" *",
" * You should have received a copy of the GNU General Public License",
" * along with this program. If not, see <https://www.gnu.org/licenses/>.",
" "
]]
}
},
{
"files": [
"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-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>
<!-- [html-validate-disable element-required-ancestor] -->
<template id="kanji-reading-template"><dd class="kanji-reading"></dd></template>
<!-- [html-validate-enable element-required-ancestor] -->
<!-- Tag templates -->
<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",
"browserify": "^17.0.0",
"css": "^3.0.0",
"eslint": "^8.15.0",
"eslint": "^8.25.0",
"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",
"fake-indexeddb": "^3.1.7",
"html-validate": "^7.1.0",
"html-validate": "^7.6.0",
"jsdom": "^19.0.0",
"parse5": "^7.0.0",
"stylelint": "^14.8.2",
"stylelint-config-recommended": "^7.0.0",
"stylelint": "^14.14.0",
"stylelint-config-recommended": "^9.0.0",
"web-ext": "^6.8.0"
}
}