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

Bump prettier from 2.8.4 to 3.0.3 #62

Merged
merged 2 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"jest": "^29.4.3",
"lint-staged": "^13.2.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.4",
"prettier": "^3.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.8.1",
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/ArticleInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const ArticleInfo = ({
isOlderThanRemote,
}: Props) => {
const [isOpen, setIsOpen] = useState(
localStorage.getItem("openInfoState") === "true" ? true : false
localStorage.getItem("openInfoState") === "true" ? true : false,
);

const toggleAccordion = (event: React.MouseEvent<HTMLInputElement>) => {
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const Header = ({
if (isOlderThanRemote) {
if (
!window.confirm(
"この記事はQiita上の記事より古い可能性があります。上書きしますか?"
"この記事はQiita上の記事より古い可能性があります。上書きしますか?",
)
) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/HotReloadRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const HotReloadRoot = ({ children }: Props) => {

export const useHotReloadEffect = (
callback: () => unknown,
deps: unknown[]
deps: unknown[],
) => {
const { reloadedAt } = useContext(HotReloadContext);

Expand Down
4 changes: 2 additions & 2 deletions src/client/components/SidebarArticles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const SidebarArticles = ({ items, sortType, articleState }: Props) => {
};

const [isDetailsOpen, setIsDetailsOpen] = useState(
localStorage.getItem(StorageName[articleState]) === "true"
localStorage.getItem(StorageName[articleState]) === "true",
);

const toggleAccordion = (event: React.MouseEvent<HTMLInputElement>) => {
Expand Down Expand Up @@ -138,7 +138,7 @@ const articlesListItemStyle = css({
gap: getSpace(1),
lineHeight: LineHeight.bodyDense,
padding: `${getSpace(3 / 4)}px ${getSpace(5 / 2)}px ${getSpace(
3 / 4
3 / 4,
)}px ${getSpace(3 / 2)}px`,
whiteSpace: "nowrap",
textOverflow: "ellipsis",
Expand Down
4 changes: 2 additions & 2 deletions src/client/components/SidebarContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type SortType = (typeof SortType)[keyof typeof SortType];
export const SidebarContents = ({ isStateOpen, handleMobileClose }: Props) => {
const [items, setItems] = useState<ItemsIndexViewModel>();
const [isOpen, setIsOpen] = useState(
localStorage.getItem("openSidebarState") === "true"
localStorage.getItem("openSidebarState") === "true",
);

const [sortType, setSortType] = useState<SortType>(SortType.ByUpdatedAt);
Expand Down Expand Up @@ -646,7 +646,7 @@ const articlesListItemStyle = css({
gap: getSpace(1),
lineHeight: LineHeight.bodyDense,
padding: `${getSpace(3 / 4)}px ${getSpace(5 / 2)}px ${getSpace(
3 / 4
3 / 4,
)}px ${getSpace(3 / 2)}px`,
whiteSpace: "nowrap",
textOverflow: "ellipsis",
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/Slide/SlideViewerContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const SlideViewerContent = ({
onPrevious();
}
},
[onPrevious, onNext]
[onPrevious, onNext],
);

return (
Expand Down
8 changes: 6 additions & 2 deletions src/client/components/Slide/SlideViewerDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ export const SlideViewerDashboard = ({
onMouseMove={(event) => {
setIsTooltipVisible(true);
setTooltipLeftDistance(
event.clientX - event.currentTarget.getBoundingClientRect().left
event.clientX - event.currentTarget.getBoundingClientRect().left,
);
setDestinationPage(
getMagnitudeFromRange(event.currentTarget, event.clientX, totalPage)
getMagnitudeFromRange(
event.currentTarget,
event.clientX,
totalPage,
),
);
}}
onMouseLeave={() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const SlideViewerDashboardNavigation = ({
"slideMode-Dashboard_button--prev",
{
"slideMode-Dashboard_button--clickable": !disablePrevious,
}
},
)}
disabled={disablePrevious}
onClick={() => onPrevious()}
Expand All @@ -41,7 +41,7 @@ export const SlideViewerDashboardNavigation = ({
"slideMode-Dashboard_button--next",
{
"slideMode-Dashboard_button--clickable": !disableNext,
}
},
)}
disabled={disableNext}
onClick={() => onNext()}
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/Slide/get-magnitude-from-range.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function getMagnitudeFromRange(
target: Element,
x: number,
length: number
length: number,
) {
const rect = target.getBoundingClientRect();
return Math.ceil((x - rect.left) / (rect.width / length));
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/Slide/slide-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const slidePages = (article: {
body: string;
}): string[] => [
`<h1>${escape(
article.title
article.title,
)}</h1><div class="slideMode-Viewer_content--firstSlideAuthor">by ${
article.author.urlName
}</div>`,
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/Snackbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const Snackbar = ({ message, setMessage }: Props) => {

const snackbarStyle = (
isMessageExists: boolean,
isMessageTypeSuccess: boolean
isMessageTypeSuccess: boolean,
) =>
css({
alignItems: "center",
Expand Down
4 changes: 2 additions & 2 deletions src/client/components/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const Tooltip = ({
handleHide();
}
},
[isShow, handleHide]
[isShow, handleHide],
);

useEffect(() => {
Expand Down Expand Up @@ -77,7 +77,7 @@ const toolTipItemStyle = (
isShow: boolean,
horizontal: string,
vertical: string,
offset: number
offset: number,
) =>
css({
visibility: isShow ? "visible" : "hidden",
Expand Down
2 changes: 1 addition & 1 deletion 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
2 changes: 1 addition & 1 deletion src/client/lib/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const entries = <T extends {}>(o: T) => {

// Wrapped Object.fromEntries with strict type
export const fromEntries = <K extends PropertyKey, V>(
e: Iterable<readonly [K, V]>
e: Iterable<readonly [K, V]>,
) => {
return Object.fromEntries(e) as { [key in K]: V };
};
2 changes: 1 addition & 1 deletion src/client/lib/mixins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ export const breakpoint = {
XXL: 2559,
} as const;
export const viewport = fromEntries(
entries(breakpoint).map(([k, v]) => [k, viewportMaker(v)])
entries(breakpoint).map(([k, v]) => [k, viewportMaker(v)]),
);
2 changes: 1 addition & 1 deletion src/client/lib/window-size.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const useWindowSize = () => {
}, [isClient]);

const [windowDimensions, setWindowDimensions] = useState(
getWindowDimensions()
getWindowDimensions(),
);
useEffect(() => {
const onResize = () => {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const rootDir = process.cwd();
const workflowsDirectoryPath = path.join(rootDir, ".github/workflows");
const publishWorkflowFilePath = path.join(
workflowsDirectoryPath,
"publish.yml"
"publish.yml",
);

const gitignoreFilePath = path.join(rootDir, ".gitignore");
Expand All @@ -62,7 +62,7 @@ export const init = async () => {
const userConfigFileContent = JSON.stringify(
await config.getUserConfig(),
null,
2
2,
);
writeFile(userConfigFilePath, userConfigFileContent);

Expand Down
2 changes: 1 addition & 1 deletion src/commands/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const login = async () => {
console.log(`
以下のURLにアクセスしてトークンを発行してください。(「read_qiita」と「write_qiita」にチェックを入れてください)
${chalk.bold(
"https://qiita.com/settings/tokens/new?read_qiita=1&write_qiita=1&description=qiita-cli"
"https://qiita.com/settings/tokens/new?read_qiita=1&write_qiita=1&description=qiita-cli",
)}
`);
const token = await rl.question("発行したトークンを入力: ");
Expand Down
41 changes: 22 additions & 19 deletions src/commands/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const publish = async (argv: string[]) => {
"--force": Boolean,
"-f": "--force",
},
{ argv }
{ argv },
);

const qiitaApi = await getQiitaApiInstance();
Expand Down Expand Up @@ -44,27 +44,30 @@ export const publish = async (argv: string[]) => {

// Validate
const enableForcePublish = args["--force"];
const invalidItemMessages = targetItems.reduce((acc, item) => {
const frontmatterErrors = checkFrontmatterType(item);
if (frontmatterErrors.length > 0)
return [...acc, { name: item.name, errors: frontmatterErrors }];
const invalidItemMessages = targetItems.reduce(
(acc, item) => {
const frontmatterErrors = checkFrontmatterType(item);
if (frontmatterErrors.length > 0)
return [...acc, { name: item.name, errors: frontmatterErrors }];

const validationErrors = validateItem(item);
if (validationErrors.length > 0)
return [...acc, { name: item.name, errors: validationErrors }];
const validationErrors = validateItem(item);
if (validationErrors.length > 0)
return [...acc, { name: item.name, errors: validationErrors }];

if (!enableForcePublish && item.isOlderThanRemote) {
return [
...acc,
{
name: item.name,
errors: ["内容がQiita上の記事より古い可能性があります"],
},
];
}
if (!enableForcePublish && item.isOlderThanRemote) {
return [
...acc,
{
name: item.name,
errors: ["内容がQiita上の記事より古い可能性があります"],
},
];
}

return acc;
}, [] as { name: string; errors: string[] }[]);
return acc;
},
[] as { name: string; errors: string[] }[],
);
if (invalidItemMessages.length > 0) {
const chalk = (await import("chalk")).default;
invalidItemMessages.forEach((msg) => {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const pull = async (argv: string[]) => {
"--force": Boolean,
"-f": "--force",
},
{ argv }
{ argv },
);

const qiitaApi = await getQiitaApiInstance();
Expand Down
2 changes: 1 addition & 1 deletion src/lib/check-frontmatter-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const checkId: CheckType = {

const getErrorMessages = (
frontMatter: FrontMatter,
checkTypes: CheckType[]
checkTypes: CheckType[],
): string[] => {
return checkTypes.reduce((errorMessages: string[], checkType) => {
if (!checkType.isValid(frontMatter)) {
Expand Down
18 changes: 9 additions & 9 deletions src/lib/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe("config", () => {

it("returns default path", () => {
expect(config.getCredentialDir()).toEqual(
"/home/test-user/.config/qiita-cli"
"/home/test-user/.config/qiita-cli",
);
});

Expand All @@ -88,7 +88,7 @@ describe("config", () => {

it("returns customized path", () => {
expect(config.getCredentialDir()).toEqual(
"/home/test-user/qiita-articles/my-credential"
"/home/test-user/qiita-articles/my-credential",
);
});
});
Expand All @@ -102,7 +102,7 @@ describe("config", () => {

it("returns default path", () => {
expect(config.getItemsRootDir()).toEqual(
"/home/test-user/qiita-articles"
"/home/test-user/qiita-articles",
);
});

Expand All @@ -115,7 +115,7 @@ describe("config", () => {

it("returns customized path", () => {
expect(config.getItemsRootDir()).toEqual(
"/home/test-user/qiita-articles/my-root"
"/home/test-user/qiita-articles/my-root",
);
});
});
Expand All @@ -130,7 +130,7 @@ describe("config", () => {

it("returns default path", () => {
expect(config.getUserConfigDir()).toEqual(
"/home/test-user/qiita-articles"
"/home/test-user/qiita-articles",
);
});

Expand All @@ -143,7 +143,7 @@ describe("config", () => {

it("returns customized path", () => {
expect(config.getUserConfigDir()).toEqual(
"/home/test-user/qiita-articles/my-root"
"/home/test-user/qiita-articles/my-root",
);
});
});
Expand All @@ -158,7 +158,7 @@ describe("config", () => {

it("returns default path", () => {
expect(config.getUserConfigFilePath()).toEqual(
"/home/test-user/qiita-articles/qiita.config.json"
"/home/test-user/qiita-articles/qiita.config.json",
);
});

Expand All @@ -171,7 +171,7 @@ describe("config", () => {

it("returns customized path", () => {
expect(config.getUserConfigFilePath()).toEqual(
"/home/test-user/qiita-articles/my-root/qiita.config.json"
"/home/test-user/qiita-articles/my-root/qiita.config.json",
);
});
});
Expand All @@ -185,7 +185,7 @@ describe("config", () => {

it("returns default path", () => {
expect(config.getCacheDataDir()).toEqual(
"/home/test-user/.cache/qiita-cli"
"/home/test-user/.cache/qiita-cli",
);
});

Expand Down
Loading