Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/lint-typescript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT

name: Type checking

on:
pull_request:
push:
branches:
- main
- master
- stable*

permissions:
contents: read

concurrency:
group: lint-typescript-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
changes:
runs-on: ubuntu-latest-low
permissions:
contents: read
pull-requests: read

outputs:
src: ${{ steps.changes.outputs.src}}

steps:
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
continue-on-error: true
with:
filters: |
src:
- '.github/workflows/lint-typescript.yml'
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
- '**.ts'
- '**.vue'

test:
runs-on: ubuntu-latest

needs: changes
if: needs.changes.outputs.src != 'false'

steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
id: versions
with:
fallbackNode: '^24'
fallbackNpm: '^11.3'

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'

- name: Install dependencies
env:
CYPRESS_INSTALL_BINARY: 0
run: |
npm ci

- name: Check types
run: |
npm run --if-present check-types
npm run --if-present ts:check

summary:
permissions:
contents: none
runs-on: ubuntu-latest-low
needs: [changes, test]

if: always()

name: typescript-summary

steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' }}; then exit 1; fi
28 changes: 28 additions & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*
* Type declarations for TypeScript (globals, Vite asset imports, and modules).
*/

/// <reference types="vite/client" />

import { translate } from '@nextcloud/l10n'

declare global {
const t: typeof translate

const OCA: {
Approval: {
actionIgnoreLists: string[]
userRules?: unknown[]
}
}
}

declare module '*.svg?raw' {
const content: string
export default content
}

export {}
18 changes: 18 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"build": "NODE_ENV=production vite --mode production build",
"dev": "NODE_ENV=development vite --mode development build",
"watch": "NODE_ENV=development vite --mode development build --watch",
"lint": "eslint --ext .js,.vue src",
"lint:fix": "eslint --ext .js,.vue src --fix",
"lint": "eslint --ext .js,.ts,.vue src vite.config.js",
"lint:fix": "eslint --ext .js,.ts,.vue src vite.config.js --fix",
"check-types": "tsc --noEmit",
"stylelint": "stylelint src/**/*.vue src/**/*.scss src/**/*.css",
"stylelint:fix": "stylelint src/**/*.vue src/**/*.scss src/**/*.css --fix"
},
Expand Down Expand Up @@ -50,6 +51,7 @@
"vue-material-design-icons": "^5.1.1"
},
"devDependencies": {
"@types/node": "^24.0.0",
"@nextcloud/babel-config": "^1.2.0",
"@nextcloud/browserslist-config": "^3.0.1",
"@nextcloud/eslint-config": "^8.4.2",
Expand Down
2 changes: 1 addition & 1 deletion src/files/actions/requestAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const requestAction: IFileAction = {
}
return !OCA.Approval.actionIgnoreLists.includes(view.id)
&& !nodes.some(({ permissions }) => (permissions & Permission.READ) === 0)
&& OCA.Approval.userRules && OCA.Approval.userRules.length > 0
&& (OCA.Approval.userRules?.length ?? 0) > 0
// && nodes.every(({ type }) => type === FileType.File)
// && nodes.every(({ mime }) => mime === 'application/some+type')
},
Expand Down
1 change: 1 addition & 0 deletions src/files/actions/respondAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ export const respondAction: IFileAction = {
return null
},
async execBatch() {
return []
},
}
32 changes: 32 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"types": ["node"],
"allowJs": true,
"checkJs": false,
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"vite-plugin-eslint": ["./node_modules/vite-plugin-eslint/dist/index.d.ts"]
}
},
"include": [
"src/**/*.ts",
"vite.config.js",
"env.d.ts"
],
"exclude": ["node_modules"]
}
3 changes: 3 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
// eslint-disable-next-line n/no-unpublished-import
import { createAppConfig } from '@nextcloud/vite-config'
// eslint-disable-next-line n/no-unpublished-import
import eslint from 'vite-plugin-eslint'
// eslint-disable-next-line n/no-unpublished-import
import stylelint from 'vite-plugin-stylelint'
import { join } from 'path'

Expand Down
Loading