Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lintをciで動かす #16

Merged
merged 6 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
51 changes: 51 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "next lintをかける"

on:
pull_request:
paths:
- "**/*.ts"
- "**/*.tsx"

jobs:
nextlint:
runs-on: ubuntu-latest
steps:
- name: "checkoutする"
uses: actions/checkout@v3

- name: "Node.jsのセットアップ"
uses: actions/setup-node@v3
with:
node-version: 20
- name: "pnpmのセットアップ"
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 8
run_install: false
- name: "reviewdogのインストール"
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest

- name: "pnpmのパッケージ保存先を保持"
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: "キャッシュを使う"
uses: actions/cache@v3
id: pnpm-cache-node_modules
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-node_modules-
- name: "パッケージのインストール"
run: pnpm install

- name: "next lintの実行 with reviewdog"
run: |
pnpm run lint -f checkstyle | reviewdog -f checkstyle --name=nextlint -reporter=github-pr-review
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

2 changes: 1 addition & 1 deletion app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { NextPage, Metadata} from "next";
import Link from "next/link";
import Card from "modules/article/components/card";
import Link from "next/link";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [nextlint] <eslint.rules.import/order> reported by reviewdog 🐶
next/link import should occur before import of modules/article/components/card (import/order)

import { getCurrentPage } from "modules/pages/functions";

const TOP_PAGE_INDEX = 0;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"lint": "eslint -f stylish ./modules ./app",
"format": "prettier --write --ignore-path .gitignore './**/*.{js,jsx,ts,tsx,json}'"
},
"keywords": [],
Expand Down