|
| 1 | +--- |
| 2 | +# SPDX-License-Identifier: MIT OR LGPL-2.0-or-later |
| 3 | +# SPDX-FileCopyrightText: 2018 Claudio André <[email protected]> |
| 4 | +# https://gitlab.gnome.org/GNOME/gjs/-/blob/HEAD/.eslintrc.yml |
| 5 | +env: |
| 6 | + es2021: true |
| 7 | +extends: 'eslint:recommended' |
| 8 | +plugins: |
| 9 | + - jsdoc |
| 10 | +rules: |
| 11 | + array-bracket-newline: |
| 12 | + - error |
| 13 | + - consistent |
| 14 | + array-bracket-spacing: |
| 15 | + - error |
| 16 | + - never |
| 17 | + array-callback-return: error |
| 18 | + arrow-parens: |
| 19 | + - error |
| 20 | + - as-needed |
| 21 | + arrow-spacing: error |
| 22 | + block-scoped-var: error |
| 23 | + block-spacing: error |
| 24 | + brace-style: error |
| 25 | + # Waiting for this to have matured a bit in eslint |
| 26 | + # camelcase: |
| 27 | + # - error |
| 28 | + # - properties: never |
| 29 | + # allow: [^vfunc_, ^on_, _instance_init] |
| 30 | + comma-dangle: |
| 31 | + - error |
| 32 | + - arrays: always-multiline |
| 33 | + objects: always-multiline |
| 34 | + functions: never |
| 35 | + comma-spacing: |
| 36 | + - error |
| 37 | + - before: false |
| 38 | + after: true |
| 39 | + comma-style: |
| 40 | + - error |
| 41 | + - last |
| 42 | + computed-property-spacing: error |
| 43 | + curly: |
| 44 | + - error |
| 45 | + - multi-or-nest |
| 46 | + - consistent |
| 47 | + dot-location: |
| 48 | + - error |
| 49 | + - property |
| 50 | + eol-last: error |
| 51 | + eqeqeq: error |
| 52 | + func-call-spacing: error |
| 53 | + func-name-matching: error |
| 54 | + func-style: |
| 55 | + - error |
| 56 | + - declaration |
| 57 | + - allowArrowFunctions: true |
| 58 | + indent: |
| 59 | + - error |
| 60 | + - 4 |
| 61 | + - ignoredNodes: |
| 62 | + # Allow not indenting the body of GObject.registerClass, since in the |
| 63 | + # future it's intended to be a decorator |
| 64 | + - 'CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child' |
| 65 | + # Allow dedenting chained member expressions |
| 66 | + MemberExpression: 'off' |
| 67 | + jsdoc/check-alignment: error |
| 68 | + jsdoc/check-param-names: error |
| 69 | + jsdoc/check-tag-names: error |
| 70 | + jsdoc/check-types: error |
| 71 | + jsdoc/implements-on-classes: error |
| 72 | + jsdoc/newline-after-description: error |
| 73 | + jsdoc/require-jsdoc: error |
| 74 | + jsdoc/require-param: error |
| 75 | + jsdoc/require-param-description: error |
| 76 | + jsdoc/require-param-name: error |
| 77 | + jsdoc/require-param-type: error |
| 78 | + key-spacing: |
| 79 | + - error |
| 80 | + - beforeColon: false |
| 81 | + afterColon: true |
| 82 | + keyword-spacing: |
| 83 | + - error |
| 84 | + - before: true |
| 85 | + after: true |
| 86 | + linebreak-style: |
| 87 | + - error |
| 88 | + - unix |
| 89 | + lines-between-class-members: |
| 90 | + - error |
| 91 | + - always |
| 92 | + - exceptAfterSingleLine: true |
| 93 | + max-nested-callbacks: error |
| 94 | + max-statements-per-line: error |
| 95 | + new-parens: error |
| 96 | + no-array-constructor: error |
| 97 | + no-await-in-loop: error |
| 98 | + no-caller: error |
| 99 | + no-constant-condition: |
| 100 | + - error |
| 101 | + - checkLoops: false |
| 102 | + no-div-regex: error |
| 103 | + no-empty: |
| 104 | + - error |
| 105 | + - allowEmptyCatch: true |
| 106 | + no-extra-bind: error |
| 107 | + no-extra-parens: |
| 108 | + - error |
| 109 | + - all |
| 110 | + - conditionalAssign: false |
| 111 | + nestedBinaryExpressions: false |
| 112 | + returnAssign: false |
| 113 | + no-implicit-coercion: |
| 114 | + - error |
| 115 | + - allow: |
| 116 | + - '!!' |
| 117 | + no-invalid-this: error |
| 118 | + no-iterator: error |
| 119 | + no-label-var: error |
| 120 | + no-lonely-if: error |
| 121 | + no-loop-func: error |
| 122 | + no-nested-ternary: error |
| 123 | + no-new-object: error |
| 124 | + no-new-wrappers: error |
| 125 | + no-octal-escape: error |
| 126 | + no-proto: error |
| 127 | + no-prototype-builtins: 'off' |
| 128 | + no-restricted-globals: [error, window] |
| 129 | + no-restricted-properties: |
| 130 | + - error |
| 131 | + - object: imports |
| 132 | + property: format |
| 133 | + message: Use template strings |
| 134 | + - object: pkg |
| 135 | + property: initFormat |
| 136 | + message: Use template strings |
| 137 | + - object: Lang |
| 138 | + property: copyProperties |
| 139 | + message: Use Object.assign() |
| 140 | + - object: Lang |
| 141 | + property: bind |
| 142 | + message: Use arrow notation or Function.prototype.bind() |
| 143 | + - object: Lang |
| 144 | + property: Class |
| 145 | + message: Use ES6 classes |
| 146 | + no-restricted-syntax: |
| 147 | + - error |
| 148 | + - selector: >- |
| 149 | + MethodDefinition[key.name="_init"] > |
| 150 | + FunctionExpression[params.length=1] > |
| 151 | + BlockStatement[body.length=1] |
| 152 | + CallExpression[arguments.length=1][callee.object.type="Super"][callee.property.name="_init"] > |
| 153 | + Identifier:first-child |
| 154 | + message: _init() that only calls super._init() is unnecessary |
| 155 | + - selector: >- |
| 156 | + MethodDefinition[key.name="_init"] > |
| 157 | + FunctionExpression[params.length=0] > |
| 158 | + BlockStatement[body.length=1] |
| 159 | + CallExpression[arguments.length=0][callee.object.type="Super"][callee.property.name="_init"] |
| 160 | + message: _init() that only calls super._init() is unnecessary |
| 161 | + - selector: BinaryExpression[operator="instanceof"][right.name="Array"] |
| 162 | + message: Use Array.isArray() |
| 163 | + no-return-assign: error |
| 164 | + no-return-await: error |
| 165 | + no-self-compare: error |
| 166 | + no-shadow: error |
| 167 | + no-shadow-restricted-names: error |
| 168 | + no-spaced-func: error |
| 169 | + no-tabs: error |
| 170 | + no-template-curly-in-string: error |
| 171 | + no-throw-literal: error |
| 172 | + no-trailing-spaces: error |
| 173 | + no-undef-init: error |
| 174 | + no-unneeded-ternary: error |
| 175 | + no-unused-expressions: error |
| 176 | + no-unused-vars: |
| 177 | + - error |
| 178 | + # Vars use a suffix _ instead of a prefix because of file-scope private vars |
| 179 | + - varsIgnorePattern: (^unused|_$) |
| 180 | + argsIgnorePattern: ^(unused|_) |
| 181 | + no-useless-call: error |
| 182 | + no-useless-computed-key: error |
| 183 | + no-useless-concat: error |
| 184 | + no-useless-constructor: error |
| 185 | + no-useless-rename: error |
| 186 | + no-useless-return: error |
| 187 | + no-whitespace-before-property: error |
| 188 | + no-with: error |
| 189 | + nonblock-statement-body-position: |
| 190 | + - error |
| 191 | + - below |
| 192 | + object-curly-newline: |
| 193 | + - error |
| 194 | + - consistent: true |
| 195 | + multiline: true |
| 196 | + object-curly-spacing: error |
| 197 | + object-shorthand: error |
| 198 | + operator-assignment: error |
| 199 | + operator-linebreak: error |
| 200 | + padded-blocks: |
| 201 | + - error |
| 202 | + - never |
| 203 | + # These may be a bit controversial, we can try them out and enable them later |
| 204 | + # prefer-const: error |
| 205 | + # prefer-destructuring: error |
| 206 | + prefer-numeric-literals: error |
| 207 | + prefer-promise-reject-errors: error |
| 208 | + prefer-rest-params: error |
| 209 | + prefer-spread: error |
| 210 | + prefer-template: error |
| 211 | + quotes: |
| 212 | + - error |
| 213 | + - single |
| 214 | + - avoidEscape: true |
| 215 | + require-await: error |
| 216 | + rest-spread-spacing: error |
| 217 | + semi: |
| 218 | + - error |
| 219 | + - always |
| 220 | + semi-spacing: |
| 221 | + - error |
| 222 | + - before: false |
| 223 | + after: true |
| 224 | + semi-style: error |
| 225 | + space-before-blocks: error |
| 226 | + space-before-function-paren: |
| 227 | + - error |
| 228 | + - named: never |
| 229 | + # for `function ()` and `async () =>`, preserve space around keywords |
| 230 | + anonymous: always |
| 231 | + asyncArrow: always |
| 232 | + space-in-parens: error |
| 233 | + space-infix-ops: |
| 234 | + - error |
| 235 | + - int32Hint: false |
| 236 | + space-unary-ops: error |
| 237 | + spaced-comment: error |
| 238 | + switch-colon-spacing: error |
| 239 | + symbol-description: error |
| 240 | + template-curly-spacing: error |
| 241 | + template-tag-spacing: error |
| 242 | + unicode-bom: error |
| 243 | + wrap-iife: |
| 244 | + - error |
| 245 | + - inside |
| 246 | + yield-star-spacing: error |
| 247 | + yoda: error |
| 248 | +settings: |
| 249 | + jsdoc: |
| 250 | + mode: typescript |
| 251 | +globals: |
| 252 | + ARGV: readonly |
| 253 | + Debugger: readonly |
| 254 | + GIRepositoryGType: readonly |
| 255 | + globalThis: readonly |
| 256 | + imports: readonly |
| 257 | + Intl: readonly |
| 258 | + log: readonly |
| 259 | + logError: readonly |
| 260 | + print: readonly |
| 261 | + printerr: readonly |
| 262 | + window: readonly |
| 263 | + TextEncoder: readonly |
| 264 | + TextDecoder: readonly |
| 265 | + console: readonly |
| 266 | + setTimeout: readonly |
| 267 | + setInterval: readonly |
| 268 | + clearTimeout: readonly |
| 269 | + clearInterval: readonly |
| 270 | +parserOptions: |
| 271 | + ecmaVersion: 2022 |
0 commit comments