Skip to content

Commit

Permalink
Merge pull request #405 from lieser/ci_for_2.x
Browse files Browse the repository at this point in the history
Add CI for 2.x
  • Loading branch information
lieser authored Nov 12, 2023
2 parents 5c1ecb7 + 6686d43 commit c736fe4
Show file tree
Hide file tree
Showing 38 changed files with 8,074 additions and 161 deletions.
15 changes: 14 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = unset
trim_trailing_whitespace = set
insert_final_newline = true

[*.d.ts]
Expand All @@ -14,8 +14,21 @@ indent_style = space
[*.md]
indent_style = space

[*.yml]
indent_style = space
indent_size = 2

[.vscode/cSpell.json]
indent_style = space

[.vscode/settings.json]
indent_style = space

[.vscode/tasks.json]
indent_style = space

[.eslintrc.json]
indent_style = space

[jsconfig.json]
indent_style = space
5 changes: 5 additions & 0 deletions .eslintrc-ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"no-warning-comments": "off"
}
}
14 changes: 10 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"extends": [
"eslint:all",
"eslint:recommended"
],
"env": {
Expand All @@ -13,6 +12,9 @@
"ecmaFeatures": {},
"sourceType": "script"
},
"ignorePatterns": [
"thirdparty/**"
],
"rules": {
// Possible Errors
"for-direction": "warn",
Expand Down Expand Up @@ -49,7 +51,6 @@
"no-labels": "warn",
"no-lone-blocks": "warn",
"no-loop-func": "warn",
"no-magic-numbers": ["warn", { "ignoreArrayIndexes": true }],
"no-multi-spaces": "warn",
"no-multi-str": "warn",
"no-new": "warn",
Expand Down Expand Up @@ -81,7 +82,12 @@
"strict": ["warn", "global"],
// Variables
"no-undef": "error",
"no-unused-vars": "error",
"no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_"
}
],
// Stylistic Issues
"no-mixed-spaces-and-tabs": ["warn", "smart-tabs"],
"semi": "warn",
Expand All @@ -90,4 +96,4 @@
"no-const-assign": "warn",
"no-this-before-super": "warn"
}
}
}
18 changes: 18 additions & 0 deletions .github/problemMatchers/tsc-pretty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"problemMatcher": [
{
"owner": "tsc",
"pattern": [
{
"regexp": "^(?:\\x1b\\[[\\d;]+m)([^\\s].*)(?:\\x1b\\[[\\d;]+m)[\\(:](?:\\x1b\\[[\\d;]+m)(\\d+)(?:\\x1b\\[[\\d;]+m)[,:](?:\\x1b\\[[\\d;]+m)(\\d+)(?:\\x1b\\[[\\d;]+m)(?:\\):\\s+|\\s+-\\s+)(?:\\x1b\\[[\\d;]+m)(error|warning|info)(?:\\x1b\\[[\\d;]+m)(?:\\x1b\\[[\\d;]+m)\\s+TS(\\d+)\\s*:\\s*(?:\\x1b\\[[\\d;]+m)(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"code": 5,
"message": 6
}
]
}
]
}
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI 2.x

on:
- push
- pull_request

permissions:
contents: read
# implicitly all other scopes not listed become none

jobs:
ESLint:
name: ESLint
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install Node.js dependencies
run: npm ci
- name: Run ESLint
run: npm run lint:ci

checkJs:
name: Type Check
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install Node.js dependencies
run: npm ci
- name: Register Problem Matcher for colored tsc output
run: echo "##[add-matcher].github/problemMatchers/tsc-pretty.json"
- name: Run type checking
run: npm run checkJs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
31 changes: 29 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,33 @@
"kind": "build",
"isDefault": true
}
}
},
{
"label": "lint",
"detail": "Run ESLint",
"type": "npm",
"script": "lint",
"problemMatcher": [
"$eslint-stylish"
],
},
{
"label": "lint:ci",
"detail": "Run ESLint with config for CI",
"type": "npm",
"script": "lint:ci",
"problemMatcher": [
"$eslint-stylish"
],
},
{
"label": "checkJs",
"detail": "Run type checking with TS",
"type": "npm",
"script": "checkJs",
"problemMatcher": [
"$tsc"
],
},
]
}
}
27 changes: 0 additions & 27 deletions _reference.js

This file was deleted.

23 changes: 19 additions & 4 deletions chrome/content/addSignersRule.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
Components.utils.import("resource://dkim_verifier/logging.jsm");
Components.utils.import("resource://dkim_verifier/dkimPolicy.jsm");
// @ts-nocheck
/* eslint-env browser */
/* eslint strict: ["warn", "function"] */
/* global Components */
/* global Logging, Policy */
/* exported onAccept, onCancel, init */

Components.utils.import("resource://dkim_verifier/logging.jsm.js");
Components.utils.import("resource://dkim_verifier/dkimPolicy.jsm.js");

var log = Logging.getLogger("addSignersRule");

