putout 23.3.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,71 @@
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
+
14
+ 2022.01.09, v23.6.0
15
+
16
+ fix:
17
+ - (@putout/engine-runner) find: options
18
+ - (eslint-plugin-putout) add-newline-after-function-call: multiple empty lines
19
+ - feature(@putout/plugin-declare-undefined-variables) add fixtures
20
+ - feature(@putout/engine-runner) add support to clear replace watermarks after fix round is done
21
+ - (@putout/engine-parser) btoa: get back node v14 support
22
+ - (@putout/engine-parser) sourcemap url
23
+
24
+ feature:
25
+ - (package) @putout/plugin-nodejs v2.0.0
26
+ - (@putout/plugin-nodejs) drop support of putout < 23
27
+ - (@putout/plugin-nodejs) add convert-dirname-to-url
28
+ - (@putout/plugin-putout) declare: add isESM
29
+ - (package) @putout/plugin-convert-commonjs-to-esm v7.0.0
30
+ - (@putout/plugin-convert-commonjs-to-esm) drop support of putout < 23
31
+ - (@putout/plugin-convert-commonjs-to-esm) commonjs: use node.js built-ins, instead of simport
32
+ - (@putout/operator-declare) add ability to pass only "esm" or only "commonjs"
33
+ - (@putout/eslint-config) padding-line-between-statements: add newline before "for", after block-like
34
+ - (eslint-plugin-putout) add-newline-before-function-call: add support of AssignmentExpression
35
+ - (@putout/plugin-tape) add convert-equal-to-deep-equal
36
+ - (@putout/plugin-gitignore) add support of .idea
37
+ - (@putout/plugin-eslint) add apply-safe-align
38
+ - (eslint-plugin-putout) add safe+align
39
+ - (@putout/plugin-declare-undefined-variables) add fixtures
40
+ - (@putout/plugin-putout) declare: add compareAny, compareAll
41
+ - (@putout/plugin-putout) declare: add replaceWithMultiple
42
+ - (@putout/plugin-convert-commonjs-to-esm) require: add support of MemberExpression
43
+ - (@putout/plugin-tape) convert-equal-to-not-ok: add support of equal/notEqual with one argument passed
44
+ - (@putout/plugin-remove-useless-return) add support of nested functions
45
+ - (@putout/compare) is: parseTemplate: avoid caching exception as undefined
46
+ - (@putout/engine-runner) add support to clear replace watermarks after fix round is done
47
+
48
+
49
+ 2021.12.30, v23.5.0
50
+
51
+ fix:
52
+ - (eslint-plugin-putout) newline-function-call-arguments: exclude code contains quote
53
+
54
+ feature:
55
+ - (putout) add support of sourcemaps
56
+ - (@putout/engine-parser) add sourcemaps support
57
+
58
+
59
+ 2021.12.29, v23.4.0
60
+
61
+ feature:
62
+ - (package) @putout/plugin-package-json v2.0.0
63
+ - (@putout/package-json) drop support of putout < 23
64
+ - (@putout/plugin-putout) declare: add findProperties
65
+ - (@putout/plugin-package-json) add add-type
66
+ - (@putout/operate) add findProperties
67
+
68
+
1
69
  2021.12.26, v23.3.0
2
70
 
3
71
  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,7 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "23.3.0",
3
+ "version": "23.7.0",
4
+ "type": "commonjs",
4
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5
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",
6
7
  "homepage": "http://github.com/coderaiser/putout#readme",
@@ -84,7 +85,7 @@
84
85
  "@putout/plugin-convert-assignment-to-arrow-function": "^1.0.0",
85
86
  "@putout/plugin-convert-assignment-to-comparison": "^1.0.0",
86
87
  "@putout/plugin-convert-bitwise-to-logical": "^1.0.0",
87
- "@putout/plugin-convert-commonjs-to-esm": "^6.0.0",
88
+ "@putout/plugin-convert-commonjs-to-esm": "^7.0.0",
88
89
  "@putout/plugin-convert-comparison-to-boolean": "^2.0.0",
89
90
  "@putout/plugin-convert-concat-to-flat": "^1.0.0",
90
91
  "@putout/plugin-convert-equal-to-strict-equal": "^1.0.0",
@@ -113,9 +114,9 @@
113
114
  "@putout/plugin-merge-destructuring-properties": "^5.0.0",
114
115
  "@putout/plugin-merge-duplicate-imports": "^4.0.0",
115
116
  "@putout/plugin-merge-if-statements": "^3.0.0",
116
- "@putout/plugin-nodejs": "^1.0.0",
117
+ "@putout/plugin-nodejs": "^2.0.0",
117
118
  "@putout/plugin-npmignore": "^2.0.0",
118
- "@putout/plugin-package-json": "^1.0.0",
119
+ "@putout/plugin-package-json": "^2.0.0",
119
120
  "@putout/plugin-promises": "^6.0.0",
120
121
  "@putout/plugin-putout": "^8.0.0",
121
122
  "@putout/plugin-putout-config": "^2.0.0",