234 文字
1 分

ESLint Config InspectorをGithub Pagesにデプロイする

ESLint Config Inspector#

ESLint Config Inspector は、設定ファイルを解析し、設定ファイルの構造を可視化するためのツールである。 ESLint v9 から次のようにコマンドを打てば利用できるようになった。

Terminal window
npx eslint --inspect-config

また @eslint/config-inspectorパッケージ経由でも利用することが出来る。

Terminal window
npx @eslint/config-inspector

実行すると、設定を可視化した Web ページが表示される。

Build Inspector#

ESLint Config Inspector は次のコマンドで静的なファイルを吐ける。

npx @eslint/config-inspector build

Github Pages にデプロイする#

ESLint config プラグインを提供しているリポジトリで、Config Inspector を Github Pages で提供した。

name: Deploy Inspector
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: package.json
- name: Install dependencies
uses: npm install
- name: Build Inspector
run: |
npx @eslint/config-inspector build --base /REPOSITORY_NAME/
- uses: actions/upload-pages-artifact@v3
with:
path: ./.eslint-config-inspector
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/deploy-pages@v4
id: deployment
ESLint Config InspectorをGithub Pagesにデプロイする
https://blog.ohirunewani.com/posts/eslint-config-inspector-github-pages/
作者
hrdtbs
公開日
2024-05-30
ライセンス
CC BY-NC-SA 4.0