function onAccept(){
"use strict";

try {
var input = {};
input.domain = document.getElementById("domain").value;
Expand All @@ -30,7 +39,7 @@ function onAccept(){
input.priority = document.getElementById("priority").value;
}
input.enabled = document.getElementById("enabled").checked;

window.arguments[0].addRow(input);
} catch (exception) {
log.fatal(exception);
Expand All @@ -40,14 +49,20 @@ function onAccept(){
}

function onCancel(){
"use strict";

return true;
}

function updatePriorityMode() {
"use strict";

document.getElementById("priority").disabled =
(document.getElementById("priorityMode").value === "1");
document.getElementById("priorityMode").value === "1";
}

function init() {
"use strict";

updatePriorityMode();
}
17 changes: 15 additions & 2 deletions chrome/content/am-dkim_verifier-prefs.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
// @ts-check
/* eslint-env browser */
/* eslint strict: ["warn", "function"] */
/* exported onPreInit, onInit, onSave */

// @ts-expect-error
// eslint-disable-next-line curly
if (!DKIMVerifier) var DKIMVerifier = {};

// var gPref = null;

function onPreInit(account, accountValues) {
function onPreInit(account, _accountValues) {
"use strict";

DKIMVerifier.server = account.incomingServer;
}

function onInit(aPageId, aServerId) {
function onInit(_aPageId, _aServerId) {
"use strict";

DKIMVerifier.dkimEnable = document.
getElementById("dkimVerifier_dkim.enable");
DKIMVerifier.arhRead = document.getElementById("dkimVerifier_arh.read");
Expand All @@ -22,6 +33,8 @@ function onInit(aPageId, aServerId) {
}

function onSave() {
"use strict";

DKIMVerifier.server.setIntValue("dkim_verifier.dkim.enable",
DKIMVerifier.dkimEnable.value);
DKIMVerifier.server.setIntValue("dkim_verifier.arh.read",
Expand Down
28 changes: 20 additions & 8 deletions chrome/content/dkim.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
// namespace
// @ts-ignore
var DKIM_Verifier = {};
Cu.import("resource://dkim_verifier/logging.jsm", DKIM_Verifier);
Cu.import("resource://dkim_verifier/helper.jsm", DKIM_Verifier);
Cu.import("resource://dkim_verifier/AuthVerifier.jsm", DKIM_Verifier);
Cu.import("resource://dkim_verifier/dkimPolicy.jsm", DKIM_Verifier);
Cu.import("resource://dkim_verifier/dkimKey.jsm", DKIM_Verifier);
Cu.import("resource://dkim_verifier/logging.jsm.js", DKIM_Verifier);
Cu.import("resource://dkim_verifier/helper.jsm.js", DKIM_Verifier);
Cu.import("resource://dkim_verifier/AuthVerifier.jsm.js", DKIM_Verifier);
Cu.import("resource://dkim_verifier/dkimPolicy.jsm.js", DKIM_Verifier);
Cu.import("resource://dkim_verifier/dkimKey.jsm.js", DKIM_Verifier);


// @ts-ignore
Expand Down Expand Up @@ -208,6 +208,7 @@ DKIM_Verifier.Display = (function() {
* @param {IAuthVerifier.IAuthResult} result
* @return {void}
*/
// eslint-disable-next-line complexity
function displayResult(result) {
log.trace("displayResult begin");
header.dkimResults = result.dkim;
Expand Down Expand Up @@ -673,8 +674,14 @@ var that = {
markKeyAsSecure : function Display_markKeyAsSecure() {
let promise = (async () => {
log.trace("markKeyAsSecure Task");
const sdid = header.dkimResults[0].sdid;
const selector = header.dkimResults[0].selector;
if (sdid === undefined || selector === undefined) {
log.error("Can not mark key as secure, result does not contain an sdid or selector");
return;
}
await DKIM_Verifier.Key.markKeyAsSecure(
header.dkimResults[0].sdid, header.dkimResults[0].selector);
sdid, selector);

that.reverify();
})();
Expand All @@ -690,8 +697,13 @@ var that = {
let promise = (async () => {
log.trace("updateKey Task");
for (let dkimResult of header.dkimResults) {
await DKIM_Verifier.Key.deleteKey(
dkimResult.sdid, dkimResult.selector);
const sdid = dkimResult.sdid;
const selector = dkimResult.selector;
if (sdid === undefined || selector === undefined) {
log.error("Can not delete key, result does not contain an sdid or selector");
return;
}
await DKIM_Verifier.Key.deleteKey(sdid, selector);
}

that.reverify();
Expand Down
10 changes: 10 additions & 0 deletions chrome/content/options.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
// @ts-nocheck
/* eslint-env browser */
/* eslint strict: ["warn", "function"] */
/* global Components, Services */
/* exported onLoad, gDKIMonpaneload */

Components.utils.import("resource://gre/modules/Services.jsm");

function onLoad(paneID) {
"use strict";

var fadeInEffect = Services.prefs.
getBoolPref("browser.preferences.animateFadeIn");
if (!fadeInEffect) {
// @ts-expect-error
window.sizeToContent();
} else {
var currentPane = document.getElementById(paneID);
// @ts-expect-error
var changeWidthBy = currentPane._content.scrollWidth - currentPane._content.clientWidth;
window.resizeBy(changeWidthBy, 0);
}
Expand Down
Loading

0 comments on commit c736fe4

Please sign in to comment.