putout 23.6.0 → 23.7.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/ChangeLog CHANGED
@@ -1,3 +1,16 @@
1
+ 2022.01.10, v23.7.0
2
+
3
+ fix:
4
+ - (@putout/plugin-nodejs) convert-dirname-to-url
5
+
6
+ feature:
7
+ - (putout) eslint: add ability to pass config
8
+ - (eslint-plugin-putout) safe: disable remove-newline-from-empty-objects
9
+ - (eslint-plugin-putout) remove-newline-from-empty-object: add support of inner comments
10
+ - (@putout/plugin-remove-empty) add support of export
11
+ - (@putout/plugin-remove-empty) simplify namings
12
+
13
+
1
14
  2022.01.09, v23.6.0
2
15
 
3
16
  fix:
@@ -28,13 +28,14 @@ const cutNewLine = ({message}) => ({
28
28
  message: message.replace(/\n.*/, ''),
29
29
  });
30
30
 
31
- const getESLint = ({fix}) => {
31
+ const getESLint = ({fix, config}) => {
32
32
  const eslint = new ESLint({
33
33
  fix,
34
34
  overrideConfig: {
35
35
  ignorePatterns: [
36
36
  '!.*',
37
37
  ],
38
+ ...config,
38
39
  },
39
40
  ...overrideConfigFile && {
40
41
  overrideConfigFile,
@@ -48,7 +49,7 @@ const getESLint = ({fix}) => {
48
49
  };
49
50
  };
50
51
 
51
- module.exports = async ({name, code, fix}) => {
52
+ module.exports = async ({name, code, fix, config}) => {
52
53
  const noChanges = [
53
54
  code,
54
55
  [],
@@ -59,6 +60,7 @@ module.exports = async ({name, code, fix}) => {
59
60
 
60
61
  const [eslintError, eslint] = await tryToCatch(getESLint, {
61
62
  fix,
63
+ config,
62
64
  });
63
65
 
64
66
  if (eslintError)
@@ -67,9 +69,9 @@ module.exports = async ({name, code, fix}) => {
67
69
  [convertToPlace(cutNewLine(eslintError))],
68
70
  ];
69
71
 
70
- const [configError, config] = await tryToCatch(eslint.calculateConfigForFile, name);
72
+ const [configError, finalConfig] = await tryToCatch(eslint.calculateConfigForFile, name);
71
73
 
72
- if (noConfigFound(config, configError))
74
+ if (noConfigFound(finalConfig, configError))
73
75
  return noChanges;
74
76
 
75
77
  if (configError) {
@@ -79,10 +81,10 @@ module.exports = async ({name, code, fix}) => {
79
81
  ];
80
82
  }
81
83
 
82
- disablePutout(config);
84
+ disablePutout(finalConfig);
83
85
 
84
86
  // that's right, we disabled "putout" rules in "config"
85
- // and now it is in eslint's cache
87
+ // and now it located in eslint's cache
86
88
  const results = await eslint.lintText(code, {
87
89
  filePath: name,
88
90
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "23.6.0",
3
+ "version": "23.7.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊 Pluggable and configurable code transformer with built-in eslint and babel plugins support of js, jsx typescript, flow files, markdown, yaml and json",