@putout/plugin-remove-useless-escape 7.0.0 → 8.0.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/lib/remove-useless-escape.js +7 -10
- package/package.json +8 -8
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const emojiRegex = require('emoji-regex');
|
|
4
|
-
|
|
5
|
-
const {types, operator} = require('putout');
|
|
1
|
+
import emojiRegex from 'emoji-regex';
|
|
2
|
+
import {types, operator} from 'putout';
|
|
6
3
|
|
|
7
4
|
const {replaceWith} = operator;
|
|
8
|
-
const {
|
|
5
|
+
const {regExpLiteral} = types;
|
|
9
6
|
const {assign} = Object;
|
|
10
7
|
|
|
11
|
-
|
|
8
|
+
export const report = () => 'Unnecessary escape character';
|
|
12
9
|
|
|
13
|
-
|
|
10
|
+
export const fix = (path) => {
|
|
14
11
|
if (path.isStringLiteral()) {
|
|
15
12
|
const {raw} = path.node;
|
|
16
13
|
|
|
@@ -25,7 +22,7 @@ module.exports.fix = (path) => {
|
|
|
25
22
|
const unescaped = unescapeRegExp(pattern);
|
|
26
23
|
const raw = `/${unescaped}/`;
|
|
27
24
|
|
|
28
|
-
const regExpNode = assign(
|
|
25
|
+
const regExpNode = assign(regExpLiteral(unescaped, flags), {
|
|
29
26
|
value: unescaped,
|
|
30
27
|
raw,
|
|
31
28
|
extra: {
|
|
@@ -44,7 +41,7 @@ module.exports.fix = (path) => {
|
|
|
44
41
|
}
|
|
45
42
|
};
|
|
46
43
|
|
|
47
|
-
|
|
44
|
+
export const traverse = ({push}) => ({
|
|
48
45
|
'RegExpLiteral'(path) {
|
|
49
46
|
const {raw} = path.node;
|
|
50
47
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-remove-useless-escape",
|
|
3
|
-
"version": "
|
|
4
|
-
"type": "
|
|
3
|
+
"version": "8.0.0",
|
|
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",
|
|
7
7
|
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-useless-escape#readme",
|
|
@@ -36,22 +36,22 @@
|
|
|
36
36
|
"escape"
|
|
37
37
|
],
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@putout/eslint-flat": "^
|
|
39
|
+
"@putout/eslint-flat": "^3.0.0",
|
|
40
40
|
"@putout/plugin-madrun": "*",
|
|
41
41
|
"@putout/plugin-regexp": "*",
|
|
42
|
-
"@putout/test": "^
|
|
42
|
+
"@putout/test": "^13.0.0",
|
|
43
43
|
"c8": "^10.0.0",
|
|
44
44
|
"eslint": "^9.0.0",
|
|
45
45
|
"eslint-plugin-n": "^17.0.0",
|
|
46
|
-
"eslint-plugin-putout": "^
|
|
47
|
-
"madrun": "^
|
|
46
|
+
"eslint-plugin-putout": "^26.0.0",
|
|
47
|
+
"madrun": "^11.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"putout": ">=
|
|
50
|
+
"putout": ">=40"
|
|
51
51
|
},
|
|
52
52
|
"license": "MIT",
|
|
53
53
|
"engines": {
|
|
54
|
-
"node": ">=
|
|
54
|
+
"node": ">=20"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|