Skip to content

Commit

Permalink
chore: Add typescript support
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr authored and max-nextcloud committed May 13, 2024
1 parent f81b539 commit 1d50eae
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ module.exports = {
root: true,
extends: [
'@nextcloud',
'@nextcloud/eslint-config/typescript',
],
rules: {
'@typescript-eslint/no-unused-vars': ['off'],
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"build": "vite --mode production build",
"dev": "vite --mode development build",
"watch": "vite --mode development build --watch",
"lint": "eslint --ext .js,.vue src cypress",
"lint:fix": "eslint --ext .js,.vue src cypress --fix",
"lint": "tsc && eslint --ext .js,.vue src cypress",
"lint:fix": "tsc && eslint --ext .js,.vue src cypress --fix",
"stylelint": "stylelint src/**/*.vue src/**/*.scss src/**/*.css css/*.scss",
"stylelint:fix": "stylelint src/**/*.vue src/**/*.scss src/**/*.css css/*.scss --fix",
"test": "NODE_ENV=test jest",
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/base64.js → src/helpers/base64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { toBase64, fromBase64 } from 'lib0/buffer'
*
* @param {ArrayBuffer} data - binary data to encode
*/
export function encodeArrayBuffer(data) {
export function encodeArrayBuffer(data: ArrayBuffer): string {
const view = new Uint8Array(data)
return toBase64(view)
}
Expand All @@ -43,6 +43,6 @@ export function encodeArrayBuffer(data) {
*
* @param {string} encoded - base64 encoded string to decode
*/
export function decodeArrayBuffer(encoded) {
export function decodeArrayBuffer(encoded: string): ArrayBuffer {
return fromBase64(encoded)
}
2 changes: 1 addition & 1 deletion src/helpers/yjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

import { encodeArrayBuffer, decodeArrayBuffer } from '../helpers/base64.js'
import { encodeArrayBuffer, decodeArrayBuffer } from '../helpers/base64.ts'
import * as Y from 'yjs'
import * as decoding from 'lib0/decoding.js'
import * as encoding from 'lib0/encoding.js'
Expand Down
2 changes: 1 addition & 1 deletion src/services/WebSocketPolyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

import { logger } from '../helpers/logger.js'
import { encodeArrayBuffer, decodeArrayBuffer } from '../helpers/base64.js'
import { encodeArrayBuffer, decodeArrayBuffer } from '../helpers/base64.ts'

/**
*
Expand Down

0 comments on commit 1d50eae

Please sign in to comment.