Skip to content

Commit

Permalink
Merge pull request #98 from kitcc-org/97-common-prettier-setting
Browse files Browse the repository at this point in the history
フォーマッタの設定を共通化した
  • Loading branch information
kimurash authored Oct 28, 2024
2 parents 0450d00 + 57ac465 commit 6e3b86c
Show file tree
Hide file tree
Showing 76 changed files with 1,872 additions and 1,803 deletions.
3 changes: 2 additions & 1 deletion backend/.prettierrc → .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"printWidth": 80,
"singleQuote": true,
"semi": true,
"useTabs": true
"useTabs": true,
"trailingComma": "all"
}
11 changes: 7 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"eslint.workingDirectories": ["./frontend", "./backend"],
"prettier.configPath": ".prettierrc"
}
110 changes: 55 additions & 55 deletions backend/package.json
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
{
"name": "kitcc-library-api",
"version": "0.0.0",
"private": true,
"type": "module",
"packageManager": "pnpm@9.12.0",
"scripts": {
"deploy": "wrangler deploy",
"dev": "wrangler dev",
"format": "npx prettier . --write",
"lint": "npx eslint --fix --cache --cache-location ./node_modules/.cache/eslint .",
"start": "wrangler dev",
"test": "vitest",
"cf-typegen": "wrangler types",
"db:mig:gen": "pnpm drizzle-kit generate",
"db:mig:ls": "wrangler d1 migrations list kitcc-lib-db",
"db:mig:apply": "wrangler d1 migrations apply kitcc-lib-db",
"db:seed": "wrangler d1 execute kitcc-lib-db --file=./drizzle/seeds/${file}",
"db:studio": "drizzle-kit studio --config drizzle.config.local.ts",
"prepare": "husky"
},
"lint-staged": {
"*.{ts, tsx, js, jsx}": [
"prettier --write",
"eslint --fix"
]
},
"devDependencies": {
"@cloudflare/vitest-pool-workers": "^0.5.16",
"@cloudflare/workers-types": "^4.20241004.0",
"@eslint/compat": "^1.2.1",
"@eslint/js": "^9.13.0",
"@faker-js/faker": "^9.0.3",
"@types/node": "^22.7.5",
"better-sqlite3": "^11.3.0",
"drizzle-kit": "^0.24.2",
"eslint": "^9.13.0",
"eslint-config-prettier": "^9.1.0",
"factory.ts": "^1.4.1",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"orval": "^7.1.1",
"prettier": "3.3.3",
"tsx": "^4.19.1",
"typescript": "^5.6.3",
"vitest": "2.0.5",
"wrangler": "^3.80.2"
},
"dependencies": {
"@hono/zod-validator": "^0.3.0",
"camelcase": "^8.0.0",
"drizzle-orm": "^0.33.0",
"hono": "^4.6.3",
"jsonpath-plus": "^10.0.0",
"zod": "^3.23.8"
}
"name": "kitcc-library-api",
"version": "0.0.0",
"private": true,
"type": "module",
"packageManager": "pnpm@9.12.0",
"scripts": {
"deploy": "wrangler deploy",
"dev": "wrangler dev",
"format": "npx prettier . --write --config ../.prettierrc",
"lint": "npx eslint --fix --cache --cache-location ./node_modules/.cache/eslint .",
"start": "wrangler dev",
"test": "vitest",
"cf-typegen": "wrangler types",
"db:mig:gen": "pnpm drizzle-kit generate",
"db:mig:ls": "wrangler d1 migrations list kitcc-lib-db",
"db:mig:apply": "wrangler d1 migrations apply kitcc-lib-db",
"db:seed": "wrangler d1 execute kitcc-lib-db --file=./drizzle/seeds/${file}",
"db:studio": "drizzle-kit studio --config drizzle.config.local.ts",
"prepare": "husky"
},
"lint-staged": {
"*.{ts, tsx, js, jsx}": [
"prettier --write",
"eslint --fix"
]
},
"devDependencies": {
"@cloudflare/vitest-pool-workers": "^0.5.16",
"@cloudflare/workers-types": "^4.20241004.0",
"@eslint/compat": "^1.2.1",
"@eslint/js": "^9.13.0",
"@faker-js/faker": "^9.0.3",
"@types/node": "^22.7.5",
"better-sqlite3": "^11.3.0",
"drizzle-kit": "^0.24.2",
"eslint": "^9.13.0",
"eslint-config-prettier": "^9.1.0",
"factory.ts": "^1.4.1",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"orval": "^7.1.1",
"prettier": "3.3.3",
"tsx": "^4.19.1",
"typescript": "^5.6.3",
"vitest": "2.0.5",
"wrangler": "^3.80.2"
},
"dependencies": {
"@hono/zod-validator": "^0.3.0",
"camelcase": "^8.0.0",
"drizzle-orm": "^0.33.0",
"hono": "^4.6.3",
"jsonpath-plus": "^10.0.0",
"zod": "^3.23.8"
}
}
3 changes: 2 additions & 1 deletion backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ app.use(
origin.includes('localhost') ||
origin.includes('kitcc-library-web.pages.dev')
? origin
: 'https://kitcc-library-web.pages.dev/');
: 'https://kitcc-library-web.pages.dev'
);
},
// リクエストに含めることができるヘッダ
allowHeaders: ['Cookie', 'Content-Type'],
Expand Down
147 changes: 76 additions & 71 deletions frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,79 +6,84 @@

