@putout/engine-runner 11.3.1 → 11.6.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
@@ -1,11 +1,9 @@
1
- # @putout/engine-runner [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL]
1
+ # @putout/engine-runner [![NPM version][NPMIMGURL]][NPMURL]
2
2
 
3
3
  [NPMIMGURL]: https://img.shields.io/npm/v/@putout/engine-runner.svg?style=flat&longCache=true
4
4
  [NPMURL]: https://npmjs.org/package/@putout/engine-runner"npm"
5
- [DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/engine-runner
6
- [DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/engine-runner
7
5
 
8
- Run putout plugins.
6
+ Run 🐊[`Putout`](https://github.com/coderaiser/putout) plugins.
9
7
 
10
8
  ## Install
11
9
 
@@ -161,7 +159,7 @@ Where `__` can be any node. All this possible with help of [@putout/compare](htt
161
159
  ```js
162
160
  module.exports.report = () => 'debugger statement should not be used';
163
161
 
164
- module.exports.fix = (path) => {
162
+ module.exports.fix = (path, {options}) => {
165
163
  path.remove();
166
164
  };
167
165
 
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();
@@ -87,7 +88,7 @@ function getStore(plugin, {fix, rule, shebang, msg}) {
87
88
  const position = getPosition(path, shebang);
88
89
  const message = msg || plugin.report(path);
89
90
 
90
- placesStore ({
91
+ placesStore({
91
92
  message,
92
93
  position,
93
94
  });
@@ -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(b))} -> ${stringify(keys(a))}`);
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
 
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@putout/engine-runner",
3
- "version": "11.3.1",
3
+ "version": "11.6.0",
4
4
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5
5
  "description": "run putout plugins",
6
- "homepage": "http://github.com/coderaiser/putout",
6
+ "homepage": "https://github.com/coderaiser/putout/tree/master/packages/engine-runner",
7
7
  "main": "lib/index.js",
8
8
  "release": false,
9
9
  "tag": false,
@@ -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",
@@ -43,9 +43,9 @@
43
43
  "@babel/plugin-codemod-optional-catch-binding": "^7.7.4",
44
44
  "@cloudcmd/stub": "^3.0.0",
45
45
  "c8": "^7.5.0",
46
- "eslint": "^8.0.0-beta.0",
46
+ "eslint": "^8.0.1",
47
47
  "eslint-plugin-node": "^11.0.0",
48
- "eslint-plugin-putout": "^9.0.0",
48
+ "eslint-plugin-putout": "^12.0.0",
49
49
  "just-camel-case": "^4.0.2",
50
50
  "lerna": "^4.0.0",
51
51
  "madrun": "^8.0.1",