summaryrefslogtreecommitdiffstats
path: root/.eslintrc.js
blob: 5da22e72d7046daa7e6f75ae8989a05914b05de0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
module.exports = {
    ignorePatterns: [
        "test/*.js",
        "server/modules/*",
        "src/util.js"
    ],
    root: true,
    env: {
        browser: true,
        commonjs: true,
        es2020: true,
        node: true,
    },
    extends: [
        "eslint:recommended",
        "plugin:vue/vue3-recommended",
        "plugin:jsdoc/recommended-error",
    ],
    parser: "vue-eslint-parser",
    parserOptions: {
        parser: "@typescript-eslint/parser",
        sourceType: "module",
        requireConfigFile: false,
    },
    plugins: [
        "jsdoc",
        "@typescript-eslint",
    ],
    rules: {
        "yoda": "error",
        eqeqeq: [ "warn", "smart" ],
        "linebreak-style": [ "error", "unix" ],
        "camelcase": [ "warn", {
            "properties": "never",
            "ignoreImports": true
        }],
        "no-unused-vars": [ "warn", {
            "args": "none"
        }],
        indent: [
            "error",
            4,
            {
                ignoredNodes: [ "TemplateLiteral" ],
                SwitchCase: 1,
            },
        ],
        quotes: [ "error", "double" ],
        semi: "error",
        "vue/html-indent": [ "error", 4 ], // default: 2
        "vue/max-attributes-per-line": "off",
        "vue/singleline-html-element-content-newline": "off",
        "vue/html-self-closing": "off",
        "vue/require-component-is": "off",      // not allow is="style" https://github.com/vuejs/eslint-plugin-vue/issues/462#issuecomment-430234675
        "vue/attribute-hyphenation": "off",     // This change noNL to "no-n-l" unexpectedly
        "vue/multi-word-component-names": "off",
        "no-multi-spaces": [ "error", {
            ignoreEOLComments: true,
        }],
        "array-bracket-spacing": [ "warn", "always", {
            "singleValue": true,
            "objectsInArrays": false,
            "arraysInArrays": false
        }],
        "space-before-function-paren": [ "error", {
            "anonymous": "always",
            "named": "never",
            "asyncArrow": "always"
        }],
        "curly": "error",
        "object-curly-spacing": [ "error", "always" ],
        "object-curly-newline": "off",
        "object-property-newline": "error",
        "comma-spacing": "error",
        "brace-style": "error",
        "no-var": "error",
        "key-spacing": "warn",
        "keyword-spacing": "warn",
        "space-infix-ops": "error",
        "arrow-spacing": "warn",
        "no-trailing-spaces": "error",
        "no-constant-condition": [ "error", {
            "checkLoops": false,
        }],
        "space-before-blocks": "warn",
        //"no-console": "warn",
        "no-extra-boolean-cast": "off",
        "no-multiple-empty-lines": [ "warn", {
            "max": 1,
            "maxBOF": 0,
        }],
        "lines-between-class-members": [ "warn", "always", {
            exceptAfterSingleLine: true,
        }],
        "no-unneeded-ternary": "error",
        "array-bracket-newline": [ "error", "consistent" ],
        "eol-last": [ "error", "always" ],
        //"prefer-template": "error",
        "template-curly-spacing": [ "warn", "never" ],
        "comma-dangle": [ "warn", "only-multiline" ],
        "no-empty": [ "error", {
            "allowEmptyCatch": true
        }],
        "no-control-regex": "off",
        "one-var": [ "error", "never" ],
        "max-statements-per-line": [ "error", { "max": 1 }],
        "jsdoc/check-tag-names": [
            "error",
            {
                "definedTags": [ "link" ]
            }
        ],
        "jsdoc/no-undefined-types": "off",
        "jsdoc/no-defaults": [
            "error",
            { "noOptionalParamNames": true }
        ],
        "jsdoc/require-throws": "warn",
        "jsdoc/require-jsdoc": [
            "error",
            {
                "require": {
                    "FunctionDeclaration": true,
                    "MethodDefinition": true,
                }
            }
        ],
        "jsdoc/no-blank-block-descriptions": "error",
        "jsdoc/require-returns-description": "warn",
        "jsdoc/require-returns-check": [
            "error",
            { "reportMissingReturnForUndefinedTypes": false }
        ],
        "jsdoc/require-returns": [
            "warn",
            {
                "forceRequireReturn": true,
                "forceReturnsWithAsync": true
            }
        ],
        "jsdoc/require-param-type": "warn",
        "jsdoc/require-param-description": "warn"
    },
    "overrides": [
        {
            "files": [ "src/languages/*.js", "src/icon.js" ],
            "rules": {
                "comma-dangle": [ "error", "always-multiline" ],
            }
        },

        // Override for TypeScript
        {
            "files": [
                "**/*.ts",
            ],
            extends: [
                "plugin:@typescript-eslint/recommended",
            ],
            "rules": {
                "jsdoc/require-returns-type": "off",
                "jsdoc/require-param-type": "off",
                "@typescript-eslint/no-explicit-any": "off",
                "prefer-const": "off",
            }
        }
    ]
};