We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4974093 commit c0019fbCopy full SHA for c0019fb
packages/eslint-mdx/src/helpers.ts
@@ -100,9 +100,12 @@ export const hasProperties = <T, P extends keyof T = keyof T>(
100
export const getPositionAt = (code: string, offset: number): ESPosition => {
101
let currOffset = 0
102
103
- for (const [index, { length }] of code.split('\n').entries()) {
+ const lines = code.split('\n')
104
+
105
+ // eslint-disable-next-line unicorn/no-for-loop
106
+ for (let index = 0; index < lines.length; index++) {
107
const line = index + 1
- const nextOffset = currOffset + length
108
+ const nextOffset = currOffset + lines[index].length
109
110
if (nextOffset >= offset) {
111
return {
0 commit comments