Skip to content

Commit

Permalink
Merge pull request #186 from nabeliwo/update-lint-setting
Browse files Browse the repository at this point in the history
lint がエラーなく動くようにする
  • Loading branch information
nabeliwo authored Jan 9, 2024
2 parents 5d80303 + 5d2214a commit 2f76a06
Show file tree
Hide file tree
Showing 9 changed files with 1,079 additions and 1,390 deletions.
25 changes: 18 additions & 7 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
module.exports = {
extends: ['plugin:astro/all', 'plugin:prettier/recommended'],
env: {
node: true,
es2024: true,
browser: true,
},
extends: [
'eslint:recommended',
'plugin:astro/all',
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
overrides: [
{
files: ['*.astro'],
Expand All @@ -8,15 +20,14 @@ module.exports = {
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.astro'],
},
processor: 'astro/client-side-ts',
rules: {
'astro/no-set-html-directive': 'off',
'astro/no-set-html-directive': 'off'
},
},
{
files: ['*.cjs'],
rules: {
'astro/no-set-html-directive': 'off',
},
files: ['*.ts'],
parser: '@typescript-eslint/parser',
},
],
};
}
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,31 @@
"preview": "astro preview",
"astro": "astro",
"lint": "run-p lint:*",
"lint:eslint": "eslint 'src/**/*.{js,astro}'",
"lint:stylelint": "stylelint 'src/**/*.{js,astro}'",
"lint:eslint": "eslint 'src/**/*.{js,ts,astro}'",
"lint:stylelint": "stylelint 'src/**/*.{js,ts,astro}'",
"lint:prettier": "prettier --check 'src/**/*.{js,ts}'",
"format": "run-s format:*",
"format:eslint": "eslint --fix 'src/**/*.{js,astro}'",
"format:stylelint": "stylelint --fix 'src/**/*.{js,astro}'"
"format:eslint": "eslint --fix 'src/**/*.{js,ts,astro}'",
"format:stylelint": "stylelint --fix 'src/**/*.{js,ts,astro}'",
"format:prettier": "prettier --write 'src/**/*.{js,ts}'"
},
"dependencies": {
"astro": "^3.0.7",
"autoprefixer": "^10.4.16",
"microcms-js-sdk": "^2.5.0",
"postcss-preset-env": "^9.3.0",
"remark-html": "^16.0.1",
"remark-parse": "^11.0.0",
"unified": "^11.0.4"
},
"devDependencies": {
"@typescript-eslint/parser": "^6.18.0",
"eslint": "^8.48.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-astro": "^0.29.0",
"astro": "^4.0.7",
"autoprefixer": "^10.4.16",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-astro": "^0.31.0",
"eslint-plugin-prettier": "^5.0.0",
"npm-run-all": "^4.1.5",
"postcss-html": "^1.5.0",
"postcss-preset-env": "^9.3.0",
"prettier": "^3.0.3",
"prettier-plugin-astro": "^0.12.0",
"stylelint": "^15.11.0",
Expand Down
1 change: 0 additions & 1 deletion src/components/sections/Document.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
import ContentBox from '../shared/ContentBox.astro';
import Stack from '../shared/Stack.astro';
import TextLink from '../shared/TextLink.astro';
---

<ContentBox heading="会社紹介資料">
Expand Down
31 changes: 31 additions & 0 deletions src/layouts/Head.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<meta
name="description"
content="株式会社SmartHRのエンジニア採用サイトです。私たちは、誰もが心地よく、健康に、そして幸せに働ける社会を目指し、テクノロジーと創意工夫で、日本の労働を一歩ずつアップデートしています。歴史に残る模範的なソフトウェアを一緒に作りませんか?"
/>
<meta property="og:title" content="SmartHR エンジニア採用" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://hello-world.smarthr.co.jp" />
<meta
property="og:image"
content="https://hello-world.smarthr.co.jp/images/ogp.png"
/>
<meta property="og:site_name" content="Engineer Recruiting | SmartHR" />
<meta
property="og:description"
content="株式会社SmartHRのエンジニア採用サイトです。私たちは、誰もが心地よく、健康に、そして幸せに働ける社会を目指し、テクノロジーと創意工夫で、日本の労働を一歩ずつアップデートしています。歴史に残る模範的なソフトウェアを一緒に作りませんか?"
/>
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="SmartHR エンジニア採用" />
<meta name="twitter:site" content="@SmartHR_jp" />
<link rel="icon" href="/favicon/favicon.ico" />
<link
rel="apple-touch-icon"
sizes="180x180"
href="/favicon/apple-touch-icon.png"
/>
<title>SmartHR エンジニア採用</title>
</head>
38 changes: 6 additions & 32 deletions src/layouts/Layout.astro
Original file line number Diff line number Diff line change
@@ -1,40 +1,14 @@
<!doctype html>
---
import Head from './Head.astro';
---

<html lang="ja">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<meta
name="description"
content="株式会社SmartHRのエンジニア採用サイトです。私たちは、誰もが心地よく、健康に、そして幸せに働ける社会を目指し、テクノロジーと創意工夫で、日本の労働を一歩ずつアップデートしています。歴史に残る模範的なソフトウェアを一緒に作りませんか?"
/>
<meta property="og:title" content="SmartHR エンジニア採用" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://hello-world.smarthr.co.jp" />
<meta
property="og:image"
content="https://hello-world.smarthr.co.jp/images/ogp.png"
/>
<meta property="og:site_name" content="Engineer Recruiting | SmartHR" />
<meta
property="og:description"
content="株式会社SmartHRのエンジニア採用サイトです。私たちは、誰もが心地よく、健康に、そして幸せに働ける社会を目指し、テクノロジーと創意工夫で、日本の労働を一歩ずつアップデートしています。歴史に残る模範的なソフトウェアを一緒に作りませんか?"
/>
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="SmartHR エンジニア採用" />
<meta name="twitter:site" content="@SmartHR_jp" />
<link rel="icon" href="/favicon/favicon.ico" />
<link
rel="apple-touch-icon"
sizes="180x180"
href="/favicon/apple-touch-icon.png"
/>
<title>SmartHR エンジニア採用</title>
</head>
<Head />
<body>
<slot />
</body>
</html>

<style is:global>
@font-face {
font-family: DINAlternateBold;
Expand Down
1 change: 0 additions & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import TechnologyStack from '../components/sections/TechnologyStack.astro';
import OrganizationalStructure from '../components/sections/OrganizationalStructure.astro';
import Links from '../components/sections/Links.astro';
import Positions from '../components/sections/Positions.astro';
import Copyright from '../components/sections/Copyright.astro';
import GitHubLink from '../components/parts/GitHubLink.astro';
---

Expand Down
35 changes: 18 additions & 17 deletions src/services/microcms/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { createClient } from 'microcms-js-sdk'
import { unified } from 'unified'
import remarkHtml from 'remark-html'
import remarkParse from 'remark-parse'
import { createClient } from 'microcms-js-sdk';
import { unified } from 'unified';
import remarkHtml from 'remark-html';
import remarkParse from 'remark-parse';

import type { ContentResponse, ContentType } from './types'
import type { ContentResponse, ContentType } from './types';

const SERVICE_DOMAIN = 'smarthr-hello-world'
const API_ENDPOINT = 'contents'
const SERVICE_DOMAIN = 'smarthr-hello-world';
const API_ENDPOINT = 'contents';

const client = createClient({
serviceDomain: SERVICE_DOMAIN,
apiKey: import.meta.env.SECRET_MICROCMS_KEY || 'key',
})
});

