eslint: (Mostly) synchronize configuration with gjs

In addition to the changes in this commit, gjs now
restricts the use of the Format module and initFormat.
We can't really replace those for translatable strings
until xgettext gains support for template strings, so
leave that bit out for now.

The other notable change is that gjs now requires
jsdoc comments. We can't plainly enable those options
without a massive amount of work first, but let's see
how requiring doc comments for new code goes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1949>
This commit is contained in:
Florian Müllner 2021-08-12 17:12:15 +02:00 committed by Marge Bot
parent a802bfda39
commit bf5129adc1
2 changed files with 37 additions and 3 deletions

View File

@ -1,8 +1,12 @@
--- ---
# SPDX-License-Identifier: MIT OR LGPL-2.0-or-later # SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
# SPDX-FileCopyrightText: 2018 Claudio André <claudioandre.br@gmail.com>
env: env:
es6: true es6: true
es2020: true
extends: 'eslint:recommended' extends: 'eslint:recommended'
plugins:
- jsdoc
rules: rules:
array-bracket-newline: array-bracket-newline:
- error - error
@ -60,6 +64,17 @@ rules:
- 'CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child' - 'CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child'
# Allow dedenting chained member expressions # Allow dedenting chained member expressions
MemberExpression: 'off' MemberExpression: 'off'
jsdoc/check-alignment: error
jsdoc/check-param-names: error
jsdoc/check-tag-names: error
jsdoc/check-types: error
jsdoc/implements-on-classes: error
jsdoc/newline-after-description: error
jsdoc/require-jsdoc: error
jsdoc/require-param: error
jsdoc/require-param-description: error
jsdoc/require-param-name: error
jsdoc/require-param-type: error
key-spacing: key-spacing:
- error - error
- beforeColon: false - beforeColon: false
@ -107,6 +122,7 @@ rules:
no-octal-escape: error no-octal-escape: error
no-proto: error no-proto: error
no-prototype-builtins: 'off' no-prototype-builtins: 'off'
no-restricted-globals: [error, window]
no-restricted-properties: no-restricted-properties:
- error - error
- object: Lang - object: Lang
@ -167,6 +183,7 @@ rules:
object-curly-newline: object-curly-newline:
- error - error
- consistent: true - consistent: true
multiline: true
object-curly-spacing: error object-curly-spacing: error
object-shorthand: error object-shorthand: error
operator-assignment: error operator-assignment: error
@ -214,14 +231,14 @@ rules:
template-curly-spacing: error template-curly-spacing: error
template-tag-spacing: error template-tag-spacing: error
unicode-bom: error unicode-bom: error
valid-jsdoc:
- error
- requireReturn: false
wrap-iife: wrap-iife:
- error - error
- inside - inside
yield-star-spacing: error yield-star-spacing: error
yoda: error yoda: error
settings:
jsdoc:
mode: typescript
globals: globals:
ARGV: readonly ARGV: readonly
Debugger: readonly Debugger: readonly
@ -233,5 +250,8 @@ globals:
logError: readonly logError: readonly
print: readonly print: readonly
printerr: readonly printerr: readonly
window: readonly
TextEncoder: readonly
TextDecoder: readonly
parserOptions: parserOptions:
ecmaVersion: 2020 ecmaVersion: 2020

View File

@ -10,5 +10,19 @@ rules:
ArrayExpression: first ArrayExpression: first
ObjectExpression: first ObjectExpression: first
MemberExpression: off MemberExpression: off
jsdoc/check-alignment: off
jsdoc/check-param-names: off
jsdoc/check-tag-names: off
jsdoc/check-types: off
jsdoc/implements-on-classes: off
jsdoc/newline-after-description: off
jsdoc/require-jsdoc: off
jsdoc/require-param: off
jsdoc/require-param-description: off
jsdoc/require-param-name: off
jsdoc/require-param-type: off
object-curly-newline:
- error
- consistent: true
prefer-template: off prefer-template: off
quotes: off quotes: off