Skip to content

Commit

Permalink
Merge pull request #503 from senkenn/senkenn/issue#501
Browse files Browse the repository at this point in the history
Prettier v3 の全面的な導入と VSCode の設定
  • Loading branch information
cm-igarashi-ryosuke authored Aug 13, 2024
2 parents cb0d03b + 756eeca commit 3d8acd1
Show file tree
Hide file tree
Showing 18 changed files with 149 additions and 107 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
}
24 changes: 24 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,29 @@
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"devDependencies": {
"@lerna-lite/cli": "^1.15.1",
"npm-run-all": "^4.1.5",
"prettier": "^3.3.3",
"turbo": "^1.7.4"
},
"scripts": {
Expand All @@ -12,6 +13,7 @@
"lint:lockfile": "npx lockfile-lint --path pnpm-lock.yaml --allowed-hosts npm yarn --validate-https",
"strict:lint": "turbo strict:lint",
"fix": "turbo fix",
"fix:prettier": "turbo fix:prettier",
"publish:all": "pnpm test && pnpm build && lerna publish",
"publish:canary": "pnpm build && lerna publish --pre-dist-tag canary",
"test": "turbo test"
Expand Down
1 change: 1 addition & 0 deletions packages/zenn-cli/.prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/dist
*.md
1 change: 0 additions & 1 deletion packages/zenn-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"npm-run-all": "^4.1.5",
"open": "^8.4.1",
"path": "^0.12.7",
"prettier": "^2.8.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.7.1",
Expand Down
4 changes: 3 additions & 1 deletion packages/zenn-cli/src/client/components/Loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@ const StyledLoading = styled.div`
border: 4px solid var(--c-primary);
border-radius: 50%;
border-top-color: var(--c-primary-bg);
animation: ${rotate} 0.8s linear infinite, ${fadein} 0.7s;
animation:
${rotate} 0.8s linear infinite,
${fadein} 0.7s;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ const StyledBookHeader = styled.header`
.book-header__cover-img {
background: #fff;
object-fit: cover;
box-shadow: 0 9px 20px -9px rgba(0, 27, 68, 0.52),
box-shadow:
0 9px 20px -9px rgba(0, 27, 68, 0.52),
0 0 3px rgba(0, 21, 60, 0.1);
border-radius: 5px;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/zenn-cli/src/client/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="ja">
<head>
<meta charset="utf-8" />
Expand Down
6 changes: 5 additions & 1 deletion packages/zenn-cli/src/server/commands/init.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { CliExecFn } from '../types';
import * as Log from '../lib/log';
import { detectPackageExecutor, getWorkingPath, generateFileIfNotExist } from '../lib/helper';
import {
detectPackageExecutor,
getWorkingPath,
generateFileIfNotExist,
} from '../lib/helper';
import { initHelpText, invalidOptionText } from '../lib/messages';
import arg from 'arg';

Expand Down
4 changes: 3 additions & 1 deletion packages/zenn-content-css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"scripts": {
"dev": "sass ./src/index.scss ./lib/index.css --watch --no-source-map",
"build": "sass ./src/index.scss ./lib/index.css --style compressed --no-source-map",
"test": "echo 'no test yet'"
"test": "echo 'no test yet'",
"lint:prettier": "prettier ./src",
"fix:prettier": "prettier -w ./src"
},
"devDependencies": {
"sass": "^1.58.1"
Expand Down
2 changes: 2 additions & 0 deletions packages/zenn-embed-elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
"build": "pnpm clean && run-p build:*",
"build:tsc": "tsc -p .",
"lint": "eslint . --ext .ts,.tsx",
"lint:prettier": "prettier .",
"fix": "eslint . --ext .ts,.tsx --fix",
"fix:prettier": "prettier -w .",
"strict:lint": "eslint . --ext .ts,.tsx --max-warnings 0",
"test": "echo 'no test yet'"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { isCodesandboxUrl } from '../../src/utils/url-matcher';
describe('isCodesandboxUrlのテスト', () => {
describe('Trueを返す場合', () => {
test('Codesandboxの埋め込みURL', () => {
const url =
'https://codesandbox.io/embed/new?view=Editor+%2B+Preview';
const url = 'https://codesandbox.io/embed/new?view=Editor+%2B+Preview';

expect(isCodesandboxUrl(url)).toBe(true);
});
Expand Down
2 changes: 2 additions & 0 deletions packages/zenn-markdown-html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
"build:src": "babel ./src --extensions '.ts,.tsx' --ignore '**/*.d.ts' --out-dir ./lib",
"build:types": "tsc --project ./tsconfig.build.json",
"lint": "eslint . --ext .ts,.tsx",
"lint:prettier": "prettier .",
"fix": "eslint . --ext .ts,.tsx --fix",
"fix:prettier": "prettier -w .",
"strict:lint": "eslint . --ext .ts,.tsx --max-warnings 0",
"test": "vitest run"
},
Expand Down
4 changes: 3 additions & 1 deletion packages/zenn-markdown-html/src/utils/md-link-attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export function mdLinkAttributes(md: MarkdownIt) {
// 内部リンク
{
matcher(href: string) {
return href.match(/^(?:https:\/\/zenn\.dev$)|(?:https:\/\/zenn\.dev\/.*$)/);
return href.match(
/^(?:https:\/\/zenn\.dev$)|(?:https:\/\/zenn\.dev\/.*$)/
);
},
attrs: {
target: '_blank',
Expand Down
2 changes: 2 additions & 0 deletions packages/zenn-model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"build:src": "esbuild ./src/*.ts --format=cjs --outdir=lib",
"build:types": "tsc --project ./tsconfig.build.json",
"lint": "eslint . --ext .ts,.tsx",
"lint:prettier": "prettier .",
"fix": "eslint . --ext .ts,.tsx --fix",
"fix:prettier": "prettier -w .",
"strict:lint": "eslint . --ext .ts,.tsx --max-warnings 0",
"test": "vitest run"
},
Expand Down
Loading

0 comments on commit 3d8acd1

Please sign in to comment.