Skip to content

Commit 4516543

Browse files
committed
fix(encoding): fixed decoding urlencoding
1 parent 1893408 commit 4516543

30 files changed

+3036
-2317
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
/lib/
33
/benchmarks/
44
/examples/
5+
/tests/
6+
/src/examples/
7+
/src/tests/
58
/node_modules/

.eslintrc

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

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/node_modules/
22
/lib/
33
/examples/
4+
/tests/

.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no-install commitlint --edit "$1"
5+
npm run lint && npm run build && npm run test

.npmignore

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
/tslint.json
99
/docs/
1010
/examples/
11+
/tests/
1112
/commitlint.config.js
1213
/.eslintrc
1314
/.eslintignore
15+
/.husky/

.vscode/settings.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"typescript.tsdk": "node_modules\\typescript\\lib"
2+
"typescript.tsdk": "node_modules\\typescript\\lib",
3+
"cSpell.words": [
4+
"Urlencode"
5+
]
36
}

CHANGES.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Changes Logs
22

3-
## vNEXT
3+
## v2.3.0
44

55
- config(deps): updated dependencies.
6+
- fix(encoding): fixed decoding of the `urlencode`.
7+
- build(test): added test cases.
8+
- build(project): upgraded the minimum version of Node.js to `v14`.
69

710
## v2.2.0
811

commitlint.config.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,13 @@ module.exports = {
66
'feat',
77
'fix',
88
'add',
9-
'test',
10-
'refactor',
11-
'perf',
12-
'style',
13-
'config',
14-
'merge'
9+
'build'
1510
]],
1611
'scope-enum': [2, 'always', [
1712
'encoding',
1813
'doc',
1914
'lint',
15+
'test',
2016
'deps',
2117
'branch',
2218
'project'

0 commit comments

Comments
 (0)