mayoiga 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc.js ADDED
@@ -0,0 +1,111 @@
1
+ module.exports = {
2
+ parser: '@typescript-eslint/parser',
3
+ plugins: ['@typescript-eslint/eslint-plugin', "testing-library"],
4
+ extends: [
5
+ 'eslint:recommended',
6
+ 'plugin:@typescript-eslint/recommended',
7
+ // Lintの時間があまりに長いようなら無効化も考える
8
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking',
9
+
10
+ 'plugin:import/errors',
11
+ 'plugin:import/typescript',
12
+ 'plugin:testing-library/react',
13
+ ],
14
+ parserOptions: {
15
+ project: './tsconfig.json',
16
+ ecmaVersion: 'next',
17
+ sourceType: 'module',
18
+ ecaFeatures: {
19
+ jsx: true,
20
+ },
21
+ },
22
+ rules: {
23
+ curly: 'error',
24
+ eqeqeq: ['error', 'smart'],
25
+
26
+ 'no-return-await': 'error',
27
+ 'require-await': 'error',
28
+ 'no-await-in-loop': 'error',
29
+
30
+ '@typescript-eslint/prefer-readonly': 'error',
31
+ // '@typescript-eslint/prefer-readonly-parameter-types': ["error", {ignoreInferredTypes: true}],
32
+ '@typescript-eslint/array-type': ['error', {default: 'generic', readonly: 'generic'}],
33
+ '@typescript-eslint/consistent-type-imports': [
34
+ 'error',
35
+ {
36
+ prefer: 'type-imports',
37
+ },
38
+ ],
39
+
40
+ 'padding-line-between-statements': [
41
+ 'error',
42
+ {blankLine: 'always', prev: 'multiline-const', next: 'multiline-const'},
43
+ {blankLine: 'always', prev: '*', next: 'function'},
44
+ {blankLine: 'always', prev: '*', next: 'class'},
45
+ {blankLine: 'always', prev: '*', next: 'export'},
46
+ ],
47
+
48
+ 'no-use-before-define': 'off',
49
+ '@typescript-eslint/no-use-before-define': ['error'],
50
+
51
+ 'no-unused-vars': 'off',
52
+ '@typescript-eslint/no-unused-vars': [
53
+ 'error',
54
+ {
55
+ vars: 'all',
56
+ args: 'none',
57
+ ignoreRestSiblings: true,
58
+
59
+ argsIgnorePattern: '^_',
60
+ varsIgnorePattern: '^_',
61
+ },
62
+ ],
63
+
64
+ '@typescript-eslint/explicit-function-return-type': 'off',
65
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
66
+ '@typescript-eslint/no-explicit-any': 'off',
67
+
68
+ // 要検討
69
+ '@typescript-eslint/no-unsafe-assignment': 'off',
70
+ // voidとのunionで微妙な挙動をするので一旦停止
71
+ '@typescript-eslint/no-misused-promises': [
72
+ 'error',
73
+ {
74
+ checksVoidReturn: false,
75
+ },
76
+ ],
77
+
78
+ 'import/newline-after-import': 'error',
79
+ 'import/named': 'off',
80
+ 'import/no-named-default': 'error',
81
+ 'import/no-default-export': 'off',
82
+ 'import/default': 'off',
83
+ 'import/no-useless-path-segments': 'error',
84
+ 'import/order': [
85
+ 'error',
86
+ {
87
+ groups: ['builtin', 'external', 'internal', 'parent', ['index', 'sibling'], 'type'],
88
+ 'newlines-between': 'always-and-inside-groups',
89
+ alphabetize: {
90
+ order: 'asc' /* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */,
91
+ caseInsensitive: true /* ignore case. Options: [true, false] */,
92
+ },
93
+ },
94
+ ],
95
+
96
+ },
97
+ settings: {
98
+ 'import/parsers': {
99
+ '@typescript-eslint/parser': ['.js', '.jsx', '.ts', '.tsx'],
100
+ },
101
+
102
+ 'import/ignore': ['node_modules'],
103
+ },
104
+ "overrides": [
105
+ {
106
+ // 3) Now we enable eslint-plugin-testing-library rules or preset only for matching files!
107
+ "files": ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"],
108
+ "extends": ["plugin:testing-library/react"]
109
+ },
110
+ ]
111
+ };
@@ -0,0 +1,42 @@
1
+ name: Lint Check
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ strategy:
11
+ matrix:
12
+ node-version: [16.x]
13
+
14
+ steps:
15
+ - uses: actions/checkout@v1
16
+ - name: Use Node.js ${{ matrix.node-version }}
17
+ uses: actions/setup-node@v1
18
+ with:
19
+ node-version: ${{ matrix.node-version }}
20
+
21
+ - uses: actions/checkout@v1
22
+ - name: Cache node_modules
23
+ uses: actions/cache@preview
24
+ with:
25
+ path: ~/.cache/yarn
26
+ key: ${{ runner.os }}-projectname-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
27
+ restore-keys:
28
+ ${{ runner.os }}-projectname-
29
+
30
+ - name: Install node_modules
31
+ if: steps.cache.outputs.cache-hit != 'true'
32
+ run: |
33
+ npm install -g yarn
34
+ yarn install
35
+
36
+ - name: Lint
37
+ run: |
38
+ yarn check-all
39
+
40
+ - name: Test
41
+ run: |
42
+ yarn test
package/.gitignore ADDED
@@ -0,0 +1,217 @@
1
+
2
+ # Created by https://www.toptal.com/developers/gitignore/api/macos,node,visualstudiocode,vim
3
+ # Edit at https://www.toptal.com/developers/gitignore?templates=macos,node,visualstudiocode,vim
4
+
5
+ ### macOS ###
6
+ # General
7
+ .DS_Store
8
+ .AppleDouble
9
+ .LSOverride
10
+
11
+ # Icon must end with two \r
12
+ Icon
13
+
14
+
15
+ # Thumbnails
16
+ ._*
17
+
18
+ # Files that might appear in the root of a volume
19
+ .DocumentRevisions-V100
20
+ .fseventsd
21
+ .Spotlight-V100
22
+ .TemporaryItems
23
+ .Trashes
24
+ .VolumeIcon.icns
25
+ .com.apple.timemachine.donotpresent
26
+
27
+ # Directories potentially created on remote AFP share
28
+ .AppleDB
29
+ .AppleDesktop
30
+ Network Trash Folder
31
+ Temporary Items
32
+ .apdisk
33
+
34
+ ### Node ###
35
+ # Logs
36
+ logs
37
+ *.log
38
+ npm-debug.log*
39
+ yarn-debug.log*
40
+ yarn-error.log*
41
+ lerna-debug.log*
42
+ .pnpm-debug.log*
43
+
44
+ # Diagnostic reports (https://nodejs.org/api/report.html)
45
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
46
+
47
+ # Runtime data
48
+ pids
49
+ *.pid
50
+ *.seed
51
+ *.pid.lock
52
+
53
+ # Directory for instrumented libs generated by jscoverage/JSCover
54
+ lib-cov
55
+
56
+ # Coverage directory used by tools like istanbul
57
+ coverage
58
+ *.lcov
59
+
60
+ # nyc test coverage
61
+ .nyc_output
62
+
63
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
64
+ .grunt
65
+
66
+ # Bower dependency directory (https://bower.io/)
67
+ bower_components
68
+
69
+ # node-waf configuration
70
+ .lock-wscript
71
+
72
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
73
+ build/Release
74
+
75
+ # Dependency directories
76
+ node_modules/
77
+ jspm_packages/
78
+
79
+ # Snowpack dependency directory (https://snowpack.dev/)
80
+ web_modules/
81
+
82
+ # TypeScript cache
83
+ *.tsbuildinfo
84
+
85
+ # Optional npm cache directory
86
+ .npm
87
+
88
+ # Optional eslint cache
89
+ .eslintcache
90
+
91
+ # Optional stylelint cache
92
+ .stylelintcache
93
+
94
+ # Microbundle cache
95
+ .rpt2_cache/
96
+ .rts2_cache_cjs/
97
+ .rts2_cache_es/
98
+ .rts2_cache_umd/
99
+
100
+ # Optional REPL history
101
+ .node_repl_history
102
+
103
+ # Output of 'npm pack'
104
+ *.tgz
105
+
106
+ # Yarn Integrity file
107
+ .yarn-integrity
108
+
109
+ # dotenv environment variable files
110
+ .env
111
+ .env.development.local
112
+ .env.test.local
113
+ .env.production.local
114
+ .env.local
115
+
116
+ # parcel-bundler cache (https://parceljs.org/)
117
+ .cache
118
+ .parcel-cache
119
+
120
+ # Next.js build output
121
+ .next
122
+ out
123
+
124
+ # Nuxt.js build / generate output
125
+ .nuxt
126
+ dist
127
+
128
+ # Gatsby files
129
+ .cache/
130
+ # Comment in the public line in if your project uses Gatsby and not Next.js
131
+ # https://nextjs.org/blog/next-9-1#public-directory-support
132
+ # public
133
+
134
+ # vuepress build output
135
+ .vuepress/dist
136
+
137
+ # vuepress v2.x temp and cache directory
138
+ .temp
139
+
140
+ # Docusaurus cache and generated files
141
+ .docusaurus
142
+
143
+ # Serverless directories
144
+ .serverless/
145
+
146
+ # FuseBox cache
147
+ .fusebox/
148
+
149
+ # DynamoDB Local files
150
+ .dynamodb/
151
+
152
+ # TernJS port file
153
+ .tern-port
154
+
155
+ # Stores VSCode versions used for testing VSCode extensions
156
+ .vscode-test
157
+
158
+ # yarn v2
159
+ .yarn/cache
160
+ .yarn/unplugged
161
+ .yarn/build-state.yml
162
+ .yarn/install-state.gz
163
+ .pnp.*
164
+
165
+ ### Node Patch ###
166
+ # Serverless Webpack directories
167
+ .webpack/
168
+
169
+ # Optional stylelint cache
170
+
171
+ # SvelteKit build / generate output
172
+ .svelte-kit
173
+
174
+ ### Vim ###
175
+ # Swap
176
+ [._]*.s[a-v][a-z]
177
+ !*.svg # comment out if you don't need vector files
178
+ [._]*.sw[a-p]
179
+ [._]s[a-rt-v][a-z]
180
+ [._]ss[a-gi-z]
181
+ [._]sw[a-p]
182
+
183
+ # Session
184
+ Session.vim
185
+ Sessionx.vim
186
+
187
+ # Temporary
188
+ .netrwhist
189
+ *~
190
+ # Auto-generated tag files
191
+ tags
192
+ # Persistent undo
193
+ [._]*.un~
194
+
195
+ ### VisualStudioCode ###
196
+ .vscode/*
197
+ !.vscode/settings.json
198
+ !.vscode/tasks.json
199
+ !.vscode/launch.json
200
+ !.vscode/extensions.json
201
+ !.vscode/*.code-snippets
202
+
203
+ # Local History for Visual Studio Code
204
+ .history/
205
+
206
+ # Built Visual Studio Code Extensions
207
+ *.vsix
208
+
209
+ ### VisualStudioCode Patch ###
210
+ # Ignore all local history of files
211
+ .history
212
+ .ionide
213
+
214
+ # Support for Project snippet scope
215
+
216
+ # End of https://www.toptal.com/developers/gitignore/api/macos,node,visualstudiocode,vim
217
+
package/.prettierrc ADDED
@@ -0,0 +1,5 @@
1
+ printWidth: 140
2
+ parser: typescript
3
+ bracketSpacing: false
4
+ trailingComma: all
5
+ singleQuote: true
package/component.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {Slicer, Field} from "./dist/component";
package/component.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/component.js');
package/dist/index.d.ts CHANGED
@@ -52,8 +52,11 @@ declare type FormControllerBehavior<StateBeforeValidation> = {
52
52
  handleBulkChange: (setter: (prev: StateBeforeValidation) => Partial<StateBeforeValidation>) => (prev: FullFormState<StateBeforeValidation>) => FullFormState<StateBeforeValidation>;
53
53
  };
54
54
  declare type ActionsCanBePublic<State extends StateRestriction> = {
55
+ reset: VoidFunction;
56
+ initializeForm: (initial: Partial<State>) => void;
55
57
  handleChange: HandleChangeAction<State>;
56
58
  handleBulkChange: (setter: (prev: State) => Partial<State>) => void;
59
+ handleError: (reducer: (prev: FormErrors<State>) => FormErrors<State>) => void;
57
60
  };
58
61
  /**
59
62
  * Restricted type interface of the form store
package/docs/.nojekyll ADDED
File without changes