Skip to content

Commit

Permalink
Merge pull request #19 from SIT-DigiCre/feature/ci-cd
Browse files Browse the repository at this point in the history
CIの導入
  • Loading branch information
newt239 authored Jan 4, 2025
2 parents e6730f9 + 65e0363 commit bebd7c6
Show file tree
Hide file tree
Showing 10 changed files with 464 additions and 386 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint Code Base
on:
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout target branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: lts/*
- name: Setup pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
version: 9
- name: Install dependencies
run: pnpm install
- name: TypeScript Compile Check
run: pnpm tsc --noEmit
- name: Run ESLint
run: pnpm lint
- name: Run Prettier
run: pnpm format --check
- name: Run Stylelint
run: pnpm stylelint
32 changes: 11 additions & 21 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
import { FlatCompat } from "@eslint/eslintrc";
import { dirname } from "path";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
import { FlatCompat } from '@eslint/eslintrc';
import eslintConfigPrettier from 'eslint-config-prettier';

const compat = new FlatCompat({
baseDirectory: __dirname,
});
// import.meta.dirname is available after Node.js v20.11.0
baseDirectory: import.meta.dirname,
})

const eslintConfig = [
{
ignores: ["node_modules/", ".next/"],
},
...compat.extends("next/core-web-vitals", "next/typescript"),
importPlugin.flatConfigs.recommended,
eslintConfigPrettier,
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
"import/order": [
"error",
Expand All @@ -34,14 +29,9 @@ const eslintConfig = [
"pathGroups": [
{
"pattern": "{react,react-dom/**,react-router-dom,next,next/**}",
"group": "bulitin",
"group": "builtin",
"position": "before"
},
{
"pattern": "@mantine/**",
"group": "builtin",
"position": "after"
}
],
"pathGroupsExcludedImportTypes": ["builtin"],
"alphabetize": {
Expand All @@ -54,4 +44,4 @@ const eslintConfig = [
},
];

export default eslintConfig;
export default eslintConfig;
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "next build",
"start": "next start",
"format": "prettier --write \"./src/**/*.{ts,tsx}\"",
"lint": "next lint",
"lint": "eslint",
"stylelint": "stylelint \"./src/**/*.css\" --fix"
},
"dependencies": {
Expand All @@ -22,14 +22,16 @@
"react-dom": "^19.0.0"
},
"devDependencies": {
"eslint": "^9.16.0",
"@eslint/eslintrc": "^3",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-prettier": "^9.1.0",
"eslint-config-next": "15.1.0",
"eslint-plugin-import": "^2.31.0",
"prettier": "^3.4.2",
"typescript-eslint": "^8.19.0",
"stylelint": "^16.11.0",
"stylelint-config-recess-order": "^5.1.1",
"stylelint-config-standard": "^36.0.1",
Expand Down
Loading

0 comments on commit bebd7c6

Please sign in to comment.