sw: add TypeScript type checking
This implements the upstream changes from https://github.com/misskey-dev/misskey/pull/9314 but updated to our version of ESLint. Also updates TypeScript to 4.9.4 for all packages.
This commit is contained in:
parent
1d469f3c34
commit
6bba55c196
11 changed files with 120 additions and 35 deletions
22
.woodpecker/lint-sw.yml
Normal file
22
.woodpecker/lint-sw.yml
Normal file
|
@ -0,0 +1,22 @@
|
|||
clone:
|
||||
git:
|
||||
image: woodpeckerci/plugin-git
|
||||
settings:
|
||||
depth: 1 # CI does not need commit history
|
||||
recursive: true
|
||||
|
||||
pipeline:
|
||||
install:
|
||||
when:
|
||||
event:
|
||||
- pull_request
|
||||
image: node:18.6.0
|
||||
commands:
|
||||
- yarn install
|
||||
lint:
|
||||
when:
|
||||
event:
|
||||
- pull_request
|
||||
image: node:18.6.0
|
||||
commands:
|
||||
- yarn workspace sw run lint
|
|
@ -50,7 +50,7 @@
|
|||
"cross-env": "7.0.3",
|
||||
"cypress": "10.3.0",
|
||||
"start-server-and-test": "1.14.0",
|
||||
"typescript": "^4.9.3"
|
||||
"typescript": "^4.9.4"
|
||||
},
|
||||
"packageManager": "yarn@3.3.0"
|
||||
}
|
||||
|
|
|
@ -174,6 +174,6 @@
|
|||
"execa": "6.1.0",
|
||||
"form-data": "^4.0.0",
|
||||
"sinon": "^14.0.2",
|
||||
"typescript": "^4.9.3"
|
||||
"typescript": "^4.9.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
"tsc-alias": "1.7.0",
|
||||
"tsconfig-paths": "4.1.0",
|
||||
"twemoji-parser": "14.0.0",
|
||||
"typescript": "^4.9.3",
|
||||
"typescript": "^4.9.4",
|
||||
"uuid": "8.3.2",
|
||||
"v-debounce": "0.1.2",
|
||||
"vanilla-tilt": "1.7.2",
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"ts-jest": "^27.1.5",
|
||||
"ts-node": "10.9.1",
|
||||
"tsd": "^0.23.0",
|
||||
"typescript": "^4.9.3"
|
||||
"typescript": "^4.9.4"
|
||||
},
|
||||
"files": [
|
||||
"built"
|
||||
|
|
|
@ -9,7 +9,7 @@ module.exports = {
|
|||
project: ['./tsconfig.json'],
|
||||
},
|
||||
extends: [
|
||||
//"../shared/.eslintrc.js",
|
||||
"../shared/.eslintrc.js",
|
||||
],
|
||||
globals: {
|
||||
"require": false,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"scripts": {
|
||||
"watch": "node build.js watch",
|
||||
"build": "node build.js",
|
||||
"lint": "eslint src --ext .ts"
|
||||
"lint": "tsc --noEmit && eslint src --ext .ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"esbuild": "^0.14.13",
|
||||
|
@ -13,6 +13,9 @@
|
|||
"idb-keyval": "^6.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.29.0"
|
||||
"@typescript-eslint/parser": "^5.46.1",
|
||||
"eslint": "^8.29.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"typescript": "^4.9.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/*
|
||||
* Notification manager for SW
|
||||
*/
|
||||
declare var self: ServiceWorkerGlobalScope;
|
||||
|
||||
import { swLang } from '@/scripts/lang';
|
||||
import { cli } from '@/scripts/operations';
|
||||
|
@ -12,7 +11,7 @@ import { getAccountFromId } from '@/scripts/get-account-from-id';
|
|||
import { char2fileName } from '@/scripts/twemoji-base';
|
||||
import * as url from '@/scripts/url';
|
||||
|
||||
const iconUrl = (name: string) => `/static-assets/notification-badges/${name}.png`;
|
||||
const iconUrl = (name: string): string => `/static-assets/notification-badges/${name}.png`;
|
||||
|
||||
export async function createNotification<K extends keyof pushNotificationDataMap>(data: pushNotificationDataMap[K]) {
|
||||
const n = await composeNotification(data);
|
||||
|
@ -104,15 +103,15 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data
|
|||
title: t('_notification._actions.reply')
|
||||
},
|
||||
...((data.body.note.visibility === 'public' || data.body.note.visibility === 'home') ? [
|
||||
{
|
||||
action: 'renote',
|
||||
title: t('_notification._actions.renote')
|
||||
}
|
||||
] : [])
|
||||
{
|
||||
action: 'renote',
|
||||
title: t('_notification._actions.renote'),
|
||||
},
|
||||
] : []),
|
||||
],
|
||||
}];
|
||||
|
||||
case 'reaction':
|
||||
case 'reaction': {
|
||||
let reaction = data.body.reaction;
|
||||
let badge: string | undefined;
|
||||
|
||||
|
@ -159,7 +158,7 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data
|
|||
}
|
||||
],
|
||||
}];
|
||||
|
||||
}
|
||||
case 'pollVote':
|
||||
return [t('_notification.youGotPoll', { name: getUserName(data.body.user) }), {
|
||||
body: data.body.note.text || '',
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
* Operations
|
||||
* 各種操作
|
||||
*/
|
||||
declare var self: ServiceWorkerGlobalScope;
|
||||
|
||||
import * as foundkey from 'foundkey-js';
|
||||
import { SwMessage, swMessageOrderType } from '@/types';
|
||||
import { acct as getAcct } from '@/filters/user';
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
declare var self: ServiceWorkerGlobalScope;
|
||||
|
||||
import { createNotification } from '@/scripts/create-notification';
|
||||
import { swLang } from '@/scripts/lang';
|
||||
import { swNotificationRead } from '@/scripts/notification-read';
|
||||
|
@ -55,9 +53,9 @@ self.addEventListener('push', ev => {
|
|||
&& ('userId' in data.body
|
||||
? data.body.userId === n.data.body.userId
|
||||
: data.body.groupId === n.data.body.groupId)
|
||||
) {
|
||||
n.close();
|
||||
}
|
||||
) {
|
||||
n.close();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
89
yarn.lock
89
yarn.lock
|
@ -2605,6 +2605,23 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/parser@npm:^5.46.1":
|
||||
version: 5.46.1
|
||||
resolution: "@typescript-eslint/parser@npm:5.46.1"
|
||||
dependencies:
|
||||
"@typescript-eslint/scope-manager": 5.46.1
|
||||
"@typescript-eslint/types": 5.46.1
|
||||
"@typescript-eslint/typescript-estree": 5.46.1
|
||||
debug: ^4.3.4
|
||||
peerDependencies:
|
||||
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
checksum: 784fe3ae688da85784b271c10d1e0b807583f4c370e32aa7a09b2584d0f7b92316a93cccbd9458bdf08f169b220097a4b0456bc5f62a210607a13a5fae84c972
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/scope-manager@npm:5.44.0":
|
||||
version: 5.44.0
|
||||
resolution: "@typescript-eslint/scope-manager@npm:5.44.0"
|
||||
|
@ -2615,6 +2632,16 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/scope-manager@npm:5.46.1":
|
||||
version: 5.46.1
|
||||
resolution: "@typescript-eslint/scope-manager@npm:5.46.1"
|
||||
dependencies:
|
||||
"@typescript-eslint/types": 5.46.1
|
||||
"@typescript-eslint/visitor-keys": 5.46.1
|
||||
checksum: bf934603dc9c7da71eb26f415d13018f2a96dbba193a773bc440a5c93828365f09bb3db9be55189dfbbace414c6c48d7fad246c0d9717dab4676d0d79d6d8676
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/type-utils@npm:5.44.0":
|
||||
version: 5.44.0
|
||||
resolution: "@typescript-eslint/type-utils@npm:5.44.0"
|
||||
|
@ -2639,6 +2666,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/types@npm:5.46.1":
|
||||
version: 5.46.1
|
||||
resolution: "@typescript-eslint/types@npm:5.46.1"
|
||||
checksum: 91143d3304b8c70d69d9c8e5b7428cce3a222eacfbeb99e592d278668bcf998760731deae064a76157b9a0fc4911fe3178aa24e4ea6fe2ba68dd37113834c924
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/typescript-estree@npm:5.44.0":
|
||||
version: 5.44.0
|
||||
resolution: "@typescript-eslint/typescript-estree@npm:5.44.0"
|
||||
|
@ -2657,6 +2691,24 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/typescript-estree@npm:5.46.1":
|
||||
version: 5.46.1
|
||||
resolution: "@typescript-eslint/typescript-estree@npm:5.46.1"
|
||||
dependencies:
|
||||
"@typescript-eslint/types": 5.46.1
|
||||
"@typescript-eslint/visitor-keys": 5.46.1
|
||||
debug: ^4.3.4
|
||||
globby: ^11.1.0
|
||||
is-glob: ^4.0.3
|
||||
semver: ^7.3.7
|
||||
tsutils: ^3.21.0
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
checksum: 21499b927b4118cd51e841b2e1b7e55621135f923f461b75dc8ca8442de38a82da5a0232dce5229e0266b6fc12d70696e0e912fcf1483d4c44f02e4cad39ed98
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/utils@npm:5.44.0":
|
||||
version: 5.44.0
|
||||
resolution: "@typescript-eslint/utils@npm:5.44.0"
|
||||
|
@ -2685,6 +2737,16 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/visitor-keys@npm:5.46.1":
|
||||
version: 5.46.1
|
||||
resolution: "@typescript-eslint/visitor-keys@npm:5.46.1"
|
||||
dependencies:
|
||||
"@typescript-eslint/types": 5.46.1
|
||||
eslint-visitor-keys: ^3.3.0
|
||||
checksum: 952cf20e29a040e0820e52d6815097abf042ea8e1fd5d013c0a319284ea0e2e29e0ca9ef244717450a6eb9d32ebf7fa9ed91185675a27adc35c9ad070d561b7c
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@ungap/promise-all-settled@npm:1.1.2":
|
||||
version: 1.1.2
|
||||
resolution: "@ungap/promise-all-settled@npm:1.1.2"
|
||||
|
@ -3788,7 +3850,7 @@ __metadata:
|
|||
tsconfig-paths: 4.1.0
|
||||
twemoji-parser: 14.0.0
|
||||
typeorm: 0.3.7
|
||||
typescript: ^4.9.3
|
||||
typescript: ^4.9.4
|
||||
unzipper: 0.10.11
|
||||
uuid: 8.3.2
|
||||
web-push: 3.5.0
|
||||
|
@ -4767,7 +4829,7 @@ __metadata:
|
|||
tsc-alias: 1.7.0
|
||||
tsconfig-paths: 4.1.0
|
||||
twemoji-parser: 14.0.0
|
||||
typescript: ^4.9.3
|
||||
typescript: ^4.9.4
|
||||
uuid: 8.3.2
|
||||
v-debounce: 0.1.2
|
||||
vanilla-tilt: 1.7.2
|
||||
|
@ -7830,7 +7892,7 @@ __metadata:
|
|||
ts-jest: ^27.1.5
|
||||
ts-node: 10.9.1
|
||||
tsd: ^0.23.0
|
||||
typescript: ^4.9.3
|
||||
typescript: ^4.9.4
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
|
@ -7851,7 +7913,7 @@ __metadata:
|
|||
gulp-terser: 2.1.0
|
||||
js-yaml: 4.1.0
|
||||
start-server-and-test: 1.14.0
|
||||
typescript: ^4.9.3
|
||||
typescript: ^4.9.4
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
|
@ -16141,10 +16203,13 @@ __metadata:
|
|||
version: 0.0.0-use.local
|
||||
resolution: "sw@workspace:packages/sw"
|
||||
dependencies:
|
||||
"@typescript-eslint/parser": ^5.46.1
|
||||
esbuild: ^0.14.13
|
||||
eslint: ^8.29.0
|
||||
eslint-plugin-import: ^2.26.0
|
||||
foundkey-js: "workspace:*"
|
||||
idb-keyval: ^6.0.3
|
||||
typescript: ^4.9.4
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
|
@ -16958,13 +17023,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@npm:^4.9.3":
|
||||
version: 4.9.3
|
||||
resolution: "typescript@npm:4.9.3"
|
||||
"typescript@npm:^4.9.4":
|
||||
version: 4.9.4
|
||||
resolution: "typescript@npm:4.9.4"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: 17b8f816050b412403e38d48eef0e893deb6be522d6dc7caf105e54a72e34daf6835c447735fd2b28b66784e72bfbf87f627abb4818a8e43d1fa8106396128dc
|
||||
checksum: e782fb9e0031cb258a80000f6c13530288c6d63f1177ed43f770533fdc15740d271554cdae86701c1dd2c83b082cea808b07e97fd68b38a172a83dbf9e0d0ef9
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
@ -16978,13 +17043,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@patch:typescript@^4.9.3#~builtin<compat/typescript>":
|
||||
version: 4.9.3
|
||||
resolution: "typescript@patch:typescript@npm%3A4.9.3#~builtin<compat/typescript>::version=4.9.3&hash=d73830"
|
||||
"typescript@patch:typescript@^4.9.4#~builtin<compat/typescript>":
|
||||
version: 4.9.4
|
||||
resolution: "typescript@patch:typescript@npm%3A4.9.4#~builtin<compat/typescript>::version=4.9.4&hash=d73830"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: 67ca21a387c0572f1c04936e638dde7782c5aa520c3754aadc7cc9b7c915da9ebc3e27c601bfff4ccb7d7264e82dce6d277ada82ec09dc75024349e0ef64926d
|
||||
checksum: 37f6e2c3c5e2aa5934b85b0fddbf32eeac8b1bacf3a5b51d01946936d03f5377fe86255d4e5a4ae628fd0cd553386355ad362c57f13b4635064400f3e8e05b9d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
|
Loading…
Reference in a new issue