Files
RSSHub/.github/workflows/lint.yml
T
Tony 1acb805799 style: migrate eslint to oxlint (#21224)
* chore: add oxlint support

* style: apply autofix

* style: apply autofix for toSorted

* style: use alternative api for nsfw-flag jsPlugins

* fix: git diff

* fix: codeql

* test: console.log

* style: update lint workflow to use Checkstyle SARIF converter

* style: remove debug log from extractDateFromURL function

* chore: use oxlint-json-to-sarif

* test: console.log

* test: remove console.log

* test: update cookie data expectation in getCookies test

https://github.com/mccutchen/go-httpbin/pull/235 breaks this

* style: type-aware linting

* style: enable type-aware linting for oxlint
2026-02-28 21:23:11 +08:00

71 lines
2.8 KiB
YAML

name: Linter
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
# pull_request includes [opened, reopened, synchronize] events by default
# 'edited' is required for title-lint
on:
push: {}
pull_request:
types: [opened, reopened, synchronize, edited]
pull_request_target:
types: [opened, reopened, synchronize, edited]
jobs:
# https://github.com/actions/starter-workflows/blob/main/code-scanning/eslint.yml
eslint-warning:
name: Lint
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
security-events: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: lts/*
cache: 'pnpm'
- run: pnpm i
- name: Install oxlint to SARIF converter
run: pnpm i -g oxlint-json-to-sarif
- name: Lint
run: pnpm exec oxlint --type-aware
--format=json | oxlint-json-to-sarif > oxlint-results.sarif
continue-on-error: true
- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: oxlint-results.sarif
wait-for-processing: true
- name: Upload Artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
path: oxlint-results.sarif
# https://github.com/amannn/action-semantic-pull-request
title-lint:
if: ${{ github.event_name == 'pull_request_target' && github.repository == 'DIYgod/RSSHub' }}
name: Validate PR title
runs-on: ubuntu-slim
timeout-minutes: 5
steps:
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ignoreLabels: |
dependencies
wip: true
labeler:
name: Pull Request Labeler
if: ${{ github.event_name == 'pull_request_target' && github.actor != 'dependabot[bot]' && github.repository == 'DIYgod/RSSHub' }}
permissions:
pull-requests: write
runs-on: ubuntu-slim
timeout-minutes: 5
steps:
- uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}