@putout/plugin-remove-useless-escape 9.0.0 → 9.2.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/README.md +1 -1
- package/lib/remove-useless-escape.js +8 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @putout/plugin-remove-useless-escape [![NPM version][NPMIMGURL]][NPMURL]
|
|
2
2
|
|
|
3
3
|
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-escape.svg?style=flat&longCache=true
|
|
4
|
-
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-escape"npm"
|
|
4
|
+
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-escape "npm"
|
|
5
5
|
|
|
6
6
|
🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove useless escape.
|
|
7
7
|
|
|
@@ -29,6 +29,9 @@ export const traverse = ({push}) => ({
|
|
|
29
29
|
for (const tmpl of path.node.quasis) {
|
|
30
30
|
const {raw} = tmpl.value;
|
|
31
31
|
|
|
32
|
+
if (raw.includes('$'))
|
|
33
|
+
return;
|
|
34
|
+
|
|
32
35
|
if (isEscaped(raw))
|
|
33
36
|
return push(path);
|
|
34
37
|
|
|
@@ -71,6 +74,9 @@ function isEscaped(raw) {
|
|
|
71
74
|
if (raw.includes('\\h') && !raw.includes('\\\\h'))
|
|
72
75
|
return true;
|
|
73
76
|
|
|
77
|
+
if (raw.includes('\\z') && !raw.includes('\\\\z'))
|
|
78
|
+
return true;
|
|
79
|
+
|
|
74
80
|
if (/\\\\/g.test(raw))
|
|
75
81
|
return false;
|
|
76
82
|
|
|
@@ -114,7 +120,8 @@ function unEscape(raw) {
|
|
|
114
120
|
.replaceAll('\\{', '{')
|
|
115
121
|
.replaceAll('\\.', '.')
|
|
116
122
|
.replace(/(\\),/, ',')
|
|
117
|
-
.replaceAll('\\h', 'h')
|
|
123
|
+
.replaceAll('\\h', 'h')
|
|
124
|
+
.replaceAll('\\z', 'z');
|
|
118
125
|
|
|
119
126
|
for (const emoji of match(raw)) {
|
|
120
127
|
raw = raw.replace(createEncodedRegExp(emoji), emoji);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-remove-useless-escape",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin adds ability to find and remove useless escape",
|
|
@@ -36,22 +36,22 @@
|
|
|
36
36
|
"escape"
|
|
37
37
|
],
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@putout/eslint-flat": "^
|
|
39
|
+
"@putout/eslint-flat": "^4.0.0",
|
|
40
40
|
"@putout/plugin-madrun": "*",
|
|
41
41
|
"@putout/plugin-regexp": "*",
|
|
42
|
-
"@putout/test": "^
|
|
42
|
+
"@putout/test": "^15.0.0",
|
|
43
43
|
"c8": "^10.0.0",
|
|
44
|
-
"eslint": "
|
|
44
|
+
"eslint": "^10.0.0",
|
|
45
45
|
"eslint-plugin-n": "^17.0.0",
|
|
46
|
-
"eslint-plugin-putout": "^
|
|
47
|
-
"madrun": "^
|
|
46
|
+
"eslint-plugin-putout": "^30.0.0",
|
|
47
|
+
"madrun": "^12.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"putout": ">=41"
|
|
51
51
|
},
|
|
52
52
|
"license": "MIT",
|
|
53
53
|
"engines": {
|
|
54
|
-
"node": ">=
|
|
54
|
+
"node": ">=22"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|