@putout/engine-runner 28.0.1 → 28.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/includer/index.js +4 -0
- package/lib/validate.js +8 -0
- package/package.json +1 -1
package/lib/includer/index.js
CHANGED
|
@@ -18,6 +18,10 @@ export const include = ({rule, plugin, msg, options}) => {
|
|
|
18
18
|
validate('include', include);
|
|
19
19
|
validate('report', report);
|
|
20
20
|
|
|
21
|
+
const includeItems = include();
|
|
22
|
+
|
|
23
|
+
validate('include-items', includeItems);
|
|
24
|
+
|
|
21
25
|
const traverse = getTraverse(include(), filter, rule);
|
|
22
26
|
|
|
23
27
|
return {
|
package/lib/validate.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
const isFn = (a) => typeof a === 'function';
|
|
2
2
|
const {stringify} = JSON;
|
|
3
|
+
const {isArray} = Array;
|
|
3
4
|
|
|
4
5
|
export const validate = (name, fn) => {
|
|
6
|
+
if (name === 'include-items') {
|
|
7
|
+
if (!isArray(fn))
|
|
8
|
+
throw Error(`☝️ Looks like 'include' do not returns an 'array'. More on using Includer: https://git.io/JqcMn`);
|
|
9
|
+
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
if (!isFn(fn))
|
|
6
14
|
throw Error(`☝️ Looks like '${name}' is not a 'function' but '${typeof fn}' with value: '${stringify(fn)}'. More on using Includer: https://git.io/JqcMn`);
|
|
7
15
|
};
|