File tree Expand file tree Collapse file tree 7 files changed +2638
-781
lines changed Expand file tree Collapse file tree 7 files changed +2638
-781
lines changed Original file line number Diff line number Diff line change 22
22
"@typescript-eslint/explicit-member-accessibility" : " off" ,
23
23
"@typescript-eslint/no-unnecessary-condition" : " off" ,
24
24
"@typescript-eslint/no-magic-numbers" : " off" ,
25
- "@typescript-eslint/no-extra-parens" : " off"
26
- }
25
+ "@typescript-eslint/no-extra-parens" : " off" ,
26
+
27
+ "no-shadow" : " off"
28
+ },
29
+ "overrides" : [
30
+ {
31
+ "files" : [" **/*.ts" ],
32
+ "rules" : {
33
+ "no-undef" : " off"
34
+ }
35
+ }
36
+ ]
27
37
}
Original file line number Diff line number Diff line change
1
+ /** @type {import('ts-jest/dist/types').InitialOptionsTsJest } */
2
+ module . exports = {
3
+ preset : 'ts-jest' ,
4
+ testEnvironment : 'node' ,
5
+ } ;
Original file line number Diff line number Diff line change 33
33
"clear" : " rimraf dist/*" ,
34
34
"build" : " yarn clear && tsc" ,
35
35
"watch" : " yarn clear && tsc --watch" ,
36
- "test" : " tsc --noEmit && eslint src --ext .ts"
36
+ "test" : " jest && tsc --noEmit && eslint src --ext .ts"
37
37
},
38
38
"pre-commit" : [
39
39
" test"
43
43
"chalk" : " 4.1.0"
44
44
},
45
45
"devDependencies" : {
46
+ "@types/jest" : " ^28.1.5" ,
46
47
"@types/node" : " ^14.0.13" ,
47
- "@typescript-eslint/eslint-plugin" : " 2.34.0" ,
48
- "@typescript-eslint/parser" : " 2.0.0" ,
49
- "@vkontakte/eslint-config" : " 2.5.0" ,
50
- "eslint" : " 6.8.0" ,
51
- "eslint-plugin-react" : " 7.19.0" ,
52
- "eslint-plugin-react-hooks" : " 3.0.0" ,
48
+ "@typescript-eslint/eslint-plugin" : " 5.30.6" ,
49
+ "@typescript-eslint/parser" : " 5.30.6" ,
50
+ "@vkontakte/eslint-config" : " 3.1.0" ,
51
+ "eslint" : " 8.19.0" ,
52
+ "eslint-plugin-react" : " 7.30.1" ,
53
+ "eslint-plugin-react-hooks" : " 4.6.0" ,
54
+ "jest" : " 28.1.3" ,
53
55
"pre-commit" : " 1.2.2" ,
54
56
"rimraf" : " ^3.0.2" ,
55
- "typescript" : " 3.9.5"
57
+ "ts-jest" : " ^28.0.6" ,
58
+ "typescript" : " 4.3.5"
56
59
}
57
60
}
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export function normalizeMethodInfo(method: Schema.Method): NormalizeMethodInfoR
18
18
// For method params "boolean" type means 1 or 0
19
19
// Real "false" boolean value will be detected by API as true
20
20
if ( parameter . type === 'boolean' ) {
21
+ // @ts -expect-error
21
22
delete parameter . type ;
22
23
parameter . $ref = baseBoolIntRef ;
23
24
}
Original file line number Diff line number Diff line change
1
+ import { areQuotesNeededForProperty } from './helpers' ;
2
+
3
+ test ( 'areQuotesNeededForProperty' , ( ) => {
4
+ expect ( areQuotesNeededForProperty ( 'user_id' ) ) . toBe ( false ) ;
5
+ expect ( areQuotesNeededForProperty ( 'uuid4' ) ) . toBe ( false ) ;
6
+ expect ( areQuotesNeededForProperty ( '_foo' ) ) . toBe ( false ) ;
7
+
8
+ expect ( areQuotesNeededForProperty ( '4uuid' ) ) . toBe ( true ) ;
9
+ expect ( areQuotesNeededForProperty ( 'user-id' ) ) . toBe ( true ) ;
10
+ expect ( areQuotesNeededForProperty ( 'user&id' ) ) . toBe ( true ) ;
11
+ expect ( areQuotesNeededForProperty ( 'идентификатор' ) ) . toBe ( true ) ;
12
+ } ) ;
Original file line number Diff line number Diff line change @@ -111,9 +111,10 @@ export function areQuotesNeededForProperty(name: string | number): boolean {
111
111
return false ;
112
112
}
113
113
114
- if ( / [ & ] / . test ( name ) ) {
114
+ if ( / [ & - ] / . test ( name ) ) {
115
115
return true ;
116
116
}
117
+
117
118
return ! ( / ^ [ a - z _ ] ( [ a - z 0 - 9 _ ] ) + $ / i. test ( name ) || / ^ [ a - z _ ] / i. test ( name ) ) ;
118
119
}
119
120
You can’t perform that action at this time.
0 commit comments