Skip to content

Commit 7192a72

Browse files
committed
chore(lint): prefix unused args with _ and promote no-unused-vars to error
Cleanup flagged by the CI review, then harden the gate so unused identifiers fail lint instead of merely warning: - background.js: the two consent handlers (handleGetPublicKey, handleSignEvent) receive `sender` but never use it -> `_sender`. - nip98-interceptor.js: the XHR setRequestHeader override only inspects the header `name` (and forwards `arguments`); the `value` arg is unused -> `_value`. - test/storage.test.js: drop the unused `before`/`after` imports (the suite uses inline clearStorage() calls). - .eslintrc.json: no-unused-vars "warn" -> "error", keeping the ^_ ignore patterns for args/vars/caught-errors. Lint is 0 errors / 0 warnings; build and the 133-test suite stay green. Co-Authored-By: jjohare <github@thedreamlab.uk>
1 parent 5d9af02 commit 7192a72

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"no-implied-eval": "error",
1717
"no-undef": "error",
1818
"no-unused-vars": [
19-
"warn",
19+
"error",
2020
{
2121
"argsIgnorePattern": "^_",
2222
"varsIgnorePattern": "^_",

src/background.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ async function handleMessage (message, sender) {
118118
/**
119119
* Get public key with user permission
120120
*/
121-
async function handleGetPublicKey (origin, sender) {
121+
async function handleGetPublicKey (origin, _sender) {
122122
// Check if keypair exists
123123
const keyExists = await hasKeypair();
124124
if (!keyExists) {
@@ -151,7 +151,7 @@ async function handleGetPublicKey (origin, sender) {
151151
/**
152152
* Sign event with user permission
153153
*/
154-
async function handleSignEvent (event, origin, sender) {
154+
async function handleSignEvent (event, origin, _sender) {
155155
// Check if keypair exists
156156
const keyExists = await hasKeypair();
157157
if (!keyExists) {

src/nip98-interceptor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
// Track page-set Authorization on XHR so we don't overwrite it in send().
228228
// setRequestHeader auto-merges values per the XHR spec, but a merged
229229
// "DPoP xxx, Nostr yyy" still confuses servers that branch on scheme.
230-
XMLHttpRequest.prototype.setRequestHeader = function (name, value) {
230+
XMLHttpRequest.prototype.setRequestHeader = function (name, _value) {
231231
if (typeof name === 'string' && name.toLowerCase() === 'authorization') {
232232
this._podkeyHasPageAuth = true;
233233
}

test/storage.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Note: These tests require Chrome extension APIs, so they may need mocking
44
*/
55

6-
import { describe, it, before, after } from 'node:test';
6+
import { describe, it } from 'node:test';
77
import assert from 'node:assert';
88

99
// Mock chrome.storage for testing. The extension uses two areas: session

0 commit comments

Comments
 (0)