File tree 4 files changed +36
-48
lines changed
4 files changed +36
-48
lines changed Original file line number Diff line number Diff line change 1
1
{
2
+ "settings": {
3
+ "jsdoc": {
4
+ "mode": "typescript"
5
+ }
6
+ },
2
7
"root": true,
3
8
"extends": [
4
- "@hckrnews/eslint-config"
9
+ "@hckrnews/eslint-config",
10
+ "plugin:import/recommended",
11
+ "plugin:n/recommended",
12
+ "plugin:jsdoc/recommended"
5
13
],
6
14
"plugins": [
7
15
"import"
15
23
}
16
24
],
17
25
"consistent-return": "warn",
18
- "eqeqeq": "warn"
26
+ "eqeqeq": "warn",
27
+ "jsdoc/require-param-description": "off",
28
+ "jsdoc/require-property-description": "off",
29
+ "jsdoc/require-returns-description": "off",
30
+ "max-len": [
31
+ "warn",
32
+ {
33
+ "code": 120
34
+ }
35
+ ]
19
36
},
20
37
"env": {
21
38
"es6": true,
24
41
"browser": true
25
42
},
26
43
"parserOptions": {
44
+ "ecmaVersion": "latest",
27
45
"sourceType": "module"
28
46
},
29
47
}
Original file line number Diff line number Diff line change 39
39
"eslint-config-prettier" : " ^9.0.0" ,
40
40
"eslint-plugin-html" : " ^8.0.0" ,
41
41
"eslint-plugin-import" : " ^2.26.0" ,
42
+ "eslint-plugin-jsdoc" : " ^48.8.3" ,
42
43
"eslint-plugin-jsx-a11y" : " ^6.6.0" ,
44
+ "eslint-plugin-n" : " ^16.0.0" ,
43
45
"eslint-plugin-prettier" : " ^5.1.3" ,
44
46
"jscpd" : " ^4.0.0" ,
45
47
"prettier" : " ^3.2.5"
55
57
"type" : " github" ,
56
58
"url" : " https://github.com/sponsors/w3nl"
57
59
}
58
- }
60
+ }
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ const types = {
18
18
class Validator {
19
19
/**
20
20
* Set the schema for the validator.
21
- *
22
21
* @param {object } schema
23
22
*/
24
23
constructor ( schema ) {
@@ -28,10 +27,8 @@ class Validator {
28
27
29
28
/**
30
29
* Validate the an array of items.
31
- *
32
- * @param {array } input
33
- *
34
- * @return {boolean }
30
+ * @param {Array } input
31
+ * @returns {boolean }
35
32
*/
36
33
validateAll ( input ) {
37
34
this . errors = [ ] ;
@@ -44,10 +41,8 @@ class Validator {
44
41
45
42
/**
46
43
* Validate the input.
47
- *
48
44
* @param {object } input
49
- *
50
- * @return {boolean }
45
+ * @returns {boolean }
51
46
*/
52
47
validate ( input ) {
53
48
this . errors = [ ] ;
@@ -56,10 +51,8 @@ class Validator {
56
51
57
52
/**
58
53
* Validate an item.
59
- *
60
54
* @param {object } item
61
- *
62
- * @return {boolean }
55
+ * @returns {boolean }
63
56
*/
64
57
validateItem ( item ) {
65
58
this . errors = Object . entries ( this . schema ) . filter (
@@ -90,7 +83,7 @@ class Validator {
90
83
* @param {string } fieldNameRaw
91
84
* @param {any } fieldType
92
85
* @param {object } item
93
- * @return {boolean }
86
+ * @returns {boolean }
94
87
*/
95
88
filterItems ( fieldNameRaw , fieldType , item ) {
96
89
if ( ! item ) {
@@ -147,23 +140,19 @@ class Validator {
147
140
148
141
/**
149
142
* Validate an array
150
- *
151
143
* @param {any } value
152
144
* @param {string } fieldType
153
- *
154
- * @return {boolean }
145
+ * @returns {boolean }
155
146
*/
156
147
validateArray ( value , fieldType ) {
157
148
return value . every ( ( item ) => this . validateObject ( item , fieldType ) ) ;
158
149
}
159
150
160
151
/**
161
152
* Validate an object
162
- *
163
153
* @param {any } value
164
154
* @param {string } fieldType
165
- *
166
- * @return {boolean }
155
+ * @returns {boolean }
167
156
*/
168
157
validateObject ( value , fieldType ) {
169
158
const validator = new Validator ( fieldType ) ;
You can’t perform that action at this time.
0 commit comments