@putout/engine-runner 11.3.0 → 11.5.0

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/README.md CHANGED
@@ -161,7 +161,7 @@ Where `__` can be any node. All this possible with help of [@putout/compare](htt
161
161
  ```js
162
162
  module.exports.report = () => 'debugger statement should not be used';
163
163
 
164
- module.exports.fix = (path) => {
164
+ module.exports.fix = (path, {options}) => {
165
165
  path.remove();
166
166
  };
167
167
 
package/lib/include.js CHANGED
@@ -1,10 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  const log = require('debug')('putout:runner:include');
4
+ const maybeArray = require('./maybe-array');
4
5
 
6
+ const {stringify} = JSON;
5
7
  const stub = () => [];
6
8
  const good = () => true;
7
- const maybeArray = require('./maybe-array');
9
+ const isFn = (a) => typeof a === 'function';
8
10
 
9
11
  module.exports = ({rule, plugin, msg, options}) => {
10
12
  const {
@@ -15,6 +17,9 @@ module.exports = ({rule, plugin, msg, options}) => {
15
17
  filter = good,
16
18
  } = plugin;
17
19
 
20
+ if (!isFn(include))
21
+ throw Error(`☝️ Looks like "include" is not a function: ${stringify(include)}. More on using Includer: https://git.io/JqcMn`);
22
+
18
23
  const traverse = getTraverse(include(), filter, rule);
19
24
 
20
25
  return {
@@ -39,6 +39,7 @@ module.exports = (pluginsToMerge, {fix, shebang, template}) => {
39
39
  rule,
40
40
  shebang,
41
41
  msg,
42
+ options,
42
43
  });
43
44
 
44
45
  pushed[rule] = pull;
@@ -78,7 +79,7 @@ module.exports = (pluginsToMerge, {fix, shebang, template}) => {
78
79
  };
79
80
  };
80
81
 
81
- function getStore(plugin, {fix, rule, shebang, msg}) {
82
+ function getStore(plugin, {fix, rule, shebang, msg, options}) {
82
83
  const store = mapStore();
83
84
  const list = listStore();
84
85
  const placesStore = listStore();
@@ -96,6 +97,7 @@ function getStore(plugin, {fix, rule, shebang, msg}) {
96
97
  path,
97
98
  rule,
98
99
  position,
100
+ options,
99
101
  });
100
102
  };
101
103
 
@@ -26,7 +26,7 @@ const isObj = (a) => typeof a === 'object';
26
26
  const validateTemplateValues = (a, b) => {
27
27
  for (const key of keys(a)) {
28
28
  if (!b[key])
29
- throw Error(`☝️ Looks like template values not linked: ${stringify(keys(a))} ${stringify(keys(b))}`);
29
+ throw Error(`☝️ Looks like template values not linked: ${stringify(keys(a))} ${stringify(keys(b))}`);
30
30
  }
31
31
  };
32
32
 
package/lib/run-fix.js CHANGED
@@ -4,8 +4,8 @@ const tryCatch = require('try-catch');
4
4
  const debug = require('debug')('putout:runner:fix');
5
5
  const {enabled} = debug;
6
6
 
7
- const tryToFix = (fix, {path, position}) => {
8
- const [e] = tryCatch(fix, path);
7
+ const tryToFix = (fix, {path, position, options}) => {
8
+ const [e] = tryCatch(fix, path, {options});
9
9
 
10
10
  if (!e)
11
11
  return;
@@ -15,7 +15,7 @@ const tryToFix = (fix, {path, position}) => {
15
15
  throw e;
16
16
  };
17
17
 
18
- module.exports = (is, fix, {path, rule, position}) => {
18
+ module.exports = (is, fix, {path, rule, position, options}) => {
19
19
  if (!is)
20
20
  return;
21
21
 
@@ -24,6 +24,7 @@ module.exports = (is, fix, {path, rule, position}) => {
24
24
  tryToFix(fix, {
25
25
  path,
26
26
  position,
27
+ options,
27
28
  });
28
29
  };
29
30
 
@@ -92,7 +92,7 @@ function wrapWithCheck({rule, nodesInclude, nodesExclude, fn}) {
92
92
  return;
93
93
 
94
94
  if (!isFn(fn))
95
- throw Error(`☝️ Looks like provided visitor is not a function: ${stringify(fn)}. More on using Traverser: https://git.io/JqcMn`);
95
+ throw Error(`☝️ Looks like provided visitor is not a function: ${stringify(fn)}. More on using Traverser: https://git.io/JqcMn`);
96
96
 
97
97
  const [e] = tryCatch(fn, path);
98
98
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/engine-runner",
3
- "version": "11.3.0",
3
+ "version": "11.5.0",
4
4
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5
5
  "description": "run putout plugins",
6
6
  "homepage": "http://github.com/coderaiser/putout",
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@babel/traverse": "^7.12.7",
27
27
  "@babel/types": "^7.12.7",
28
- "@putout/compare": "^7.6.0",
28
+ "@putout/compare": "^8.0.0",
29
29
  "@putout/engine-parser": "^4.0.1",
30
30
  "@putout/operate": "^6.0.0",
31
31
  "debug": "^4.1.1",
@@ -45,7 +45,7 @@
45
45
  "c8": "^7.5.0",
46
46
  "eslint": "^8.0.0-beta.0",
47
47
  "eslint-plugin-node": "^11.0.0",
48
- "eslint-plugin-putout": "^9.0.0",
48
+ "eslint-plugin-putout": "^10.0.0",
49
49
  "just-camel-case": "^4.0.2",
50
50
  "lerna": "^4.0.0",
51
51
  "madrun": "^8.0.1",