Skip to content

Commit 27db10b

Browse files
committed
fix(deps): upgraded and deprecated old deps
1 parent a7d2b55 commit 27db10b

21 files changed

+4807
-187
lines changed

.eslintignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#/src/examples/
2+
/src/test/
3+
/examples/
4+
/lib/
5+
/test/
6+
/node_modules/
7+
/*.js

.eslintrc

Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es6": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/eslint-recommended"
9+
],
10+
"globals": {
11+
"Atomics": "readonly",
12+
"SharedArrayBuffer": "readonly"
13+
},
14+
"parser": "@typescript-eslint/parser",
15+
"parserOptions": {
16+
"ecmaVersion": 2020,
17+
"sourceType": "module",
18+
"project": "./tsconfig.json"
19+
},
20+
"plugins": [
21+
"@typescript-eslint"
22+
],
23+
"rules": {
24+
"brace-style": "off",
25+
"@typescript-eslint/brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
26+
"max-len": ["error", 100],
27+
"camelcase": "off",
28+
"@typescript-eslint/ban-types": ["error", {
29+
"types": {
30+
31+
"String": {
32+
"message": "Use string instead",
33+
"fixWith": "string"
34+
},
35+
"Number": {
36+
"message": "Use number instead",
37+
"fixWith": "number"
38+
},
39+
"Boolean": {
40+
"message": "Use number instead",
41+
"fixWith": "boolean"
42+
},
43+
"Object": {
44+
"message": "Use {} instead",
45+
"fixWith": "{}"
46+
}
47+
}
48+
}],
49+
"no-extra-semi": "off",
50+
"@typescript-eslint/no-extra-semi": ["error"],
51+
"@typescript-eslint/no-base-to-string": ["warn"],
52+
"@typescript-eslint/await-thenable": ["error"],
53+
"@typescript-eslint/array-type": ["error", { "default": "array-simple" }],
54+
"@typescript-eslint/prefer-as-const": "error",
55+
"@typescript-eslint/no-extraneous-class": "error",
56+
"@typescript-eslint/no-floating-promises": ["error", { "ignoreVoid": false }],
57+
"@typescript-eslint/no-array-constructor": "error",
58+
"@typescript-eslint/no-empty-function": "error",
59+
"@typescript-eslint/no-empty-interface": "error",
60+
"@typescript-eslint/prefer-for-of": "error",
61+
"@typescript-eslint/prefer-nullish-coalescing": "error",
62+
"@typescript-eslint/prefer-function-type": "error",
63+
"@typescript-eslint/prefer-includes": "error",
64+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
65+
"@typescript-eslint/prefer-regexp-exec": "error",
66+
"@typescript-eslint/prefer-optional-chain": "error",
67+
"@typescript-eslint/no-extra-parens": "off",
68+
"@typescript-eslint/no-extra-non-null-assertion": "error",
69+
"@typescript-eslint/adjacent-overload-signatures": "error",
70+
"@typescript-eslint/no-for-in-array": "error",
71+
"@typescript-eslint/default-param-last": "error",
72+
"@typescript-eslint/explicit-member-accessibility": "error",
73+
"@typescript-eslint/explicit-function-return-type": ["error", {
74+
"allowExpressions": true
75+
}],
76+
"@typescript-eslint/explicit-module-boundary-types": "error",
77+
"@typescript-eslint/no-misused-new": "error",
78+
"@typescript-eslint/no-misused-promises": "error",
79+
"@typescript-eslint/no-require-imports": "warn",
80+
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
81+
"func-call-spacing": "off",
82+
"@typescript-eslint/func-call-spacing": ["error", "never"],
83+
"@typescript-eslint/no-namespace": "off",
84+
"@typescript-eslint/consistent-type-assertions": ["error", {
85+
"assertionStyle": "as"
86+
}],
87+
"no-unused-vars": "off",
88+
"@typescript-eslint/no-unused-vars": ["error", {
89+
"vars": "all",
90+
"args": "after-used",
91+
"ignoreRestSiblings": false,
92+
"caughtErrors": "all"
93+
}],
94+
"no-unused-expressions": "off",
95+
"no-use-before-define": "off",
96+
"@typescript-eslint/no-unused-expressions": ["error"],
97+
"no-useless-constructor": "off",
98+
"@typescript-eslint/no-useless-constructor": ["error"],
99+
"no-constant-condition":"off",
100+
"comma-spacing": "off",
101+
"@typescript-eslint/comma-spacing": ["error"],
102+
"@typescript-eslint/unified-signatures": ["error"],
103+
"semi": "off",
104+
"prefer-const": "off",
105+
"@typescript-eslint/semi": ["error"],
106+
"@typescript-eslint/no-use-before-define": "off",
107+
"@typescript-eslint/no-unnecessary-type-assertion": ["error"],
108+
"@typescript-eslint/no-unnecessary-type-arguments": ["error"],
109+
"@typescript-eslint/unbound-method": ["error"],
110+
"@typescript-eslint/type-annotation-spacing": ["error"],
111+
"@typescript-eslint/no-unnecessary-condition": ["off"],
112+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": ["warn"],
113+
"@typescript-eslint/member-ordering": ["off"],
114+
"@typescript-eslint/no-this-alias": [
115+
"warn",
116+
{
117+
"allowDestructuring": true,
118+
"allowedNames": ["_this"]
119+
}
120+
],
121+
"@typescript-eslint/no-explicit-any": ["off", {
122+
"fixToUnknown": true,
123+
"ignoreRestArgs": true
124+
}],
125+
"space-before-function-paren": "off",
126+
"@typescript-eslint/space-before-function-paren": ["error", {
127+
"anonymous": "never",
128+
"named": "never",
129+
"asyncArrow": "always"
130+
}],
131+
"@typescript-eslint/member-delimiter-style": ["error", {
132+
"multiline": {
133+
"delimiter": "semi",
134+
"requireLast": true
135+
},
136+
"singleline": {
137+
"delimiter": "semi",
138+
"requireLast": true
139+
}
140+
}],
141+
"@typescript-eslint/naming-convention": [
142+
"error",
143+
{
144+
"selector": "default",
145+
"format": ["camelCase"],
146+
"leadingUnderscore": "forbid"
147+
},
148+
{
149+
"selector": "parameter",
150+
"format": ["camelCase"]
151+
},
152+
{
153+
"selector": "property",
154+
"format": ["snake_case"],
155+
"filter": {
156+
// you can expand this regex to add more allowed names
157+
"regex": "^(target_id|target_type|payer_account|date_type|date_start|date_end|page_type|max_id|min_id|sort_order|sort_by|filter_by|filter_id|http_status_code|http_status_msg|redirect_uri|expires_in|input_token|access_token|refresh_token|grant_type|token_type|client_id|client_secret)$",
158+
"match": true
159+
}
160+
},
161+
{
162+
"selector": "property",
163+
"format": ["snake_case", "camelCase"],
164+
"filter": {
165+
// you can expand this regex as you find more cases that require quoting that you want to allow
166+
"regex": "\\?$",
167+
"match": true
168+
}
169+
},
170+
{
171+
"selector": "memberLike",
172+
"modifiers": ["private"],
173+
"format": ["camelCase"],
174+
"leadingUnderscore": "require"
175+
},
176+
{
177+
"selector": "memberLike",
178+
"modifiers": ["protected"],
179+
"format": ["camelCase"],
180+
"leadingUnderscore": "require"
181+
},
182+
{
183+
"selector": "memberLike",
184+
"modifiers": ["private", "static"],
185+
"format": [],
186+
"custom": {
187+
"regex": "^_\\$[^_]",
188+
"match": true
189+
}
190+
},
191+
{
192+
"selector": "memberLike",
193+
"modifiers": ["protected", "static"],
194+
"format": [],
195+
"custom": {
196+
"regex": "^_\\$[^_]",
197+
"match": true
198+
}
199+
},
200+
{
201+
"selector": "enumMember",
202+
"format": ["UPPER_CASE"]
203+
},
204+
{
205+
"selector": "variable",
206+
"format": ["camelCase", "UPPER_CASE"]
207+
},
208+
{
209+
"selector": "typeParameter",
210+
"format": ["PascalCase"],
211+
"prefix": ["T"]
212+
},
213+
{
214+
"selector": "interface",
215+
"format": ["PascalCase"],
216+
"custom": {
217+
"regex": "^I[A-Z]",
218+
"match": true
219+
}
220+
},
221+
{
222+
"selector": "class",
223+
"format": ["PascalCase"]
224+
},
225+
{
226+
"selector": "enum",
227+
"format": ["PascalCase"],
228+
"custom": {
229+
"regex": "^E[A-Z]",
230+
"match": true
231+
}
232+
},
233+
{
234+
"selector": "typeAlias",
235+
"format": ["PascalCase"]
236+
}
237+
],
238+
"key-spacing": ["error", { "beforeColon": false, "afterColon": true }],
239+
"no-multiple-empty-lines": ["error", {"max": 1, "maxEOF": 0, "maxBOF": 0}],
240+
"no-trailing-spaces": "error",
241+
"block-spacing":"error",
242+
"eol-last":"error",
243+
"space-before-blocks": "error",
244+
"indent": "off",
245+
"@typescript-eslint/indent": ["error", 4, {
246+
"SwitchCase": 1,
247+
"MemberExpression": 1,
248+
"ArrayExpression": 1,
249+
"ObjectExpression": 1,
250+
"ImportDeclaration": 1,
251+
"flatTernaryExpressions": true,
252+
"CallExpression": {"arguments": 1},
253+
"FunctionDeclaration": {"body": 1, "parameters": 1},
254+
"ignoredNodes": ["TSTypeParameterInstantiation", "TemplateLiteral *"]
255+
}],
256+
"linebreak-style": [
257+
"error",
258+
"unix"
259+
],
260+
"quotes": [
261+
"error",
262+
"single"
263+
]
264+
}
265+
}

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/node_modules/
2-
/libs/
3-
/samples/
2+
/lib/
3+
/examples/
44
/test/

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no-install commitlint --edit "$1"

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run typecheck && npm run lint

.npmignore

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
/.git/
2-
/.vscode/
31
/.gitignore
4-
/.npmignore
5-
/.npmrc
6-
/tslint.json
72
/tsconfig.json
3+
/tsconfig.production.json
4+
/.eslint*
5+
/.*ignore
6+
/.vscode/
7+
/.git/
8+
/.husky/
89
/node_modules/
9-
/samples/
10+
/docs/
1011
/test/
12+
/examples/
13+
/src/test/
14+
/src/examples/
15+
/commitlint.config.js
1116
/test-data/

.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.vscode/launch.json

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,21 @@
77
{
88
"type": "node",
99
"request": "launch",
10-
"name": "[LiteRT/Bencode.js] Sample 01 - Server Side",
11-
"program": "${workspaceFolder}/src/samples/test.ts",
10+
"name": "[LiteRT/Bencode.js] Sample 01 - Encoder & Decoder",
11+
"program": "${workspaceFolder}/src/examples/01-Encoder.ts",
1212
"sourceMaps": true,
1313
"outFiles": [
14-
"${workspaceFolder}/samples/*.js",
15-
"${workspaceFolder}/libs/*.js"
14+
"${workspaceFolder}/**/*.js"
15+
]
16+
},
17+
{
18+
"type": "node",
19+
"request": "launch",
20+
"name": "[LiteRT/Bencode.js] Sample 02 - Decode Torrent File",
21+
"program": "${workspaceFolder}/src/examples/02-Decode-File.ts",
22+
"sourceMaps": true,
23+
"outFiles": [
24+
"${workspaceFolder}/**/*.js"
1625
]
1726
}
1827
]

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22

33
## v0.1.1
44

5+
- fix(deps): upgraded and deprecated old deps.
6+
7+
## v0.1.1
8+
59
- Fixed auto-extending buffer size while encoding.

commitlint.config.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = {
2+
'extends': ['@commitlint/config-conventional'],
3+
'defaultIgnores': false,
4+
'rules': {
5+
'type-enum': [2, 'always', [
6+
'feat',
7+
'fix',
8+
'add',
9+
'test',
10+
'config',
11+
'merge'
12+
]],
13+
'scope-enum': [2, 'always', [
14+
'encoder',
15+
'decoder',
16+
'deps',
17+
'doc',
18+
'lint',
19+
'branch',
20+
'project'
21+
]],
22+
'scope-empty': [2, 'never'],
23+
'subject-min-length': [2, 'always', 5],
24+
'subject-max-length': [2, 'always', 50],
25+
}
26+
};

0 commit comments

Comments
 (0)