Skip to content

Commit

Permalink
ESLint & web-ext lint
Browse files Browse the repository at this point in the history
  • Loading branch information
hyjk2000 committed Feb 6, 2023
1 parent 0d3e037 commit 3b0ec61
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* eslint-env node */
module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
root: true,
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"dev": "vite",
"serve:chromium": "web-ext run -t chromium --start-url \"about:blank\" --source-dir ./dist/",
"serve:firefox": "web-ext run --start-url \"about:debugging#/runtime/this-firefox\" --source-dir ./dist/",
"lint": "web-ext lint --source-dir ./dist/",
"package": "web-ext build --source-dir ./dist/"
},
"devDependencies": {
Expand Down
6 changes: 4 additions & 2 deletions src/entries/popup/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,24 @@ async function getCurrTabUrl() {

async function genQrBlob(url: string, type: "svg" | "png") {
switch (type) {
case "svg":
case "svg": {
const svg = await toString(url, {
type: "svg",
margin: 0,
});
return new Blob([svg], {
type: "image/svg+xml;charset=utf-8",
});
case "png":
}
case "png": {
const png = await toDataURL(url, {
type: "image/png",
width: 512,
});
return new Blob([dataURLToArrayBuffer(png)], {
type: "image/png",
});
}
}
}

Expand Down

0 comments on commit 3b0ec61

Please sign in to comment.