@putout/plugin-putout 29.18.0 → 29.19.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.
|
@@ -2,7 +2,7 @@ import {operator} from 'putout';
|
|
|
2
2
|
import regexpEscapePolifyll from 'regexp.escape';
|
|
3
3
|
|
|
4
4
|
const {
|
|
5
|
-
escape
|
|
5
|
+
escape = regexpEscapePolifyll,
|
|
6
6
|
} = RegExp;
|
|
7
7
|
|
|
8
8
|
const {
|
|
@@ -89,7 +89,7 @@ const check = ({__a}, path) => {
|
|
|
89
89
|
if (name.includes(')'))
|
|
90
90
|
return false;
|
|
91
91
|
|
|
92
|
-
const safeName =
|
|
92
|
+
const safeName = escape(name);
|
|
93
93
|
|
|
94
94
|
const regEnd = RegExp(`: ${safeName}$`);
|
|
95
95
|
const regMiddle = RegExp(`: ${safeName}: .*`);
|
|
@@ -68,7 +68,10 @@ export const replace = () => ({
|
|
|
68
68
|
const name = toKebabCase(value.name);
|
|
69
69
|
|
|
70
70
|
path.node.arguments[1] = arrayExpression([
|
|
71
|
-
arrayExpression([
|
|
71
|
+
arrayExpression([
|
|
72
|
+
stringLiteral(name),
|
|
73
|
+
value,
|
|
74
|
+
]),
|
|
72
75
|
]);
|
|
73
76
|
|
|
74
77
|
return path;
|
|
@@ -75,7 +75,9 @@ export const fix = (path, {options}) => {
|
|
|
75
75
|
if (path.parentPath.parentPath.isTSModuleBlock()) {
|
|
76
76
|
const key = identifier(getVar());
|
|
77
77
|
|
|
78
|
-
replaceWith(path, variableDeclaration('var', [
|
|
78
|
+
replaceWith(path, variableDeclaration('var', [
|
|
79
|
+
variableDeclarator(key),
|
|
80
|
+
]));
|
|
79
81
|
|
|
80
82
|
return;
|
|
81
83
|
}
|
package/package.json
CHANGED