From fcc253f37001652266213a4b1f5bdb79666a368a Mon Sep 17 00:00:00 2001 From: Daniel Sheeler Date: Thu, 23 May 2024 01:41:31 -0500 Subject: [PATCH 1/4] Add linting --- .editorconfig | 15 ++++ .eslint.config.js | 143 +++++++++++++++++++++++++++++++++++ .github/workflows/eslint.yml | 39 ++++++++++ package.json | 28 +++++++ 4 files changed, 225 insertions(+) create mode 100644 .editorconfig create mode 100644 .eslint.config.js create mode 100644 .github/workflows/eslint.yml create mode 100644 package.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..68e05a8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.js] +quote_type = single \ No newline at end of file diff --git a/.eslint.config.js b/.eslint.config.js new file mode 100644 index 0000000..4e78491 --- /dev/null +++ b/.eslint.config.js @@ -0,0 +1,143 @@ +// SPDX-License-Identifier: CC0-1.0 +// SPDX-FileCopyrightText: No rights reserved + +import js from '@eslint/js'; + +export default [ + js.configs.recommended, + { + languageOptions: { + globals: { + ARGV: 'readonly', + Debugger: 'readonly', + GIRepositoryGType: 'readonly', + globalThis: 'readonly', + imports: 'readonly', + Intl: 'readonly', + log: 'readonly', + logError: 'readonly', + pkg: 'readonly', + print: 'readonly', + printerr: 'readonly', + window: 'readonly', + TextEncoder: 'readonly', + TextDecoder: 'readonly', + console: 'readonly', + setTimeout: 'readonly', + setInterval: 'readonly', + clearTimeout: 'readonly', + clearInterval: 'readonly', + }, + parserOptions: { + ecmaVersion: 2022, + sourceType: 'module', + }, + }, + rules: { + // See: https://eslint.org/docs/latest/rules/#possible-problems + 'array-callback-return': 'error', + 'no-await-in-loop': 'error', + 'no-constant-binary-expression': 'error', + 'no-constructor-return': 'error', + 'no-new-native-nonconstructor': 'error', + 'no-promise-executor-return': 'error', + 'no-self-compare': 'error', + 'no-template-curly-in-string': 'error', + 'no-unmodified-loop-condition': 'error', + 'no-unreachable-loop': 'error', + 'no-unused-private-class-members': 'error', + 'no-use-before-define': [ + 'error', + { + functions: false, + classes: true, + variables: true, + allowNamedExports: true, + }, + ], + // See: https://eslint.org/docs/latest/rules/#suggestions + 'block-scoped-var': 'error', + 'complexity': 'warn', + 'consistent-return': 'error', + 'default-param-last': 'error', + 'eqeqeq': 'error', + 'no-array-constructor': 'error', + 'no-caller': 'error', + 'no-extend-native': 'error', + 'no-extra-bind': 'error', + 'no-extra-label': 'error', + 'no-iterator': 'error', + 'no-label-var': 'error', + 'no-loop-func': 'error', + 'no-multi-assign': 'warn', + 'no-new-object': 'error', + 'no-new-wrappers': 'error', + 'no-proto': 'error', + 'no-shadow': 'warn', + 'no-unused-vars': [ + 'error', + { + varsIgnorePattern: '^_', + argsIgnorePattern: '^_', + }, + ], + 'no-var': 'warn', + 'unicode-bom': 'error', + // GJS Restrictions + 'no-restricted-globals': [ + 'error', + { + name: 'Debugger', + message: 'Internal use only', + }, + { + name: 'GIRepositoryGType', + message: 'Internal use only', + }, + { + name: 'log', + message: 'Use console.log()', + }, + { + name: 'logError', + message: 'Use console.warn() or console.error()', + }, + ], + 'no-restricted-properties': [ + 'error', + { + object: 'imports', + property: 'format', + message: 'Use template strings', + }, + { + object: 'pkg', + property: 'initFormat', + message: 'Use template strings', + }, + { + object: 'Lang', + property: 'copyProperties', + message: 'Use Object.assign()', + }, + { + object: 'Lang', + property: 'bind', + message: 'Use arrow notation or Function.prototype.bind()', + }, + { + object: 'Lang', + property: 'Class', + message: 'Use ES6 classes', + }, + ], + 'no-restricted-syntax': [ + 'error', + { + selector: 'MethodDefinition[key.name="_init"] CallExpression[arguments.length<=1][callee.object.type="Super"][callee.property.name="_init"]', + message: 'Use constructor() and super()', + }, + ], + }, + }, +]; diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml new file mode 100644 index 0000000..40925be --- /dev/null +++ b/.github/workflows/eslint.yml @@ -0,0 +1,39 @@ +name: ESLint + +on: + push: + branches: [ 'main' ] + pull_request: + branches: [ 'main' ] + schedule: + - cron: '33 14 * * 5' + +jobs: + eslint: + name: Run eslint scanning + runs-on: ubuntu-latest + permissions: + contents: read + security-events: write + # Required for private repositories by github/codeql-action/upload-sarif + actions: read + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install + run: | + npm install eslint@^8.0.0 + npm install @microsoft/eslint-formatter-sarif@2.1.7 + + - name: Lint + run: npx eslint . + --format @microsoft/eslint-formatter-sarif + --output-file eslint-results.sarif + continue-on-error: true + + - name: Report + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: eslint-results.sarif + wait-for-processing: true diff --git a/package.json b/package.json new file mode 100644 index 0000000..0bfebfd --- /dev/null +++ b/package.json @@ -0,0 +1,28 @@ +{ + "name": "gnome-shell-extensions-gravatar", + "version": "1.0.0", + "description": "Synchronize user icon with Gravatar", + "main": "index.js", + "directories": { + "lib": "lib" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "." + }, + "author": "Daniel Sheeler", + "license": "MIT", + "devDependencies": { + "@eslint/eslintrc": "^3.0.2", + "@eslint/js": "^9.3.0", + "eslint": "^8.57.0", + "eslint-config-standard": "^17.1.0", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-n": "^16.6.2", + "eslint-plugin-promise": "^6.1.1", + "globals": "^15.0.0" + } +} From a9f40a08d41cdb546df84dcaa1c5213b7886faaa Mon Sep 17 00:00:00 2001 From: Daniel Sheeler Date: Thu, 23 May 2024 07:22:09 -0500 Subject: [PATCH 2/4] Update eslint.yml --- .github/workflows/eslint.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 40925be..f85b847 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -5,8 +5,6 @@ on: branches: [ 'main' ] pull_request: branches: [ 'main' ] - schedule: - - cron: '33 14 * * 5' jobs: eslint: @@ -24,16 +22,7 @@ jobs: - name: Install run: | npm install eslint@^8.0.0 - npm install @microsoft/eslint-formatter-sarif@2.1.7 - name: Lint run: npx eslint . - --format @microsoft/eslint-formatter-sarif - --output-file eslint-results.sarif continue-on-error: true - - - name: Report - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: eslint-results.sarif - wait-for-processing: true From a35fccd5661ff9720a725adda8c72856e41c22bd Mon Sep 17 00:00:00 2001 From: Daniel Sheeler Date: Thu, 23 May 2024 07:29:05 -0500 Subject: [PATCH 3/4] change eslint config file to yml --- .eslint.config.js | 143 ---------------------------------------------- .eslintrc.yml | 109 +++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 143 deletions(-) delete mode 100644 .eslint.config.js create mode 100644 .eslintrc.yml diff --git a/.eslint.config.js b/.eslint.config.js deleted file mode 100644 index 4e78491..0000000 --- a/.eslint.config.js +++ /dev/null @@ -1,143 +0,0 @@ -// SPDX-License-Identifier: CC0-1.0 -// SPDX-FileCopyrightText: No rights reserved - -import js from '@eslint/js'; - -export default [ - js.configs.recommended, - { - languageOptions: { - globals: { - ARGV: 'readonly', - Debugger: 'readonly', - GIRepositoryGType: 'readonly', - globalThis: 'readonly', - imports: 'readonly', - Intl: 'readonly', - log: 'readonly', - logError: 'readonly', - pkg: 'readonly', - print: 'readonly', - printerr: 'readonly', - window: 'readonly', - TextEncoder: 'readonly', - TextDecoder: 'readonly', - console: 'readonly', - setTimeout: 'readonly', - setInterval: 'readonly', - clearTimeout: 'readonly', - clearInterval: 'readonly', - }, - parserOptions: { - ecmaVersion: 2022, - sourceType: 'module', - }, - }, - rules: { - // See: https://eslint.org/docs/latest/rules/#possible-problems - 'array-callback-return': 'error', - 'no-await-in-loop': 'error', - 'no-constant-binary-expression': 'error', - 'no-constructor-return': 'error', - 'no-new-native-nonconstructor': 'error', - 'no-promise-executor-return': 'error', - 'no-self-compare': 'error', - 'no-template-curly-in-string': 'error', - 'no-unmodified-loop-condition': 'error', - 'no-unreachable-loop': 'error', - 'no-unused-private-class-members': 'error', - 'no-use-before-define': [ - 'error', - { - functions: false, - classes: true, - variables: true, - allowNamedExports: true, - }, - ], - // See: https://eslint.org/docs/latest/rules/#suggestions - 'block-scoped-var': 'error', - 'complexity': 'warn', - 'consistent-return': 'error', - 'default-param-last': 'error', - 'eqeqeq': 'error', - 'no-array-constructor': 'error', - 'no-caller': 'error', - 'no-extend-native': 'error', - 'no-extra-bind': 'error', - 'no-extra-label': 'error', - 'no-iterator': 'error', - 'no-label-var': 'error', - 'no-loop-func': 'error', - 'no-multi-assign': 'warn', - 'no-new-object': 'error', - 'no-new-wrappers': 'error', - 'no-proto': 'error', - 'no-shadow': 'warn', - 'no-unused-vars': [ - 'error', - { - varsIgnorePattern: '^_', - argsIgnorePattern: '^_', - }, - ], - 'no-var': 'warn', - 'unicode-bom': 'error', - // GJS Restrictions - 'no-restricted-globals': [ - 'error', - { - name: 'Debugger', - message: 'Internal use only', - }, - { - name: 'GIRepositoryGType', - message: 'Internal use only', - }, - { - name: 'log', - message: 'Use console.log()', - }, - { - name: 'logError', - message: 'Use console.warn() or console.error()', - }, - ], - 'no-restricted-properties': [ - 'error', - { - object: 'imports', - property: 'format', - message: 'Use template strings', - }, - { - object: 'pkg', - property: 'initFormat', - message: 'Use template strings', - }, - { - object: 'Lang', - property: 'copyProperties', - message: 'Use Object.assign()', - }, - { - object: 'Lang', - property: 'bind', - message: 'Use arrow notation or Function.prototype.bind()', - }, - { - object: 'Lang', - property: 'Class', - message: 'Use ES6 classes', - }, - ], - 'no-restricted-syntax': [ - 'error', - { - selector: 'MethodDefinition[key.name="_init"] CallExpression[arguments.length<=1][callee.object.type="Super"][callee.property.name="_init"]', - message: 'Use constructor() and super()', - }, - ], - }, - }, -]; diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 0000000..9cfe52a --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,109 @@ +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileCopyrightText: No rights reserved + +env: + es2021: true +extends: 'eslint:recommended' +rules: + # See: https://eslint.org/docs/latest/rules/#possible-problems + array-callback-return: error + no-await-in-loop: error + no-constant-binary-expression: error + no-constructor-return: error + #no-duplicate-imports: error + no-new-native-nonconstructor: error + no-promise-executor-return: error + no-self-compare: error + no-template-curly-in-string: error + no-unmodified-loop-condition: error + no-unreachable-loop: error + no-unused-private-class-members: error + no-use-before-define: + - error + - functions: false + classes: true + variables: true + allowNamedExports: true + # See: https://eslint.org/docs/latest/rules/#suggestions + block-scoped-var: error + complexity: warn + consistent-return: error + default-param-last: error + eqeqeq: error + no-array-constructor: error + no-caller: error + no-extend-native: error + no-extra-bind: error + no-extra-label: error + no-iterator: error + no-label-var: error + no-loop-func: error + no-multi-assign: warn + no-new-object: error + no-new-wrappers: error + no-proto: error + no-shadow: warn + no-unused-vars: + - error + - varsIgnorePattern: ^_ + argsIgnorePattern: ^_ + no-var: warn + unicode-bom: error + # GJS Restrictions + no-restricted-globals: + - error + - name: Debugger + message: Internal use only + - name: GIRepositoryGType + message: Internal use only + - name: log + message: Use console.log() + - name: logError + message: Use console.warn() or console.error() + no-restricted-properties: + - error + - object: imports + property: format + message: Use template strings + - object: pkg + property: initFormat + message: Use template strings + - object: Lang + property: copyProperties + message: Use Object.assign() + - object: Lang + property: bind + message: Use arrow notation or Function.prototype.bind() + - object: Lang + property: Class + message: Use ES6 classes + no-restricted-syntax: + - error + - selector: >- + MethodDefinition[key.name="_init"] + CallExpression[arguments.length<=1][callee.object.type="Super"][callee.property.name="_init"] + message: Use constructor() and super() +# GJS Globals +globals: + ARGV: readonly + Debugger: readonly + GIRepositoryGType: readonly + globalThis: readonly + imports: readonly + Intl: readonly + log: readonly + logError: readonly + pkg: readonly + print: readonly + printerr: readonly + window: readonly + TextEncoder: readonly + TextDecoder: readonly + console: readonly + setTimeout: readonly + setInterval: readonly + clearTimeout: readonly + clearInterval: readonly +parserOptions: + ecmaVersion: 2022 + sourceType: module From 0622ce72a036c09345ec6631e5bef8bfd514c261 Mon Sep 17 00:00:00 2001 From: Daniel Sheeler Date: Fri, 24 May 2024 15:09:06 -0500 Subject: [PATCH 4/4] Updates to pass eslint --- lib/md5.js | 24 ++++++++++----------- src/extension.js | 49 +++++++++++++++++++++---------------------- src/shortcutButton.js | 21 ++++++++++--------- src/utils/logger.js | 8 +++---- 4 files changed, 51 insertions(+), 51 deletions(-) diff --git a/lib/md5.js b/lib/md5.js index 88c0a70..849131f 100644 --- a/lib/md5.js +++ b/lib/md5.js @@ -7,7 +7,7 @@ * * Licensed under the MIT license: * http://www.opensource.org/licenses/MIT - * + * * Based on * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message * Digest Algorithm, as defined in RFC 1321. @@ -18,7 +18,6 @@ */ /*jslint bitwise: true */ -/*global unescape, define */ 'use strict'; @@ -27,7 +26,7 @@ * to work around bugs in some JS interpreters. */ function safe_add(x, y) { - var lsw = (x & 0xFFFF) + (y & 0xFFFF), + const lsw = (x & 0xFFFF) + (y & 0xFFFF), msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } @@ -66,7 +65,7 @@ x[len >> 5] |= 0x80 << (len % 32); x[(((len + 64) >>> 9) << 4) + 14] = len; - var i, olda, oldb, oldc, oldd, + let i, olda, oldb, oldc, oldd, a = 1732584193, b = -271733879, c = -1732584194, @@ -158,7 +157,7 @@ * Convert an array of little-endian words to a string */ function binl2rstr(input) { - var i, + let i, output = ''; for (i = 0; i < input.length * 32; i += 8) { output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF); @@ -171,7 +170,7 @@ * Characters >255 have their high-byte silently ignored. */ function rstr2binl(input) { - var i, + let i, output = []; output[(input.length >> 2) - 1] = undefined; for (i = 0; i < output.length; i += 1) { @@ -194,12 +193,13 @@ * Calculate the HMAC-MD5, of a key and some data (raw strings) */ function rstr_hmac_md5(key, data) { - var i, + let i, bkey = rstr2binl(key), ipad = [], opad = [], hash; - ipad[15] = opad[15] = undefined; + ipad[15] = undefined; + opad[15] = undefined; if (bkey.length > 16) { bkey = binl_md5(bkey, key.length * 8); } @@ -215,10 +215,10 @@ * Convert a raw string to a hex string */ function rstr2hex(input) { - var hex_tab = '0123456789abcdef', - output = '', - x, - i; + const hex_tab = '0123456789abcdef'; + let x, + i, + output = ''; for (i = 0; i < input.length; i += 1) { x = input.charCodeAt(i); output += hex_tab.charAt((x >>> 4) & 0x0F) + diff --git a/src/extension.js b/src/extension.js index 2a54a06..bc20fa3 100644 --- a/src/extension.js +++ b/src/extension.js @@ -24,7 +24,7 @@ export default class GravatarExtension extends Extension { this.notifSource = null; this.previousKeybinding = ""; } - + /* *********************************************** * Public Methods * @@ -44,7 +44,7 @@ export default class GravatarExtension extends Extension { this.addKeybinding(); }); } - + disable() { this.logger.debug('Disabling'); this.user = null; @@ -53,30 +53,30 @@ export default class GravatarExtension extends Extension { this.settings.disconnect(this.emailChangedId); this.emailChangedId = null; } - + if (this.keybindingChangedId) { this.settings.disconnect(this.keybindingChangedId); this.keybindingChangedId = null; } - + if (this.userLoop) { clearInterval(this.userLoop); this.userLoop = null; } - + if (this.httpSession) { this.httpSession.abort(); this.httpSession = null; } this.logger = null; } - + /* *********************************************** * Private Methods * *********************************************** */ - + addKeybinding() { this.logger.debug("Adding keybinding"); this.previousKeybinding = this.settings.get_strv("gravatar-ondemand-keybinding")[0]; @@ -94,14 +94,14 @@ export default class GravatarExtension extends Extension { } ) } - + removeKeybinding() { this.logger.debug(`Remove keybinding ${this.previousKeybinding}`); if (this.previousKeybinding) { Main.wm.removeKeybinding('gravatar-ondemand-keybinding'); } } - + waitForUser(cb) { // This fixes an issue where sometimes this.user is not // initialized when the extension loads @@ -127,23 +127,23 @@ export default class GravatarExtension extends Extension { return null; }, 1000); } - + /* Settings */ getIconSize() { return this.settings.get_int('icon-size'); } - + getHash() { const email = this.settings.get_string('email').toLowerCase(); this.logger.debug(`Hashing "${email}"`); return md5(email); } - + /* Set Icon */ setIcon(icon) { this.user.set_icon_file(icon); } - + /* Download From Gravatar */ loadIcon() { const email = this.settings.get_string('email').toLowerCase(); @@ -155,7 +155,7 @@ export default class GravatarExtension extends Extension { const url = `http://www.gravatar.com/avatar/${hash}?s=${this.getIconSize()}&d=404`; const request = Soup.Message.new('GET', url); const icon = Gio.file_new_for_path(`${this.tmpDir}/${Date.now()}_${hash}`); - + // initialize session if (!this.httpSession) { this.logger.debug('Creating new http session'); @@ -166,12 +166,12 @@ export default class GravatarExtension extends Extension { this.logger.debug(`Saving to ${icon.get_path()}`); const fstream = icon.replace(null, false, Gio.FileCreateFlags.NONE, null); this.httpSession.send_and_splice_async( - request, - fstream, + request, + fstream, Gio.OutputStreamSpliceFlags.CLOSE_TARGET, 0, null, - (session, result, data) => { + (session, result) => { if (session.send_and_splice_finish(result) > -1) { if (session.get_async_result_message(result).get_status() !== Soup.Status.NOT_FOUND) { this.setIcon(icon.get_path()); @@ -190,29 +190,29 @@ export default class GravatarExtension extends Extension { this.logger.error(e.message); } } - + showNotification(title, message, gicon) { if (!this.settings.get_boolean('notifications')) return; - if (this.notifSource == null) { + if (this.notifSource === null) { // We have to prepare this only once this.notifSource = new MessageTray.Source({ title: this.metadata.name.toString(), icon: Gio.icon_new_for_string(GLib.build_filenamev([this.path, 'ui', 'icons', 'hicolor', 'scalable', 'actions', 'gravatar.svg'])), }); - + // Take care of not leaving unneeded sources this.notifSource.connect('destroy', ()=>{this.notifSource = null;}); Main.messageTray.add(this.notifSource); } - + let notification = null; // We do not want to have multiple notifications stacked // instead we will update previous - if (this.notifSource.notifications.length == 0) { + if (this.notifSource.notifications.length === 0) { notification = new MessageTray.Notification({ - source: this.notifSource, - title: title, + source: this.notifSource, + title: title, body: message, gicon: gicon }); @@ -227,4 +227,3 @@ export default class GravatarExtension extends Extension { this.notifSource.addNotification(notification); } } - \ No newline at end of file diff --git a/src/shortcutButton.js b/src/shortcutButton.js index 3b5587b..c63e718 100644 --- a/src/shortcutButton.js +++ b/src/shortcutButton.js @@ -29,11 +29,11 @@ export class OnDemandShortcutButton extends Gtk.Stack { this.settings = settings; this.dialog = null; this.valign = Gtk.Align.CENTER; - + this.chooseButton = new Gtk.Button({ label: "Choose...", }); - + this.editBox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, }); @@ -42,7 +42,7 @@ export class OnDemandShortcutButton extends Gtk.Stack { this.changeButton = new Gtk.Button({ tooltip_text: "Change keyboard shortcut", }) - + this.clearButton = new Gtk.Button({ label: "Clear", }) @@ -54,7 +54,7 @@ export class OnDemandShortcutButton extends Gtk.Stack { this.shortcutLabel = new Gtk.ShortcutLabel({ accelerator: this.keybinding, }); - + //this.settings.connect("changed::gravatar-ondemand-keybinding", this.shortcutLabel, "accelerator", Gio.SettingsBindFlags.DEFAULT); this.bind_property("keybinding", this.shortcutLabel, "accelerator", Gio.SettingsBindFlags.DEFAULT); this.changeButton.set_child(this.shortcutLabel); @@ -74,14 +74,14 @@ export class OnDemandShortcutButton extends Gtk.Stack { } activate() { - if (this.keybinding) + if (this.keybinding) return this.editBox.get_first_child().activate(); - else + else return this.chooseButton.activate(); } openDialog() { - if (this.dialog == null) { + if (this.dialog === null) { this.statusPage = new Adw.StatusPage({ title: "Press your keyboard shortcut...", icon_name: "preferences-desktop-keyboard-shortcuts-symbolic", @@ -102,7 +102,7 @@ export class OnDemandShortcutButton extends Gtk.Stack { hexpand: true, child: this.overlay, }) - + this.dialog = new Adw.Window({ modal: true, default_width: 440, @@ -114,13 +114,13 @@ export class OnDemandShortcutButton extends Gtk.Stack { }); this.eventControllerKey.connect("key-pressed", this.onKeyPressed.bind(this)) this.dialog.add_controller(this.eventControllerKey); - + } this.dialog.transient_for = this.get_root(); this.dialog.present(); } - onKeybindingChanged(button) { + onKeybindingChanged() { this.visible_child = this.keybinding ? this.editBox : this.chooseButton; } @@ -195,6 +195,7 @@ function isKeyvalForbidden(keyval) { * representing the key combo. * @returns {boolean} `true` if the key combo is a valid binding. */ +// eslint-disable-next-line complexity function isBindingValid({ mask, keycode, keyval }) { if ((mask === 0 || mask === Gdk.SHIFT_MASK) && keycode !== 0) { if ( diff --git a/src/utils/logger.js b/src/utils/logger.js index 44eae67..04efb22 100644 --- a/src/utils/logger.js +++ b/src/utils/logger.js @@ -13,8 +13,8 @@ export const GravatarLogger = new GObject.registerClass({ ), } }, class GravatarLogger extends GObject.Object { - _init(settings) { - super._init(); + constructor(settings) { + super(); this.settings = settings; this.settings.bind('debug', this, 'debugging_on', Gio.SettingsBindFlags.DEFAULT); @@ -33,8 +33,8 @@ export const GravatarLogger = new GObject.registerClass({ console.log(`[DEBUG ]${this.prepareMessage(msg)}`); } } - + prepareMessage(msg) { return `[Gravatar] ${msg}`; } -}); \ No newline at end of file +});