Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for older versions of Thunderbird and update linting dependencies #177

Merged
merged 4 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions .eslintrc.json

This file was deleted.

18 changes: 6 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Configure npm caching
uses: actions/cache@v2
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
cache: npm
- name: Install dependencies
run: npm ci
- name: Run prettier
run: |-
npx --no-install prettier --check .
run: npm run style
- name: Run eslint
run: |-
npx --no-install eslint .
if: "! cancelled()"
run: npm run lint
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
- 2.3.0:

- Drop support for versions of Thunderbird older than 115.
Those versions can continue using 2.2.5.
This change is mainly a precaution to acknowledge that those older versions are not tested as part of development and could be broken by future updates (it also fulfills a request from addons.thunderbird.net).

- 2.2.5:

- Do not capture keys in the quick search box in Thunderbird 128+
Expand Down
11 changes: 0 additions & 11 deletions addon/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,6 @@ async function applyKeys() {
}
applyKeys();

// Warn about updates requiring user action
browser.runtime.onInstalled.addListener(async (details) => {
switch (details.reason) {
case "update": {
if (details.previousVersion.split(".")[0] < 2) {
const url = browser.runtime.getURL("update_v2.0.html");
await browser.tabs.create({ url });
}
}
}
});
browser.tbkeys.onSendMessage.addListener(async (extensionID, message) => {
browser.runtime.sendMessage(extensionID, message);
});
9 changes: 2 additions & 7 deletions addon/implementation.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use strict";
/* global ChromeUtils */
/* global ChromeUtils, Services */

var { ExtensionCommon } = ChromeUtils.import(
"resource://gre/modules/ExtensionCommon.jsm"
Expand All @@ -10,9 +10,6 @@ var { ExtensionParent } = ChromeUtils.import(
var { ExtensionSupport } = ChromeUtils.import(
"resource:///modules/ExtensionSupport.jsm"
);
var Services =
globalThis.Services ||
ChromeUtils.import("resource://gre/modules/Services.jsm").Services;

const EXTENSION_NAME = "tbkeys@addons.thunderbird.net";
var extension = ExtensionParent.GlobalManager.getExtension(EXTENSION_NAME);
Expand Down Expand Up @@ -124,7 +121,7 @@ function buildKeyCommand(win, command) {
case "unset":
break;
default:
eval(command); // eslint-disable-line no-eval
eval(command);
break;
}
return false;
Expand Down Expand Up @@ -242,11 +239,9 @@ var tbkeys = class extends ExtensionCommon.ExtensionAPI {
Services.obs.notifyObservers(null, "startupcache-invalidate", null);
}

// eslint-disable-next-line no-unused-vars
getAPI(context) {
return {
tbkeys: {
// eslint-disable-next-line require-await
bindKeys: async function (keyBindings) {
TBKeys.bindKeys(keyBindings);
},
Expand Down
4 changes: 2 additions & 2 deletions addon/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"browser_specific_settings": {
"gecko": {
"id": "tbkeys@addons.thunderbird.net",
"strict_min_version": "68.0",
"strict_min_version": "115.0",
"strict_max_version": "*",
"update_url": "https://raw.githubusercontent.com/wshanks/tbkeys/main/updates.json"
}
},
"name": "tbkeys",
"description": "Custom Thunderbird keybindings",
"author": "Will Shanks",
"version": "2.2.5",
"version": "2.3.0",
"background": {
"scripts": ["background.js"]
},
Expand Down
2 changes: 1 addition & 1 deletion addon/options.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>

<html>
<head>
Expand Down
2 changes: 1 addition & 1 deletion addon/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function validateKeys() {
JSON.parse(keysField.value);
}
keysField.setCustomValidity("");
} catch (err) {
} catch {
keysField.setCustomValidity("Invalid JSON");
valid = false;
}
Expand Down
35 changes: 0 additions & 35 deletions addon/update_v2.0.html

This file was deleted.

32 changes: 32 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: ["**/build", "addon/modules"],
},
...compat.extends("eslint:recommended"),
{
languageOptions: {
globals: {
...globals.browser,
},

ecmaVersion: 12,
sourceType: "module",
},

rules: {},
},
];
Loading