@koslibs/configs 0.1.0

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.
@@ -0,0 +1,8 @@
1
+ # Changesets
2
+
3
+ Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4
+ with multi-package repos, or single-package repos to help you version and publish your code. You can
5
+ find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6
+
7
+ We have a quick list of common questions to get you started engaging with this project in
8
+ [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
3
+ "changelog": ["@changesets/changelog-github", { "repo": "koslibs/configs" }],
4
+ "commit": false,
5
+ "fixed": [],
6
+ "linked": [],
7
+ "access": "public",
8
+ "baseBranch": "main",
9
+ "updateInternalDependencies": "patch",
10
+ "ignore": [],
11
+ "snapshot": {
12
+ "prereleaseTemplate": "{tag}-{commit}",
13
+ "useCalculatedVersion": true
14
+ }
15
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 @koslibs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/cli/index.mjs ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } from 'node:child_process';
4
+
5
+ const prettierParams =
6
+ '"./**/*.{ts,tsx,js,jsx,mjs,cjs,css,json}" --no-error-on-unmatched-pattern --cache';
7
+
8
+ const commandsMap = {
9
+ js: 'eslint .',
10
+ format: `prettier --write ${prettierParams} --list-different`,
11
+ 'format:check': `prettier --check ${prettierParams}`,
12
+ };
13
+
14
+ const possibleCommands = Object.keys(commandsMap);
15
+ const command = process.argv[2];
16
+
17
+ if (!command || !possibleCommands.includes(command)) {
18
+ console.error(`⚠️ Use one of these commands: ${possibleCommands.join(', ')}`);
19
+
20
+ process.exit(-1);
21
+ }
22
+
23
+ const args = process.argv.slice(3);
24
+ const commandForExec = [commandsMap[command], ...args].join(' ');
25
+
26
+ const { error } = spawnSync(commandForExec, { shell: true, stdio: ['pipe', 'inherit'] });
27
+
28
+ if (error) {
29
+ console.error(error.message);
30
+ process.exit(error.exitCode);
31
+ }
@@ -0,0 +1,6 @@
1
+ export default {
2
+ extends: '@commitlint/config-conventional',
3
+ rules: {
4
+ 'body-max-line-length': [2, 'always', 200],
5
+ },
6
+ };
@@ -0,0 +1,3 @@
1
+ export { defineConfig, globalIgnores } from 'eslint/config';
2
+
3
+ export { default as globals } from 'globals';
@@ -0,0 +1,328 @@
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+
4
+ import { FlatCompat } from '@eslint/eslintrc';
5
+ import js from '@eslint/js';
6
+ import tsParser from '@typescript-eslint/parser';
7
+ import prettier from 'eslint-plugin-prettier';
8
+ import eslintConfigPrettier from 'eslint-config-prettier';
9
+ import tseslint from 'typescript-eslint';
10
+ import importPlugin from 'eslint-plugin-import-helpers';
11
+ import { defineConfig, globalIgnores } from 'eslint/config';
12
+ import globals from 'globals';
13
+
14
+ const __filename = fileURLToPath(import.meta.url);
15
+ const __dirname = path.dirname(__filename);
16
+ const compat = new FlatCompat({
17
+ baseDirectory: __dirname,
18
+ recommendedConfig: js.configs.recommended,
19
+ allConfig: js.configs.all,
20
+ });
21
+
22
+ export default defineConfig([
23
+ globalIgnores(['**/node_modules', '**/wailsjs', '**/dist', '**/vite.config.ts', '**/.cache']),
24
+ js.configs.recommended,
25
+ tseslint.configs.recommended,
26
+ {
27
+ files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.mjs', '**/*.cjs'],
28
+
29
+ extends: compat.extends(
30
+ 'plugin:@typescript-eslint/recommended',
31
+ 'plugin:storybook/recommended'
32
+ ),
33
+
34
+ languageOptions: {
35
+ globals: {
36
+ ...globals.node,
37
+ ...globals.browser,
38
+ Controller: 'readonly',
39
+ },
40
+
41
+ parser: tsParser,
42
+ ecmaVersion: 'latest',
43
+ sourceType: 'module',
44
+
45
+ parserOptions: {
46
+ ecmaFeatures: {
47
+ jsx: true,
48
+ },
49
+ sourceType: 'module',
50
+ project: '../tsconfig/index.json',
51
+ tsconfigRootDir: __dirname,
52
+ },
53
+ },
54
+
55
+ plugins: {
56
+ // @ts-ignore
57
+ 'import-helpers': importPlugin,
58
+ js,
59
+ },
60
+
61
+ settings: {
62
+ react: {
63
+ version: 'detect',
64
+ },
65
+ 'import/resolver': {
66
+ typescript: {
67
+ alwaysTryTypes: true,
68
+ },
69
+ },
70
+ },
71
+
72
+ rules: {
73
+ 'import-helpers/order-imports': [
74
+ 'error',
75
+ {
76
+ newlinesBetween: 'always',
77
+ groups: ['/^node:/', 'module', 'parent', 'sibling', 'index', '/.css$/'],
78
+ alphabetize: { order: 'asc', ignoreCase: true },
79
+ },
80
+ ],
81
+
82
+ 'no-restricted-imports': [
83
+ 'error',
84
+ {
85
+ patterns: [
86
+ {
87
+ group: [
88
+ 'assert',
89
+ 'buffer',
90
+ 'child_process',
91
+ 'cluster',
92
+ 'crypto',
93
+ 'dgram',
94
+ 'dns',
95
+ 'domain',
96
+ 'events',
97
+ 'freelist',
98
+ 'fs',
99
+ 'http',
100
+ 'https',
101
+ 'module',
102
+ 'net',
103
+ 'os',
104
+ 'path',
105
+ 'punycode',
106
+ 'querystring',
107
+ 'readline',
108
+ 'repl',
109
+ 'smalloc',
110
+ 'stream',
111
+ 'string_decoder',
112
+ 'sys',
113
+ 'timers',
114
+ 'tls',
115
+ 'tracing',
116
+ 'tty',
117
+ 'url',
118
+ 'util',
119
+ 'vm',
120
+ 'zlib',
121
+ ],
122
+
123
+ message: 'Use prefix node: for node packages',
124
+ },
125
+ ],
126
+
127
+ paths: [
128
+ {
129
+ name: 'node:assert',
130
+ message: 'Use node:assert/strict instead',
131
+ },
132
+ ],
133
+ },
134
+ ],
135
+ '@typescript-eslint/no-empty-object-type': 'off',
136
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
137
+ '@typescript-eslint/explicit-function-return-type': 'off',
138
+ '@typescript-eslint/no-use-before-define': 'error',
139
+ '@typescript-eslint/no-empty-interface': 'error',
140
+ '@typescript-eslint/no-var-requires': 'off',
141
+ '@typescript-eslint/no-shadow': ['error'],
142
+ '@typescript-eslint/ban-ts-ignore': 'off',
143
+ '@typescript-eslint/ban-ts-comment': 'off',
144
+ '@typescript-eslint/no-explicit-any': 'error',
145
+
146
+ '@typescript-eslint/no-empty-function': [
147
+ 'error',
148
+ {
149
+ allow: ['arrowFunctions'],
150
+ },
151
+ ],
152
+
153
+ '@typescript-eslint/no-unused-vars': [
154
+ 'error',
155
+ {
156
+ varsIgnorePattern: '^_',
157
+ argsIgnorePattern: '^_',
158
+ destructuredArrayIgnorePattern: '^_',
159
+ caughtErrorsIgnorePattern: '^error',
160
+ },
161
+ ],
162
+
163
+ // '@typescript-eslint/ban-types': [
164
+ // 'error',
165
+ // {
166
+ // extendDefaults: true,
167
+
168
+ // types: {
169
+ // '{}': false,
170
+ // },
171
+ // },
172
+ // ],
173
+
174
+ '@typescript-eslint/consistent-type-imports': [
175
+ 'error',
176
+ {
177
+ fixStyle: 'inline-type-imports',
178
+ },
179
+ ],
180
+
181
+ 'no-cond-assign': 'error',
182
+ 'no-control-regex': 'error',
183
+ 'no-debugger': 'error',
184
+ 'no-dupe-keys': 'error',
185
+ 'no-dupe-args': 'error',
186
+ 'no-empty': 'error',
187
+ 'no-empty-character-class': 'error',
188
+ 'no-extra-semi': 'error',
189
+ 'no-ex-assign': 'error',
190
+ 'no-func-assign': 'error',
191
+ 'no-inner-declarations': 'error',
192
+ 'no-invalid-regexp': 'error',
193
+ 'no-obj-calls': 'error',
194
+ 'no-regex-spaces': 'error',
195
+ 'no-unreachable': 'error',
196
+ 'no-unreachable-loop': 'error',
197
+ 'no-var': 'error',
198
+
199
+ 'no-multiple-empty-lines': [
200
+ 'error',
201
+ {
202
+ max: 1,
203
+ maxEOF: 1,
204
+ },
205
+ ],
206
+
207
+ 'no-unsafe-negation': 'error',
208
+
209
+ 'no-console': [
210
+ 'error',
211
+ {
212
+ allow: ['info', 'error'],
213
+ },
214
+ ],
215
+
216
+ 'no-use-before-define': 'off',
217
+ 'no-shadow': 'off',
218
+ 'no-const-assign': 'error',
219
+ 'no-constant-condition': 'off',
220
+ 'no-plusplus': 'error',
221
+ 'no-caller': 'error',
222
+ 'no-alert': 'error',
223
+ 'no-div-regex': 'error',
224
+ 'no-else-return': 'error',
225
+ 'no-eval': 'error',
226
+ 'no-extend-native': 'error',
227
+ 'no-fallthrough': 'error',
228
+ 'no-floating-decimal': 'error',
229
+ 'no-implied-eval': 'error',
230
+ 'no-labels': 'error',
231
+ 'no-iterator': 'error',
232
+ 'no-lone-blocks': 'error',
233
+ 'no-loop-func': 'error',
234
+ 'no-multi-str': 'error',
235
+ 'no-global-assign': 'error',
236
+ 'no-new': 'error',
237
+ 'no-new-func': 'error',
238
+ 'no-new-wrappers': 'error',
239
+ 'no-octal': 'error',
240
+ 'no-octal-escape': 'error',
241
+ 'no-proto': 'error',
242
+ 'no-return-assign': 'error',
243
+ 'no-sequences': 'error',
244
+ 'no-with': 'error',
245
+ 'no-undef': 'error',
246
+ 'no-undef-init': 'error',
247
+ 'no-unused-expressions': 'error',
248
+ 'no-warning-comments': 'off',
249
+ 'no-nested-ternary': 'error',
250
+ 'no-trailing-spaces': 'error',
251
+ 'no-ternary': 'off',
252
+ 'no-array-constructor': 'off',
253
+ 'no-underscore-dangle': 'off',
254
+ 'no-mixed-spaces-and-tabs': 'error',
255
+ 'use-isnan': 'error',
256
+ 'valid-typeof': 'error',
257
+ 'semi-spacing': 'error',
258
+ 'dot-notation': 'error',
259
+ radix: 'error',
260
+ yoda: 'error',
261
+ 'wrap-iife': 'error',
262
+ eqeqeq: 'error',
263
+ 'eol-last': 'error',
264
+ complexity: 'off',
265
+ curly: 'error',
266
+ quotes: ['error', 'single'],
267
+ 'object-curly-spacing': [1, 'always'],
268
+ 'default-case': 'error',
269
+
270
+ 'comma-dangle': [
271
+ 'error',
272
+ {
273
+ arrays: 'always-multiline',
274
+ exports: 'always-multiline',
275
+ functions: 'never',
276
+ imports: 'always-multiline',
277
+ objects: 'always-multiline',
278
+ },
279
+ ],
280
+
281
+ 'max-params': [2, 6],
282
+ 'max-nested-callbacks': ['error', 3],
283
+ 'brace-style': 'error',
284
+
285
+ camelcase: [
286
+ 'error',
287
+ {
288
+ properties: 'never',
289
+ },
290
+ ],
291
+
292
+ 'new-parens': 'error',
293
+
294
+ 'max-len': [
295
+ 'error',
296
+ {
297
+ code: 100,
298
+ tabWidth: 2,
299
+ ignoreComments: true,
300
+ ignoreUrls: true,
301
+ ignoreTemplateLiterals: true,
302
+ ignoreStrings: true,
303
+ ignoreRegExpLiterals: true,
304
+ },
305
+ ],
306
+ },
307
+ },
308
+ {
309
+ files: ['**/*.ts', '**/*.tsx'],
310
+ plugins: {
311
+ prettier,
312
+ // @ts-ignore
313
+ rules: [
314
+ 'error',
315
+ {
316
+ trailingComma: 'es5',
317
+ tabWidth: 4,
318
+ useTabs: false,
319
+ printWidth: 100,
320
+ semi: true,
321
+ endOfLine: 'auto',
322
+ singleQuote: true,
323
+ },
324
+ ],
325
+ },
326
+ },
327
+ eslintConfigPrettier,
328
+ ]);
@@ -0,0 +1,4 @@
1
+ import { defineConfig } from './eslint/config';
2
+ import { eslintConfig } from './eslint';
3
+
4
+ export default defineConfig(eslintConfig);
@@ -0,0 +1,16 @@
1
+ # Refer for explanation to following link:
2
+ # https://lefthook.dev/configuration/
3
+
4
+ pre-commit:
5
+ parallel: true
6
+ commands:
7
+ check-scripts:
8
+ glob: '*.{js,ts,jsx,tsx,mts,mjs,cjs,cts,ctsx,mtsx,cjsx,mjsx}'
9
+ run: npx --no-install prettier --write {staged_files} --cache && npx --no-install eslint {staged_files} --no-warn-ignored && git add {staged_files}
10
+ check-json:
11
+ glob: '*.{json}'
12
+ run: npx --no-install prettier --write {staged_files} --cache && git add {staged_files}
13
+ commit-msg:
14
+ commands:
15
+ commitlint:
16
+ run: npx --no-install commitlint --edit {1}
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@koslibs/configs",
3
+ "version": "0.1.0",
4
+ "description": "Tool for api usage within react app",
5
+ "main": "index.js",
6
+ "private": false,
7
+ "license": "MIT",
8
+ "author": "holypower777",
9
+ "type": "module",
10
+ "scripts": {
11
+ "lint": "npm run lint:js && npm run format:check",
12
+ "lint:fix": "npm run lint:js --fix && npm run format",
13
+ "lint:js": "node ./cli/index.mjs js",
14
+ "format": "node ./cli/index.mjs format",
15
+ "format:check": "node ./cli/index.mjs format:check",
16
+ "release": "changeset publish",
17
+ "release:snapshot": "changeset publish --tag snapshot --no-git-tag",
18
+ "version-package": "changeset version",
19
+ "version-package:snapshot": "changeset version --snapshot snapshot"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/koslibs/configs/issues"
23
+ },
24
+ "homepage": "https://github.com/koslibs/configs",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/koslibs/configs"
28
+ },
29
+ "engines": {
30
+ "node": ">=22.14.0"
31
+ },
32
+ "prettier": "./prettier",
33
+ "commitlint": {
34
+ "extends": "./commitlint"
35
+ },
36
+ "eslintConfig": {
37
+ "extends": "./eslint"
38
+ },
39
+ "exports": {
40
+ "./eslint": "./eslint/index.mjs",
41
+ "./prettier": "./prettier/index.js",
42
+ "./commitlint": "./commitlint/index.js"
43
+ },
44
+ "dependencies": {
45
+ "@commitlint/cli": "20.3.1",
46
+ "@commitlint/config-conventional": "20.3.1",
47
+ "@eslint/eslintrc": "3.3.1",
48
+ "@eslint/js": "9.36.0",
49
+ "eslint": "9.36.0",
50
+ "eslint-config-prettier": "10.1.8",
51
+ "eslint-plugin-import-helpers": "2.0.1",
52
+ "eslint-plugin-prettier": "5.5.4",
53
+ "eslint-plugin-storybook": "0.11.2",
54
+ "globals": "16.4.0",
55
+ "lefthook": "2.0.13",
56
+ "prettier": "3.6.2",
57
+ "typescript": "5.7.2",
58
+ "typescript-eslint": "8.44.0"
59
+ },
60
+ "devDependencies": {
61
+ "@changesets/changelog-github": "^0.5.2",
62
+ "@changesets/cli": "^2.29.8",
63
+ "@types/node": "^24.4.0"
64
+ }
65
+ }
@@ -0,0 +1,9 @@
1
+ export default {
2
+ trailingComma: 'es5',
3
+ tabWidth: 4,
4
+ useTabs: false,
5
+ printWidth: 100,
6
+ semi: true,
7
+ endOfLine: 'auto',
8
+ singleQuote: true,
9
+ };
@@ -0,0 +1,29 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["DOM", "DOM.Iterable", "ESNext"],
6
+ "allowJs": false,
7
+ "skipLibCheck": true,
8
+ "esModuleInterop": false,
9
+ "allowSyntheticDefaultImports": true,
10
+ "strict": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "module": "ESNext",
13
+ "moduleResolution": "Node",
14
+ "resolveJsonModule": true,
15
+ "isolatedModules": true,
16
+ "noEmit": true,
17
+ "jsx": "react-jsx"
18
+ },
19
+ "include": [
20
+ "src",
21
+ ".storybook/**/*",
22
+ "eslint.config.mjs",
23
+ "prettier.config.mjs",
24
+ "playwright/**/*.tsx",
25
+ "playwright-ct.config.ts",
26
+ "playwright.config.ts",
27
+ "**/*.spec.tsx"
28
+ ]
29
+ }