/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
commonjs: true,
es6: true,
},
ignorePatterns: ["!**/.server", "!**/.client"],
root: true,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
commonjs: true,
es6: true,
},
ignorePatterns: ['!**/.server', '!**/.client'],

// Base config
extends: ["eslint:recommended"],
// Base config
extends: ['eslint:recommended', 'prettier'],

overrides: [
// React
{
files: ["**/*.{js,jsx,ts,tsx}"],
plugins: ["react", "jsx-a11y"],
extends: [
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
],
settings: {
react: {
version: "detect",
},
formComponents: ["Form"],
linkComponents: [
{ name: "Link", linkAttribute: "to" },
{ name: "NavLink", linkAttribute: "to" },
],
"import/resolver": {
typescript: {},
},
},
},
overrides: [
// React
{
files: ['**/*.{js,jsx,ts,tsx}'],
plugins: ['react', 'jsx-a11y'],
extends: [
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
],

// Typescript
{
files: ["**/*.{ts,tsx}"],
plugins: ["@typescript-eslint", "import"],
parser: "@typescript-eslint/parser",
settings: {
"import/internal-regex": "^~/",
"import/resolver": {
node: {
extensions: [".ts", ".tsx"],
},
typescript: {
alwaysTryTypes: true,
},
},
},
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
],
},
rules: {
'react/prop-types': 'off',
},

// Node
{
files: [".eslintrc.cjs"],
env: {
node: true,
},
},
],
settings: {
react: {
version: 'detect',
},
formComponents: ['Form'],
linkComponents: [
{ name: 'Link', linkAttribute: 'to' },
{ name: 'NavLink', linkAttribute: 'to' },
],
'import/resolver': {
typescript: {},
},
},
},

// Typescript
{
files: ['**/*.{ts,tsx}'],
plugins: ['@typescript-eslint', 'import'],
parser: '@typescript-eslint/parser',
settings: {
'import/internal-regex': '^~/',
'import/resolver': {
node: {
extensions: ['.ts', '.tsx'],
},
typescript: {
alwaysTryTypes: true,
},
},
},
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
],
},

// Node
{
files: ['.eslintrc.cjs'],
env: {
node: true,
},
},
],
};
21 changes: 21 additions & 0 deletions frontend/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# dependencies
node_modules/

# production
public/

#orval
client/
test/mocks/

# misc
.DS_Store
*.pem

.eslintrc.cjs
postcss.config.cjs
postcss.config.js
package.json
pnpm-lock.yaml
tsconfig.json
vite.config.ts
30 changes: 15 additions & 15 deletions frontend/app/components/book-detail/BookDetailAuthorBadge.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { Badge } from '@mantine/core'
import { Badge } from '@mantine/core';

interface BookDetailAuthorBadgeProps {
name: string
name: string;
}

const BookDetailAuthorBadge = ({ name }: BookDetailAuthorBadgeProps) => {
return (
<Badge
component='a'
href={`/home?author=${name}`}
style={{ cursor: 'pointer' }}
variant='outline'
size='lg'
>
{name}
</Badge >
)
}
return (
<Badge
component="a"
href={`/home?author=${name}`}
style={{ cursor: 'pointer' }}
variant="outline"
size="lg"
>
{name}
</Badge>
);
};

export default BookDetailAuthorBadge
export default BookDetailAuthorBadge;
Loading

0 comments on commit 6e3b86c

Please sign in to comment.