aboutsummaryrefslogtreecommitdiff
path: root/.eslintrc.json
diff options
context:
space:
mode:
Diffstat (limited to '.eslintrc.json')
-rw-r--r--.eslintrc.json88
1 files changed, 67 insertions, 21 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
index ec1e0375..26355f22 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -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,28 +127,70 @@
"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",
"ext/js/**/sandbox/**/*.js"
],