Skip to content

Commit dfc788b

Browse files
committed
Lint
1 parent f96623f commit dfc788b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/git.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ const sanitizeFilePath = (filePath: string) =>
88
const diffCacheKey = (filePath: string, staged: boolean): string =>
99
JSON.stringify([path.resolve(filePath), staged]);
1010

11+
const diffCache = new Map<string, string>();
1112
const setCachedDiff = (filePath: string, staged: boolean, diff: string): void =>
1213
void diffCache.set(diffCacheKey(filePath, staged), diff);
1314

1415
const getCachedDiff = (filePath: string, staged: boolean) =>
1516
diffCache.get(diffCacheKey(filePath, staged));
1617

17-
const diffCache = new Map<string, string>();
1818
const getDiffForFile = (filePath: string, staged = false): string => {
1919
let diff = getCachedDiff(filePath, staged);
2020
if (diff === undefined) {
@@ -103,7 +103,7 @@ const hasCleanIndex = (filePath: string): boolean => {
103103
};
104104

105105
const isHunkHeader = (input: string) => {
106-
const hunkHeaderRE = new RegExp(/^@@ [^@]* @@/);
106+
const hunkHeaderRE = /^@@ [^@]* @@/u;
107107
return hunkHeaderRE.exec(input);
108108
};
109109

@@ -115,9 +115,8 @@ const getRangeForChangedLines = (line: string) => {
115115
* linesCountDelimiter: ',2',
116116
* linesCount: '2',
117117
*/
118-
const rangeRE = new RegExp(
119-
/^@@ .* \+(?<start>\d+)(?<linesCountDelimiter>,(?<linesCount>\d+))? @@/
120-
);
118+
const rangeRE =
119+
/^@@ .* \+(?<start>\d+)(?<linesCountDelimiter>,(?<linesCount>\d+))? @@/u;
121120
const range = rangeRE.exec(line);
122121
if (range === null) {
123122
throw Error(`Couldn't match regex with line '${line}'`);

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ const configs = { diff: diffConfig, staged: stagedConfig };
44
const processors = { diff, staged };
55

66
module.exports = { configs, processors };
7+
78
export { configs, processors };

0 commit comments

Comments
 (0)