Skip to content

Commit

Permalink
fix(deps): upgraded and deprecated old deps
Browse files Browse the repository at this point in the history
  • Loading branch information
fenying committed Jun 17, 2021
1 parent a7d2b55 commit 27db10b
Show file tree
Hide file tree
Showing 21 changed files with 4,807 additions and 187 deletions.
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#/src/examples/
/src/test/
/examples/
/lib/
/test/
/node_modules/
/*.js
265 changes: 265 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
{
"env": {
"browser": true,
"es6": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"brace-style": "off",
"@typescript-eslint/brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
"max-len": ["error", 100],
"camelcase": "off",
"@typescript-eslint/ban-types": ["error", {
"types": {

"String": {
"message": "Use string instead",
"fixWith": "string"
},
"Number": {
"message": "Use number instead",
"fixWith": "number"
},
"Boolean": {
"message": "Use number instead",
"fixWith": "boolean"
},
"Object": {
"message": "Use {} instead",
"fixWith": "{}"
}
}
}],
"no-extra-semi": "off",
"@typescript-eslint/no-extra-semi": ["error"],
"@typescript-eslint/no-base-to-string": ["warn"],
"@typescript-eslint/await-thenable": ["error"],
"@typescript-eslint/array-type": ["error", { "default": "array-simple" }],
"@typescript-eslint/prefer-as-const": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-floating-promises": ["error", { "ignoreVoid": false }],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/prefer-regexp-exec": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/no-extra-parens": "off",
"@typescript-eslint/no-extra-non-null-assertion": "error",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/default-param-last": "error",
"@typescript-eslint/explicit-member-accessibility": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {
"allowExpressions": true
}],
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-require-imports": "warn",
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"func-call-spacing": "off",
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/consistent-type-assertions": ["error", {
"assertionStyle": "as"
}],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", {
"vars": "all",
"args": "after-used",
"ignoreRestSiblings": false,
"caughtErrors": "all"
}],
"no-unused-expressions": "off",
"no-use-before-define": "off",
"@typescript-eslint/no-unused-expressions": ["error"],
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": ["error"],
"no-constant-condition":"off",
"comma-spacing": "off",
"@typescript-eslint/comma-spacing": ["error"],
"@typescript-eslint/unified-signatures": ["error"],
"semi": "off",
"prefer-const": "off",
"@typescript-eslint/semi": ["error"],
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-unnecessary-type-assertion": ["error"],
"@typescript-eslint/no-unnecessary-type-arguments": ["error"],
"@typescript-eslint/unbound-method": ["error"],
"@typescript-eslint/type-annotation-spacing": ["error"],
"@typescript-eslint/no-unnecessary-condition": ["off"],
"@typescript-eslint/no-unnecessary-boolean-literal-compare": ["warn"],
"@typescript-eslint/member-ordering": ["off"],
"@typescript-eslint/no-this-alias": [
"warn",
{
"allowDestructuring": true,
"allowedNames": ["_this"]
}
],
"@typescript-eslint/no-explicit-any": ["off", {
"fixToUnknown": true,
"ignoreRestArgs": true
}],
"space-before-function-paren": "off",
"@typescript-eslint/space-before-function-paren": ["error", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}],
"@typescript-eslint/member-delimiter-style": ["error", {
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": true
}
}],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "default",
"format": ["camelCase"],
"leadingUnderscore": "forbid"
},
{
"selector": "parameter",
"format": ["camelCase"]
},
{
"selector": "property",
"format": ["snake_case"],
"filter": {
// you can expand this regex to add more allowed names
"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)$",
"match": true
}
},
{
"selector": "property",
"format": ["snake_case", "camelCase"],
"filter": {
// you can expand this regex as you find more cases that require quoting that you want to allow
"regex": "\\?$",
"match": true
}
},
{
"selector": "memberLike",
"modifiers": ["private"],
"format": ["camelCase"],
"leadingUnderscore": "require"
},
{
"selector": "memberLike",
"modifiers": ["protected"],
"format": ["camelCase"],
"leadingUnderscore": "require"
},
{
"selector": "memberLike",
"modifiers": ["private", "static"],
"format": [],
"custom": {
"regex": "^_\\$[^_]",
"match": true
}
},
{
"selector": "memberLike",
"modifiers": ["protected", "static"],
"format": [],
"custom": {
"regex": "^_\\$[^_]",
"match": true
}
},
{
"selector": "enumMember",
"format": ["UPPER_CASE"]
},
{
"selector": "variable",
"format": ["camelCase", "UPPER_CASE"]
},
{
"selector": "typeParameter",
"format": ["PascalCase"],
"prefix": ["T"]
},
{
"selector": "interface",
"format": ["PascalCase"],
"custom": {
"regex": "^I[A-Z]",
"match": true
}
},
{
"selector": "class",
"format": ["PascalCase"]
},
{
"selector": "enum",
"format": ["PascalCase"],
"custom": {
"regex": "^E[A-Z]",
"match": true
}
},
{
"selector": "typeAlias",
"format": ["PascalCase"]
}
],
"key-spacing": ["error", { "beforeColon": false, "afterColon": true }],
"no-multiple-empty-lines": ["error", {"max": 1, "maxEOF": 0, "maxBOF": 0}],
"no-trailing-spaces": "error",
"block-spacing":"error",
"eol-last":"error",
"space-before-blocks": "error",
"indent": "off",
"@typescript-eslint/indent": ["error", 4, {
"SwitchCase": 1,
"MemberExpression": 1,
"ArrayExpression": 1,
"ObjectExpression": 1,
"ImportDeclaration": 1,
"flatTernaryExpressions": true,
"CallExpression": {"arguments": 1},
"FunctionDeclaration": {"body": 1, "parameters": 1},
"ignoredNodes": ["TSTypeParameterInstantiation", "TemplateLiteral *"]
}],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
]
}
}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/node_modules/
/libs/
/samples/
/lib/
/examples/
/test/
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run typecheck && npm run lint
17 changes: 11 additions & 6 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
/.git/
/.vscode/
/.gitignore
/.npmignore
/.npmrc
/tslint.json
/tsconfig.json
/tsconfig.production.json
/.eslint*
/.*ignore
/.vscode/
/.git/
/.husky/
/node_modules/
/samples/
/docs/
/test/
/examples/
/src/test/
/src/examples/
/commitlint.config.js
/test-data/
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

17 changes: 13 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,21 @@
{
"type": "node",
"request": "launch",
"name": "[LiteRT/Bencode.js] Sample 01 - Server Side",
"program": "${workspaceFolder}/src/samples/test.ts",
"name": "[LiteRT/Bencode.js] Sample 01 - Encoder & Decoder",
"program": "${workspaceFolder}/src/examples/01-Encoder.ts",
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/samples/*.js",
"${workspaceFolder}/libs/*.js"
"${workspaceFolder}/**/*.js"
]
},
{
"type": "node",
"request": "launch",
"name": "[LiteRT/Bencode.js] Sample 02 - Decode Torrent File",
"program": "${workspaceFolder}/src/examples/02-Decode-File.ts",
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/**/*.js"
]
}
]
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

## v0.1.1

- fix(deps): upgraded and deprecated old deps.

## v0.1.1

- Fixed auto-extending buffer size while encoding.
26 changes: 26 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
'extends': ['@commitlint/config-conventional'],
'defaultIgnores': false,
'rules': {
'type-enum': [2, 'always', [
'feat',
'fix',
'add',
'test',
'config',
'merge'
]],
'scope-enum': [2, 'always', [
'encoder',
'decoder',
'deps',
'doc',
'lint',
'branch',
'project'
]],
'scope-empty': [2, 'never'],
'subject-min-length': [2, 'always', 5],
'subject-max-length': [2, 'always', 50],
}
};
Loading

0 comments on commit 27db10b

Please sign in to comment.