Skip to content

Commit 14be4e1

Browse files
authored
Merge pull request #129 from LibreCodeCoop/feat/lint-eslint
feat: implement lint eslint action
2 parents 2752ca9 + 24070f0 commit 14be4e1

File tree

4 files changed

+107
-9
lines changed

4 files changed

+107
-9
lines changed

.github/workflows/lint-eslint.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Lint eslint
10+
11+
on: pull_request
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: lint-eslint-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
changes:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: read
25+
pull-requests: read
26+
27+
outputs:
28+
src: ${{ steps.changes.outputs.src}}
29+
30+
steps:
31+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
32+
id: changes
33+
continue-on-error: true
34+
with:
35+
filters: |
36+
src:
37+
- '.github/workflows/**'
38+
- 'src/**'
39+
- 'appinfo/info.xml'
40+
- 'package.json'
41+
- 'package-lock.json'
42+
- 'tsconfig.json'
43+
- '.eslintrc.*'
44+
- '.eslintignore'
45+
- '**.js'
46+
- '**.ts'
47+
- '**.vue'
48+
49+
lint:
50+
runs-on: ubuntu-latest
51+
52+
needs: changes
53+
if: needs.changes.outputs.src != 'false'
54+
55+
name: NPM lint
56+
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
60+
with:
61+
persist-credentials: false
62+
63+
- name: Read package.json node and npm engines version
64+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
65+
id: versions
66+
with:
67+
fallbackNode: "^20"
68+
fallbackNpm: "^10"
69+
70+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
71+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
72+
with:
73+
node-version: ${{ steps.versions.outputs.nodeVersion }}
74+
75+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
76+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
77+
78+
- name: Install dependencies
79+
env:
80+
CYPRESS_INSTALL_BINARY: 0
81+
PUPPETEER_SKIP_DOWNLOAD: true
82+
run: npm ci
83+
84+
- name: Lint
85+
run: npm run lint
86+
87+
summary:
88+
permissions:
89+
contents: none
90+
runs-on: ubuntu-latest
91+
needs: [changes, lint]
92+
93+
if: always()
94+
95+
# This is the summary, we just avoid to rename it so that branch protection rules still match
96+
name: eslint
97+
98+
steps:
99+
- name: Summary status
100+
run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi

eslint.config.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import globals from 'globals'
88

99
export default [
1010
...recommended,
11-
1211
{
1312
name: 'extract/ignores',
1413
ignores: [
@@ -17,9 +16,9 @@ export default [
1716
'js/*',
1817
// TODO: upstream
1918
'openapi-*.json',
19+
'node_modules',
2020
],
2121
},
22-
2322
{
2423
name: 'extract/config',
2524
languageOptions: {
@@ -30,7 +29,6 @@ export default [
3029
},
3130
},
3231
},
33-
3432
{
3533
name: 'extract/disabled-during-migration',
3634
rules: {

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
"scripts": {
1414
"build": "vite build --mode production",
1515
"dev": "vite build --mode development",
16-
"watch": "vite build --mode development --watch",
17-
"typescript:check": "tsc --noEmit",
18-
"typescript:generate": "npx openapi-typescript ./openapi.json -t -o src/types/openapi/openapi.ts",
1916
"lint": "eslint",
2017
"lint:fix": "eslint --fix",
2118
"stylelint": "stylelint css/*.css css/*.scss src/**/*.scss",
22-
"stylelint:fix": "stylelint css/*.css css/*.scss src/**/*.scss --fix"
19+
"stylelint:fix": "stylelint css/*.css css/*.scss src/**/*.scss --fix",
20+
"typescript:check": "tsc --noEmit",
21+
"typescript:generate": "npx openapi-typescript ./openapi.json -t -o src/types/openapi/openapi.ts",
22+
"watch": "vite build --mode development --watch"
2323
},
2424
"browserslist": [
2525
"extends @nextcloud/browserslist-config"

stylelint.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
* SPDX-FileCopyrightText: 2025 LibreCode coop and contributors
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
5-
import stylelintConfig from "@nextcloud/stylelint-config";
5+
import stylelintConfig from '@nextcloud/stylelint-config'
66

7-
export { stylelintConfig };
7+
export { stylelintConfig }

0 commit comments

Comments
 (0)