File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,12 @@ const LOADER_EXCLUDE_FORBIDDEN = oneLine`
27
27
which might inadvertently slow your build down. Use \`include\` instead. (loader-prefer-include)
28
28
`
29
29
30
+ const LOADER_IN_LOADERS_MESSAGE = oneLine `
31
+ at position {{pos}} must be a String or an Object with properties:
32
+ "loader": (String, required),
33
+ "query": (Object, optional)
34
+ `
35
+
30
36
const conditionSchema = Joi . array ( ) . items ( [
31
37
Joi . string ( ) ,
32
38
Joi . object ( ) . type ( RegExp ) ,
@@ -46,7 +52,13 @@ const loaderSchemaFn = ({ rules }) => {
46
52
loader : Joi . string ( ) . required ( ) ,
47
53
query : Joi . object ( ) ,
48
54
} )
49
- ) ,
55
+ ) . options ( {
56
+ language : {
57
+ array : {
58
+ includes : LOADER_IN_LOADERS_MESSAGE ,
59
+ } ,
60
+ } ,
61
+ } ) ,
50
62
} )
51
63
. xor ( 'loaders' , 'loader' )
52
64
. nand ( 'loaders' , 'query' )
Original file line number Diff line number Diff line change 1
- import schemaFn , { CONDITION_MESSAGE , LOADERS_QUERY_MESSAGE } from './index'
1
+ import schemaFn , {
2
+ CONDITION_MESSAGE ,
3
+ LOADERS_QUERY_MESSAGE ,
4
+ LOADER_IN_LOADERS_MESSAGE ,
5
+ } from './index'
2
6
import { allValid , allInvalid } from '../../../test/utils'
3
7
4
8
const validModuleConfigs = [
@@ -96,7 +100,7 @@ const invalidModuleConfigs = [
96
100
] ,
97
101
} ,
98
102
error : {
99
- message : '"loaders" at position 0 does not match any of the allowed types' ,
103
+ message : LOADER_IN_LOADERS_MESSAGE ,
100
104
path : 'loaders.0.loaders.0' ,
101
105
} ,
102
106
} ,
@@ -177,7 +181,7 @@ const invalidModuleConfigs = [
177
181
} ] ,
178
182
} ,
179
183
error : {
180
- message : '"loaders" at position 0 does not match any of the allowed types' ,
184
+ message : LOADER_IN_LOADERS_MESSAGE ,
181
185
path : 'loaders.0.loaders.0' ,
182
186
} ,
183
187
} ,
@@ -193,7 +197,7 @@ const invalidModuleConfigs = [
193
197
} ] ,
194
198
} ,
195
199
error : {
196
- message : '"loaders" at position 0 does not match any of the allowed types' ,
200
+ message : LOADER_IN_LOADERS_MESSAGE ,
197
201
path : 'loaders.0.loaders.0' ,
198
202
} ,
199
203
} ,
You can’t perform that action at this time.
0 commit comments