From 4e956e53b489785a6f5984200e68a7cde75afa12 Mon Sep 17 00:00:00 2001 From: David Lima Date: Mon, 8 Sep 2025 19:22:59 -0300 Subject: [PATCH] feat: implement lint stylelint action Signed-off-by: David Lima --- .github/workflows/lint-stylelint.yml | 53 +++++++++++++++++++++ package-lock.json | 8 ++-- stylelint.config.js => stylelint.config.cjs | 4 +- 3 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/lint-stylelint.yml rename stylelint.config.js => stylelint.config.cjs (55%) diff --git a/.github/workflows/lint-stylelint.yml b/.github/workflows/lint-stylelint.yml new file mode 100644 index 0000000..0066ae1 --- /dev/null +++ b/.github/workflows/lint-stylelint.yml @@ -0,0 +1,53 @@ +# 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: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: Lint stylelint + +on: pull_request + +permissions: + contents: read + +concurrency: + group: lint-stylelint-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-latest + + name: stylelint + + steps: + - name: Checkout + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + 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: "^20" + fallbackNpm: "^10" + + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} + uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.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: Lint + run: npm run stylelint diff --git a/package-lock.json b/package-lock.json index bffef1f..6949ca2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7546,9 +7546,9 @@ } }, "node_modules/stylelint": { - "version": "16.23.1", - "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.23.1.tgz", - "integrity": "sha512-dNvDTsKV1U2YtiUDfe9d2gp902veFeo3ecCWdGlmLm2WFrAV0+L5LoOj/qHSBABQwMsZPJwfC4bf39mQm1S5zw==", + "version": "16.24.0", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.24.0.tgz", + "integrity": "sha512-7ksgz3zJaSbTUGr/ujMXvLVKdDhLbGl3R/3arNudH7z88+XZZGNLMTepsY28WlnvEFcuOmUe7fg40Q3lfhOfSQ==", "dev": true, "funding": [ { @@ -7576,7 +7576,7 @@ "debug": "^4.4.1", "fast-glob": "^3.3.3", "fastest-levenshtein": "^1.0.16", - "file-entry-cache": "^10.1.3", + "file-entry-cache": "^10.1.4", "global-modules": "^2.0.0", "globby": "^11.1.0", "globjoin": "^0.1.4", diff --git a/stylelint.config.js b/stylelint.config.cjs similarity index 55% rename from stylelint.config.js rename to stylelint.config.cjs index 8270a5a..e85591c 100644 --- a/stylelint.config.js +++ b/stylelint.config.cjs @@ -2,6 +2,6 @@ * SPDX-FileCopyrightText: 2025 LibreCode coop and contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -import stylelintConfig from '@nextcloud/stylelint-config' +const stylelintConfig = require('@nextcloud/stylelint-config') -export { stylelintConfig } +module.exports = stylelintConfig