Skip to content

Commit 9db4c83

Browse files
committed
first commit
0 parents  commit 9db4c83

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+9023
-0
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
3+
dist
4+
5+
coverage

.eslintrc.cjs

Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
// eslint-disable-next-line @typescript-eslint/no-var-requires
2+
const path = require('node:path')
3+
4+
const project = path.join(__dirname, 'tsconfig.json')
5+
6+
/** @type {import("eslint").Linter.RulesRecord} */
7+
const generalRules = {
8+
'no-self-compare': 'error',
9+
'no-unused-private-class-members': 'error',
10+
'no-constant-binary-expression': 'error',
11+
camelcase: ['error', { ignoreImports: false }],
12+
'default-case': 'error',
13+
'default-case-last': 'error',
14+
eqeqeq: 'warn',
15+
'func-name-matching': 'error',
16+
'logical-assignment-operators': 'error',
17+
'new-cap': 'error',
18+
'no-array-constructor': 'error',
19+
'no-caller': 'error',
20+
'no-console': 'error',
21+
'no-empty-function': 'off',
22+
'no-empty-static-block': 'error',
23+
'no-eval': 'error',
24+
'no-implied-eval': 'error',
25+
'no-new-func': 'error',
26+
'no-extend-native': 'error',
27+
'no-extra-bind': 'error',
28+
'no-extra-label': 'error',
29+
'no-label-var': 'error',
30+
'no-lonely-if': 'error',
31+
'no-multi-assign': 'error',
32+
'no-new-wrappers': 'error',
33+
'no-proto': 'error',
34+
'no-return-assign': 'error',
35+
'no-throw-literal': 'error',
36+
'no-unneeded-ternary': 'error',
37+
'no-useless-computed-key': 'error',
38+
'no-useless-constructor': 'off',
39+
'no-useless-return': 'error',
40+
'operator-assignment': 'error',
41+
'prefer-const': 'warn',
42+
'prefer-exponentiation-operator': 'error',
43+
'prefer-object-spread': 'error',
44+
'prefer-regex-literals': 'error',
45+
'prefer-spread': 'error',
46+
'require-await': 'warn',
47+
'symbol-description': 'warn',
48+
'no-inner-declarations': 'off',
49+
'no-unused-expressions': 'error',
50+
}
51+
52+
/** @type {import("eslint").Linter.RulesRecord} */
53+
const generalRulesForTypeScript = {
54+
'@typescript-eslint/consistent-type-imports': [
55+
'error',
56+
{
57+
prefer: 'type-imports',
58+
fixStyle: 'separate-type-imports',
59+
},
60+
],
61+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
62+
'@typescript-eslint/array-type': ['error', { default: 'array' }],
63+
'@typescript-eslint/ban-ts-comment': 'off',
64+
'@typescript-eslint/consistent-generic-constructors': [
65+
'error',
66+
'constructor',
67+
],
68+
'@typescript-eslint/consistent-indexed-object-style': ['warn', 'record'],
69+
'@typescript-eslint/method-signature-style': ['error', 'property'],
70+
'@typescript-eslint/no-duplicate-enum-values': 'error',
71+
'@typescript-eslint/no-duplicate-type-constituents': 'error',
72+
'@typescript-eslint/no-dynamic-delete': 'warn',
73+
'@typescript-eslint/no-import-type-side-effects': 'error',
74+
'@typescript-eslint/no-meaningless-void-operator': 'warn',
75+
'@typescript-eslint/no-redundant-type-constituents': 'warn',
76+
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
77+
'@typescript-eslint/no-unnecessary-condition': 'warn',
78+
'@typescript-eslint/no-unnecessary-qualifier': 'error',
79+
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
80+
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
81+
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
82+
'@typescript-eslint/prefer-function-type': 'error',
83+
'@typescript-eslint/prefer-optional-chain': 'error',
84+
'@typescript-eslint/prefer-ts-expect-error': 'error',
85+
'@typescript-eslint/require-array-sort-compare': 'warn',
86+
'@typescript-eslint/switch-exhaustiveness-check': 'warn',
87+
'@typescript-eslint/unified-signatures': 'warn',
88+
'@typescript-eslint/naming-convention': [
89+
'error',
90+
{
91+
selector: 'interface',
92+
format: ['PascalCase'],
93+
},
94+
{
95+
selector: 'typeLike',
96+
format: ['PascalCase'],
97+
},
98+
],
99+
'@typescript-eslint/no-namespace': 'off',
100+
'@typescript-eslint/explicit-member-accessibility': [
101+
'error',
102+
{ overrides: { constructors: 'no-public' } },
103+
],
104+
}
105+
106+
/** @type {import("eslint").Linter.RulesRecord} */
107+
const typeCheckingRules = {
108+
'@typescript-eslint/no-unsafe-argument': 'warn',
109+
'@typescript-eslint/no-unsafe-assignment': 'warn',
110+
'@typescript-eslint/no-unsafe-return': 'warn',
111+
'@typescript-eslint/no-unsafe-member-access': 'warn',
112+
'@typescript-eslint/no-unsafe-call': 'warn',
113+
'@typescript-eslint/unbound-method': 'warn',
114+
'@typescript-eslint/restrict-template-expressions': 'warn',
115+
}
116+
117+
/** @type {import("eslint").Linter.RulesRecord} */
118+
const unicornRules = {
119+
'unicorn/better-regex': 'error',
120+
'unicorn/custom-error-definition': 'error',
121+
'unicorn/error-message': 'error',
122+
'unicorn/filename-case': [
123+
'error',
124+
{
125+
case: 'camelCase',
126+
},
127+
],
128+
'unicorn/new-for-builtins': 'error',
129+
'unicorn/no-array-method-this-argument': 'error',
130+
'unicorn/no-array-push-push': 'error',
131+
'unicorn/no-empty-file': 'error',
132+
'unicorn/no-instanceof-array': 'error',
133+
'unicorn/no-unnecessary-await': 'warn',
134+
'unicorn/no-useless-fallback-in-spread': 'warn',
135+
'unicorn/no-useless-length-check': 'warn',
136+
'unicorn/no-useless-spread': 'warn',
137+
'unicorn/no-useless-switch-case': 'warn',
138+
'unicorn/no-useless-undefined': 'warn',
139+
'unicorn/no-zero-fractions': 'error',
140+
'unicorn/number-literal-case': 'error',
141+
'unicorn/prefer-array-flat-map': 'warn',
142+
'unicorn/prefer-math-trunc': 'warn',
143+
'unicorn/prefer-modern-math-apis': 'error',
144+
'unicorn/prefer-negative-index': 'warn',
145+
'unicorn/prefer-node-protocol': 'error',
146+
'unicorn/prefer-optional-catch-binding': 'error',
147+
'unicorn/prefer-switch': 'warn',
148+
'unicorn/throw-new-error': 'error',
149+
}
150+
151+
/** @type {import("eslint").Linter.RulesRecord} */
152+
const spellRules = {
153+
'spellcheck/spell-checker': [
154+
'warn',
155+
{
156+
comments: true,
157+
strings: true,
158+
identifiers: true,
159+
templates: true,
160+
lang: 'en_US',
161+
skipWords: [
162+
'checkbox',
163+
'unary',
164+
'convertable',
165+
'baseexponent',
166+
'typeof',
167+
'str',
168+
'clipboardy',
169+
'esm',
170+
'cjs',
171+
'iife',
172+
'dts',
173+
'tsconfig',
174+
'minify',
175+
'rimraf',
176+
],
177+
},
178+
],
179+
}
180+
181+
/** @type {import("eslint").Linter.RulesRecord} */
182+
const jsdocRules = {
183+
'jsdoc/check-alignment': 'error',
184+
'jsdoc/check-indentation': 'error',
185+
'jsdoc/check-tag-names': 'error',
186+
'jsdoc/match-description': [
187+
'error',
188+
{ matchDescription: '^\n?([A-Z`\\d_][\\s\\S]*\\.)\\s*$' },
189+
],
190+
'jsdoc/no-bad-blocks': ['error', { preventAllMultiAsteriskBlocks: true }],
191+
'jsdoc/no-blank-block-descriptions': 'error',
192+
'jsdoc/no-blank-blocks': 'error',
193+
'jsdoc/no-multi-asterisks': 'error',
194+
'jsdoc/require-asterisk-prefix': 'error',
195+
'jsdoc/require-hyphen-before-param-description': 'warn',
196+
'jsdoc/require-param-description': 'error',
197+
'jsdoc/require-param-name': 'error',
198+
'jsdoc/require-throws': 'error',
199+
'jsdoc/require-jsdoc': 'off',
200+
}
201+
202+
/** @type {import("eslint").Linter.RulesRecord} */
203+
const securityRules = {
204+
'security/detect-object-injection': 'warn',
205+
}
206+
207+
const plugins = [
208+
'@typescript-eslint',
209+
'unicorn',
210+
'spellcheck',
211+
'jsdoc',
212+
'security',
213+
]
214+
215+
const extendsFrom = [
216+
'eslint:recommended',
217+
'plugin:@typescript-eslint/recommended',
218+
]
219+
220+
/** @type {import("eslint").Linter.Config} */
221+
const config = {
222+
env: {
223+
browser: true,
224+
es2021: true,
225+
node: true,
226+
},
227+
overrides: [
228+
{
229+
extends: [
230+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
231+
],
232+
files: ['*.ts'],
233+
parserOptions: {
234+
project,
235+
},
236+
rules: typeCheckingRules,
237+
},
238+
{
239+
files: ['test/**'],
240+
rules: {
241+
'@typescript-eslint/no-explicit-any': 'off',
242+
'@typescript-eslint/unbound-method': 'off',
243+
'security/detect-object-injection': 'off',
244+
},
245+
},
246+
{
247+
files: ['examples/**'],
248+
rules: {
249+
'no-console': 'off',
250+
},
251+
},
252+
{
253+
files: ['.eslintrc.cjs'],
254+
rules: {
255+
'spellcheck/spell-checker': 'off',
256+
},
257+
},
258+
],
259+
parser: '@typescript-eslint/parser',
260+
root: true,
261+
parserOptions: {
262+
project,
263+
ecmaVersion: 'latest',
264+
sourceType: 'module',
265+
},
266+
settings: {},
267+
plugins,
268+
extends: extendsFrom,
269+
rules: {
270+
...generalRules,
271+
...generalRulesForTypeScript,
272+
...unicornRules,
273+
...spellRules,
274+
...jsdocRules,
275+
...securityRules,
276+
},
277+
}
278+
279+
module.exports = config

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: polioan
2+
custom: ['https://boosty.to/polioan']

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
# Editor directories and files
11+
.idea
12+
.DS_Store
13+
*.suo
14+
*.ntvs*
15+
*.njsproj
16+
*.sln
17+
*.sw?
18+
19+
node_modules
20+
dist
21+
*.local
22+
*.tsbuildinfo
23+
24+
coverage
25+
26+
*.tgz

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
3+
dist
4+
5+
coverage

.prettierrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"useTabs": false,
3+
"arrowParens": "avoid",
4+
"bracketSameLine": false,
5+
"bracketSpacing": true,
6+
"embeddedLanguageFormatting": "auto",
7+
"endOfLine": "auto",
8+
"htmlWhitespaceSensitivity": "css",
9+
"insertPragma": false,
10+
"jsxSingleQuote": true,
11+
"printWidth": 80,
12+
"proseWrap": "preserve",
13+
"quoteProps": "as-needed",
14+
"semi": false,
15+
"singleAttributePerLine": false,
16+
"singleQuote": true,
17+
"trailingComma": "es5",
18+
"tabWidth": 2
19+
}

.vscode/extensions.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"recommendations": [
3+
"editorconfig.editorconfig",
4+
"dbaeumer.vscode-eslint",
5+
"esbenp.prettier-vscode",
6+
"yoavbls.pretty-ts-errors"
7+
],
8+
"unwantedRecommendations": []
9+
}

.vscode/settings.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"typescript.tsdk": "node_modules\\typescript\\lib",
3+
"files.exclude": {
4+
"**/.git": true,
5+
"**/.svn": true,
6+
"**/.hg": true,
7+
"**/CVS": true,
8+
"**/.DS_Store": true,
9+
"**/Thumbs.db": true,
10+
"**/node_modules": true,
11+
"**/dist": true
12+
},
13+
"search.exclude": {
14+
"**/dist": true,
15+
"package-lock.json": true,
16+
"LICENSE": true,
17+
"coverage": true
18+
}
19+
}

0 commit comments

Comments
 (0)