putout 23.4.0 → 23.8.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,72 @@
1
+ 2022.01.11, v23.8.0
2
+
3
+ feature:
4
+ - (package) @putout/plugin-madrun v12.0.0
5
+ - (@putout/plugin-madrun) drop support of putout < 23
6
+ - (@putout/operate) add getExportDefault
7
+ - (@putout/plugin-madrun) add convert-cut-env-to-run
8
+ - (@putout/plugin-madrun) add convert-run-to-cut-env
9
+ - (@putout/plugin-remove-useless-spread) exclude comments
10
+
11
+
12
+ 2022.01.10, v23.7.0
13
+
14
+ fix:
15
+ - (@putout/plugin-nodejs) convert-dirname-to-url
16
+
17
+ feature:
18
+ - (putout) eslint: add ability to pass config
19
+ - (eslint-plugin-putout) safe: disable remove-newline-from-empty-objects
20
+ - (eslint-plugin-putout) remove-newline-from-empty-object: add support of inner comments
21
+ - (@putout/plugin-remove-empty) add support of export
22
+ - (@putout/plugin-remove-empty) simplify namings
23
+
24
+
25
+ 2022.01.09, v23.6.0
26
+
27
+ fix:
28
+ - (@putout/engine-runner) find: options
29
+ - (eslint-plugin-putout) add-newline-after-function-call: multiple empty lines
30
+ - feature(@putout/plugin-declare-undefined-variables) add fixtures
31
+ - feature(@putout/engine-runner) add support to clear replace watermarks after fix round is done
32
+ - (@putout/engine-parser) btoa: get back node v14 support
33
+ - (@putout/engine-parser) sourcemap url
34
+
35
+ feature:
36
+ - (package) @putout/plugin-nodejs v2.0.0
37
+ - (@putout/plugin-nodejs) drop support of putout < 23
38
+ - (@putout/plugin-nodejs) add convert-dirname-to-url
39
+ - (@putout/plugin-putout) declare: add isESM
40
+ - (package) @putout/plugin-convert-commonjs-to-esm v7.0.0
41
+ - (@putout/plugin-convert-commonjs-to-esm) drop support of putout < 23
42
+ - (@putout/plugin-convert-commonjs-to-esm) commonjs: use node.js built-ins, instead of simport
43
+ - (@putout/operator-declare) add ability to pass only "esm" or only "commonjs"
44
+ - (@putout/eslint-config) padding-line-between-statements: add newline before "for", after block-like
45
+ - (eslint-plugin-putout) add-newline-before-function-call: add support of AssignmentExpression
46
+ - (@putout/plugin-tape) add convert-equal-to-deep-equal
47
+ - (@putout/plugin-gitignore) add support of .idea
48
+ - (@putout/plugin-eslint) add apply-safe-align
49
+ - (eslint-plugin-putout) add safe+align
50
+ - (@putout/plugin-declare-undefined-variables) add fixtures
51
+ - (@putout/plugin-putout) declare: add compareAny, compareAll
52
+ - (@putout/plugin-putout) declare: add replaceWithMultiple
53
+ - (@putout/plugin-convert-commonjs-to-esm) require: add support of MemberExpression
54
+ - (@putout/plugin-tape) convert-equal-to-not-ok: add support of equal/notEqual with one argument passed
55
+ - (@putout/plugin-remove-useless-return) add support of nested functions
56
+ - (@putout/compare) is: parseTemplate: avoid caching exception as undefined
57
+ - (@putout/engine-runner) add support to clear replace watermarks after fix round is done
58
+
59
+
60
+ 2021.12.30, v23.5.0
61
+
62
+ fix:
63
+ - (eslint-plugin-putout) newline-function-call-arguments: exclude code contains quote
64
+
65
+ feature:
66
+ - (putout) add support of sourcemaps
67
+ - (@putout/engine-parser) add sourcemaps support
68
+
69
+
1
70
  2021.12.29, v23.4.0
2
71
 
3
72
  feature:
@@ -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
  });
@@ -135,7 +135,5 @@ const _readHomeOptions = once(() => {
135
135
  return data;
136
136
  });
137
137
 
138
- const _readCodeMods = once(() => {
139
- return readRules(home, '.putout');
140
- });
138
+ const _readCodeMods = once(() => readRules(home, '.putout'));
141
139
 
package/lib/putout.js CHANGED
@@ -40,10 +40,13 @@ module.exports = (source, opts) => {
40
40
  isTS,
41
41
  isFlow,
42
42
  isJSX,
43
+ sourceFileName,
44
+ sourceMapName,
43
45
  } = opts;
44
46
 
45
47
  const [clearSource, shebang] = cutShebang(source);
46
48
  const ast = parse(clearSource, {
49
+ sourceFileName,
47
50
  parser,
48
51
  isTS,
49
52
  isFlow,
@@ -58,7 +61,9 @@ module.exports = (source, opts) => {
58
61
  places,
59
62
  };
60
63
 
61
- const printed = print(ast);
64
+ const printed = print(ast, {
65
+ sourceMapName,
66
+ });
62
67
  const code = `${shebang}${printed}`;
63
68
 
64
69
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "23.4.0",
3
+ "version": "23.8.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",
@@ -85,7 +85,7 @@
85
85
  "@putout/plugin-convert-assignment-to-arrow-function": "^1.0.0",
86
86
  "@putout/plugin-convert-assignment-to-comparison": "^1.0.0",
87
87
  "@putout/plugin-convert-bitwise-to-logical": "^1.0.0",
88
- "@putout/plugin-convert-commonjs-to-esm": "^6.0.0",
88
+ "@putout/plugin-convert-commonjs-to-esm": "^7.0.0",
89
89
  "@putout/plugin-convert-comparison-to-boolean": "^2.0.0",
90
90
  "@putout/plugin-convert-concat-to-flat": "^1.0.0",
91
91
  "@putout/plugin-convert-equal-to-strict-equal": "^1.0.0",
@@ -110,11 +110,11 @@
110
110
  "@putout/plugin-extract-sequence-expressions": "^2.0.0",
111
111
  "@putout/plugin-github": "^2.0.0",
112
112
  "@putout/plugin-gitignore": "^3.0.0",
113
- "@putout/plugin-madrun": "^11.0.0",
113
+ "@putout/plugin-madrun": "^12.0.0",
114
114
  "@putout/plugin-merge-destructuring-properties": "^5.0.0",
115
115
  "@putout/plugin-merge-duplicate-imports": "^4.0.0",
116
116
  "@putout/plugin-merge-if-statements": "^3.0.0",
117
- "@putout/plugin-nodejs": "^1.0.0",
117
+ "@putout/plugin-nodejs": "^2.0.0",
118
118
  "@putout/plugin-npmignore": "^2.0.0",
119
119
  "@putout/plugin-package-json": "^2.0.0",
120
120
  "@putout/plugin-promises": "^6.0.0",