Skip to content

Commit 843a4b3

Browse files
committed
simplify regex for detecting line endings
1 parent c88961d commit 843a4b3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rules/no-html.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { findOffsets } from "../util.js";
2626

2727
const htmlTagPattern =
2828
/<([a-z0-9]+(?:-[a-z0-9]+)*)(?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?>/giu;
29-
const nextLinesPattern = /[\r\n][\s\S]*$/u;
29+
const lineEndingPattern = /\r\n?|\n/u;
3030

3131
//-----------------------------------------------------------------------------
3232
// Rule Definition
@@ -89,7 +89,7 @@ export default {
8989
};
9090

9191
const firstNewlineIndex =
92-
fullMatch.search(nextLinesPattern);
92+
fullMatch.search(lineEndingPattern);
9393
const endColumn =
9494
firstNewlineIndex === -1
9595
? start.column + fullMatch.length

0 commit comments

Comments
 (0)