@putout/plugin-remove-useless-escape 3.1.1 β 3.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 +7 -0
- package/lib/remove-useless-escape.js +4 -3
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -39,6 +39,13 @@ const s = `hello 'world'`;
|
|
|
39
39
|
const reg = /\w:/g;
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
## Comparison
|
|
43
|
+
|
|
44
|
+
Linter | Rule | Fix
|
|
45
|
+
--------|-------|------------|
|
|
46
|
+
π **Putout**| [`remove-useless-escape`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-useless-escape#readme)| β
|
|
47
|
+
β£ **ESLint** | [`no-useless-escape`](https://eslint.org/docs/rules/no-useless-escape) | β
|
|
48
|
+
|
|
42
49
|
## License
|
|
43
50
|
|
|
44
51
|
MIT
|
|
@@ -16,6 +16,7 @@ module.exports.fix = (path) => {
|
|
|
16
16
|
if (path.isStringLiteral()) {
|
|
17
17
|
const {raw} = path.node;
|
|
18
18
|
path.node.raw = unEscape(raw);
|
|
19
|
+
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -62,13 +63,13 @@ module.exports.traverse = ({push}) => ({
|
|
|
62
63
|
for (const tmpl of path.node.quasis) {
|
|
63
64
|
const {raw} = tmpl.value;
|
|
64
65
|
|
|
65
|
-
if (
|
|
66
|
+
if (isEscaped(raw))
|
|
66
67
|
return push(path);
|
|
67
68
|
|
|
68
|
-
if (
|
|
69
|
+
if (hasQuote(raw))
|
|
69
70
|
return push(path);
|
|
70
71
|
|
|
71
|
-
if (raw.includes('
|
|
72
|
+
if (raw.includes(`\\'`) && !raw.includes(`\\\\'`))
|
|
72
73
|
return push(path);
|
|
73
74
|
}
|
|
74
75
|
},
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-remove-useless-escape",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "πPutout plugin adds ability to find and remove useless escape",
|
|
7
7
|
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-useless-escape#readme",
|
|
8
8
|
"main": "lib/remove-useless-escape.js",
|
|
9
|
+
"commitType": "colon",
|
|
9
10
|
"release": false,
|
|
10
11
|
"tag": false,
|
|
11
12
|
"changelog": false,
|
|
@@ -40,8 +41,8 @@
|
|
|
40
41
|
"@putout/test": "^5.0.0",
|
|
41
42
|
"c8": "^7.5.0",
|
|
42
43
|
"eslint": "^8.0.1",
|
|
43
|
-
"eslint-plugin-
|
|
44
|
-
"eslint-plugin-putout": "^
|
|
44
|
+
"eslint-plugin-n": "^15.2.4",
|
|
45
|
+
"eslint-plugin-putout": "^16.0.0",
|
|
45
46
|
"madrun": "^9.0.0"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|