@putout/plugin-putout 26.12.0 → 26.14.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.
@@ -23,4 +23,5 @@ export const match = () => ({
23
23
 
24
24
  export const replace = () => ({
25
25
  't.transform(__a, __b)': 't.transformWithOptions(__a, __b)',
26
+ 't.transformWithOptions(__a)': 't.transform(__a)',
26
27
  });
@@ -14,10 +14,10 @@ export const fix = ({path, incorrect, correct}) => {
14
14
 
15
15
  const INCORRECT = {
16
16
  REPORT: /: (no report after transform|no report|transform|no transform)/,
17
- NO_REPORT: /: (no report after transform|report|(transform|no transform)(\swith options)?)/,
17
+ NO_REPORT: /: (no report (after transform|with options)|report|(transform|no transform)(\swith options)?)/,
18
18
  NO_REPORT_AFTER_TRANSFORM: /: (report|transform|no transform|no report)/,
19
19
  NO_REPORT_WITH_OPTIONS: /: (no report after transform(\swith options)?|report|transform|no transform|no report)/,
20
- TRANSFORM: /: (no report after transform|no transform|report|no report)/,
20
+ TRANSFORM: /: (transform with options|no report after transform|no transform|report|no report)/,
21
21
  NO_TRANSFORM: /: (no report after transform|transform|report|no report)/,
22
22
  TRANSFORM_WITH_OPTIONS: /: (no report after transform|transform|no transform(\swith options)?|report|no report)/,
23
23
  NO_TRANSFORM_WITH_OPTIONS: /: (no report after transform|transform(\swith options)?|no transform|report|no report)/,
@@ -109,10 +109,19 @@ function isCorrect({path, correct, incorrect}) {
109
109
 
110
110
  const {value} = messagePath.node;
111
111
 
112
- if (value.includes(correct))
112
+ if (containsCorrect(value, correct))
113
113
  return [CORRECT];
114
114
 
115
115
  const is = !incorrect.test(value);
116
116
 
117
117
  return [is, messagePath];
118
118
  }
119
+
120
+ function containsCorrect(value, correct) {
121
+ if (!value.includes(correct))
122
+ return false;
123
+
124
+ const nextIndex = value.indexOf(correct) + correct.length;
125
+
126
+ return value.charAt(nextIndex) !== ' ';
127
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "26.12.0",
3
+ "version": "26.14.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin helps with plugins development",