Skip to content

Commit 960602e

Browse files
committed
chore: apply eslint optimize-regex/optimize-regex
1 parent e8efeca commit 960602e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/convert.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default class Convert {
1919
if (newPath[0] !== '/') {
2020
newPath = `/${newPath}`;
2121
}
22-
return encodeURI(`file://${newPath}`).replace(/[?#]/g, encodeURIComponent);
22+
return encodeURI(`file://${newPath}`).replace(/[#?]/g, encodeURIComponent);
2323
}
2424

2525
/**
@@ -148,7 +148,7 @@ export default class Convert {
148148
'"': '"',
149149
"'": ''',
150150
};
151-
return s.replace(/[&<>'"]/g, (c) => attributeMap[c]);
151+
return s.replace(/["&'<>]/g, (c) => attributeMap[c]);
152152
}
153153

154154
/**

lib/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function getWordAtPosition(editor: TextEditor, position: Point): Range {
2424

2525
export function escapeRegExp(string: string): string {
2626
// From atom/underscore-plus.
27-
return string.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
27+
return string.replace(/[$()*+./?[\\\]^{|}-]/g, '\\$&');
2828
}
2929

3030
function _getRegexpRangeAtPosition(buffer: TextBuffer, position: Point, wordRegex: RegExp): Range | null {

0 commit comments

Comments
 (0)