// コンテンツ種別をもとにコンテンツを取得する
export const fetchContentByType = async (type: ContentType) => {
Expand All @@ -28,22 +28,23 @@ export const fetchContentByType = async (type: ContentType) => {
if (!response.totalCount) {
throw Error(
'コンテンツが存在しません。microCMSの管理画面でコンテンツを作成してください',
)
);
}
return response.contents[0]
})
return response.contents[0];
});
if (!content)
throw Error(
'指定した種別のコンテンツが存在しません。microCMSの管理画面でコンテンツを作成してください',
)
return content
}
);
return content;
};

// microCMSから取得したマークダウンテキストをhtmlに変換する
export const convertMarkdownToHTML = async (markdownText: string) => {
const parsedContent = await unified()
.use(remarkParse)
.use(remarkHtml)
.process(markdownText)
return parsedContent
}
.process(markdownText);

return parsedContent;
};
12 changes: 6 additions & 6 deletions src/services/microcms/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { type MicroCMSListResponse } from 'microcms-js-sdk'
import { type MicroCMSListResponse } from 'microcms-js-sdk';

// microCMSのcontentsAPIで定義しているコンテンツ種別(type)のリスト
export type ContentType =
| 'links'
| 'web-application-engineer-positions'
| 'other-engineer-positions'
| 'casual-interview'
| 'casual-interview';

export type Content = {
type: Array<ContentType> // NOTE: microCMSのSelectable Fieldは単一選択でも配列型で返却される
content: string
}
type: Array<ContentType>; // NOTE: microCMSのSelectable Fieldは単一選択でも配列型で返却される
content: string;
};

export type ContentResponse = MicroCMSListResponse<Content>
export type ContentResponse = MicroCMSListResponse<Content>;
Loading

0 comments on commit 2f76a06

Please sign in to comment.