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

feat: create json-origami #2

Merged
merged 2 commits into from
Sep 13, 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
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "hacomono-lib/json-origami" }
],
"commit": false,
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch"
}
5 changes: 5 additions & 0 deletions .changeset/sixty-pens-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"json-origami": minor
---

feat: create json-origami
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,json,yml}]
charset = utf-8
indent_style = space
indent_size = 2
18 changes: 18 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.github
.vscode

coverage
dist
docs
node_modules
storybook-static

.eslintrc.js
.prettierrc.js
babel.config.js
fallback-react.d.ts
tailwind.config.js
postcss.config.js
tsconfig.json

.cobaco
213 changes: 213 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
/**
* @type {import('@typescript-eslint/experimental-utils').TSESLint.Linter.Config}
*/
const config = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier'
],
globals: {
es2020: true
},
plugins: ['import'],
rules: {
/**
* 'max-lines' .. error
*
* 各ファイルは 150 行を上限とする. このカウントにコメントや空行は含めない.
*/
'max-lines': [
'error',
{
max: 150,
skipComments: true,
skipBlankLines: true
}
],

/**
* 'max-lines-per-function' .. error
*
* function は 50 行を上限とする. このカウントにコメントや空行は含めない.
*/
'max-lines-per-function': [
'error',
{
skipBlankLines: true,
skipComments: true
}
],

/**
* 'max-statements' .. warning
*
* function 内で定義する statement (e.g. `var` `let` `const`) は 10 個を超える場合は警告とする.
* 単純に冗長な手続きを書かざるを得ない場合などがあり、このルールは厳密に守ることが出来ない.
* 言い換えれば、このケースで警告が出ている場合は、 "複雑なコード" であることを意識すること.
*
* e.g.
* ```ts
* function foo() {
* var foo1 = 1;
* var foo2 = 2;
* var foo3 = 3;
* var foo4 = 4;
* var foo5 = 5;
* var foo6 = 6;
* var foo7 = 7;
* var foo8 = 8;
* var foo9 = 9;
* var foo10 = 10;
*
* var foo11 = 11; // Too many.
* }
* ```
*/
'max-statements': ['warn', { max: 20 }],

/**
* 'no-else-return' .. error
* else ブロック及び、 else-if ブロックにおける return を禁止する.
* 具体的には、以下の書き方が正となる
*
* e.g.
* ```ts
* function hoge() {
* if (conditionA) {
* return 1
* }
* if (conditionB) {
* return 2
* }
*
* return 3
* }
* ```
*/
'no-else-return': ['error', { allowElseIf: false }],

/**
* 'max-depth' .. error (max 4 -> 3)
*
* 入れ子のレベルを最大 3 段階に制限する.
* 深ければ深いほど可読性が悪化するため.
*
* e.g.
* ```ts
* function hoge() {
* if (true) {
* // Nested 1 deep
* if (true) {
* // Nested 2 deep
* if (true) {
* // Nested 3 deep
* if (true) {
* // Nested 4 deep (ERROR!)
* }
* }
* }
* }
* }
* ```
*/
'max-depth': [
'error',
{
max: 3
}
],

/**
* '@typescript-eslint/array-type' .. array-simple モード
* TSでArrayを記載する際に、 シンプルな型なら Hoge[] を強制、複雑な型なら Array<...> を強制する
*/
'@typescript-eslint/array-type': [
'warn',
{
default: 'array-simple'
}
],

/**
* '@typescript-eslint/explicit-module-boundary-types' .. warn
* すべての関数には、引数と返り値の型をつくりましょう。
* (returnしないなら省略可能)
*/
'@typescript-eslint/explicit-module-boundary-types': 'warn',

/**
* '@typescript-eslint/no-unused-vars' .. error
* 未使用の変数はすべて消しましょう。
* ただし、 "_" から始まる変数名については "明示的に未使用である宣言として扱い" このルールを無効とする
*/
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
ignoreRestSiblings: true
}
],

/**
* '@typescript-eslint/no-namespace' .. 無効化
* TS の構文で namespace を使っても良い
*
* [背景]
* 使えたほうが便利なケースがある
*/
'@typescript-eslint/no-namespace': 'off',

/**
* '@typescript-eslint/no-non-null-assertion' .. 無効化
* 非nullアサーション構文の利用を禁止しない
*
* [背景]
* これを守り切るには高めのTS力が試されるため
*/
'@typescript-eslint/no-non-null-assertion': 'off',

/**
* '@typescript-eslint/ban-types' .. 基本は error, ただし `{}` のみ許可
* 非推奨の型の利用を禁止する (e.g. `string` ではなく `String`, Function, Object など)
*
* [背景]
* typescript 4.8 のリリース内容に合わせての対応
* → https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/
*
* `{}` とは、 null, undefined とは異なる任意の型であることを示す.
* 4.8 バージョンアップによって利便性が向上したため、利用を全面的に許可する
*/
'@typescript-eslint/ban-types': [
'error',
{
types: {
'{}': false
},
extendDefaults: true
}
],

/**
* 'import/extensions' .. 一部の拡張子のみ、 import 文での拡張子の記載を強制する
*
* [背景]
* Nuxt Server Side Process にて、 js ファイルは拡張子がないと参照できないため.
*/
'import/extensions': [
'error',
{
js: 'always',
mjs: 'always',
cjs: 'always',
json: 'always',
css: 'always',
sass: 'always',
scss: 'always',
vue: 'always'
}
]
}
}
// eslint-disable-next-line no-undef
module.exports = config
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
23 changes: 23 additions & 0 deletions .github/actions/build-and-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Build and Cache
description: This composite action runs build command and rtestores from cache if available.

runs:
using: 'composite'

steps:
- name: cache and restore "build result"
id: cache_build_results
uses: actions/cache@v3
with:
path: |
./dist
key: cache-build-results-${{ runner.os }}-${{ github.sha }}
restore-keys: |
cache-build-results-${{ runner.os }}-${{ github.sha }}
cache-build-results-${{ runner.os }}-
cache-build-results--

- if: steps.cache_build_results.outputs.cache-hit != 'true'
run: yarn build
shell: bash
29 changes: 29 additions & 0 deletions .github/actions/init-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Install Dependencies and Cache
description: This composite action installs dependencies and restores from cache if available.

runs:
using: 'composite'

steps:
- uses: actions/setup-node@v3
with:
cache: yarn
node-version: 18

- name: cache node_modules
id: cache_node_modules
uses: actions/cache@v3
with:
path: |
./.yarn/cache
./node_modules
key: node-modules-${{ runner.os }}-${{ inputs.node-version }}-${{ hashFiles('./yarn.lock') }}
restore-keys: |
node-modules-${{ runner.os }}-${{ inputs.node-version }}-${{ hashFiles('./yarn.lock') }}
node-modules-${{ runner.os }}-${{ inputs.node-version }}-
node-modules---

- if: steps.cache_node_modules.outputs.cache-hit != 'true'
run: yarn --immutable
shell: bash
10 changes: 10 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>hacomono-lib/renovate-config:base",
"github>hacomono-lib/renovate-config:npm",
"github>hacomono-lib/renovate-config:npm-lockfile",
"github>hacomono-lib/renovate-config:github-actions",
"github>hacomono-lib/renovate-config:pre-commit"
]
}
Loading