Skip to content

Commit 783818e

Browse files
committed
Lint fixes
1 parent 482d418 commit 783818e

File tree

3 files changed

+32
-37
lines changed

3 files changed

+32
-37
lines changed

packages/gen-mapping/src/gen-mapping.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ function getRangeIndex(ranges: MappingIndex[], index: MappingIndex): number {
469469
for (let i = ranges.length; i > 0; i--) {
470470
const range = ranges[i - 1];
471471
if (range === index) return i - 1;
472-
if (range < index) return ~i
472+
if (range < index) return ~i;
473473
}
474474
return ~0;
475475
}
@@ -486,7 +486,6 @@ function adjustRangeMappings(rangeMappings: MappingIndex[][], genLine: number, i
486486
}
487487
}
488488

489-
490489
/**
491490
* Returns true if we should skip adding a sourceless segment at the given index.
492491
*

packages/trace-mapping/src/flatten-map.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import type { SourceMapSegment } from './sourcemap-segment';
2424

2525
// A utility type that allows FlattenMap to be called or new'd.
2626
type FlattenMap = {
27-
new(map: Ro<SectionedSourceMapInput>, mapUrl?: string | null): TraceMap;
27+
new (map: Ro<SectionedSourceMapInput>, mapUrl?: string | null): TraceMap;
2828
(map: Ro<SectionedSourceMapInput>, mapUrl?: string | null): TraceMap;
2929
};
3030

packages/trace-mapping/test/trace-mapping.test.ts

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -894,37 +894,37 @@ describe('TraceMap', () => {
894894
});
895895

896896
// Inside range
897-
assert.deepEqual(
898-
generatedPositionFor(tracer, { source: 'input.js', line: 1, column: 0 }),
899-
{ line: 1, column: 0 }
900-
);
901-
assert.deepEqual(
902-
generatedPositionFor(tracer, { source: 'input.js', line: 1, column: 1 }),
903-
{ line: 1, column: 1 }
904-
);
905-
assert.deepEqual(
906-
generatedPositionFor(tracer, { source: 'input.js', line: 2, column: 0 }),
907-
{ line: 2, column: 0 }
908-
);
909-
assert.deepEqual(
910-
generatedPositionFor(tracer, { source: 'input.js', line: 2, column: 1 }),
911-
{ line: 2, column: 1 }
912-
);
897+
assert.deepEqual(generatedPositionFor(tracer, { source: 'input.js', line: 1, column: 0 }), {
898+
line: 1,
899+
column: 0,
900+
});
901+
assert.deepEqual(generatedPositionFor(tracer, { source: 'input.js', line: 1, column: 1 }), {
902+
line: 1,
903+
column: 1,
904+
});
905+
assert.deepEqual(generatedPositionFor(tracer, { source: 'input.js', line: 2, column: 0 }), {
906+
line: 2,
907+
column: 0,
908+
});
909+
assert.deepEqual(generatedPositionFor(tracer, { source: 'input.js', line: 2, column: 1 }), {
910+
line: 2,
911+
column: 1,
912+
});
913913

914914
// Outside range limit [0, 2)
915-
assert.deepEqual(
916-
generatedPositionFor(tracer, { source: 'input.js', line: 2, column: 2 }),
917-
{ column: null, line: null }
918-
);
919-
assert.deepEqual(
920-
generatedPositionFor(tracer, { source: 'input.js', line: 3, column: 1 }),
921-
{ column: null, line: null }
922-
);
915+
assert.deepEqual(generatedPositionFor(tracer, { source: 'input.js', line: 2, column: 2 }), {
916+
column: null,
917+
line: null,
918+
});
919+
assert.deepEqual(generatedPositionFor(tracer, { source: 'input.js', line: 3, column: 1 }), {
920+
column: null,
921+
line: null,
922+
});
923923

924924
// Second segment
925925
assert.deepEqual(
926926
generatedPositionFor(tracer, { source: 'input.js', line: 16, column: 16 }),
927-
{ column: 2, line: 2 }
927+
{ column: 2, line: 2 },
928928
);
929929
});
930930

@@ -951,7 +951,7 @@ describe('TraceMap', () => {
951951
rangeMappings: [
952952
[0], // Line 0: Segment 0 is a range mapping
953953
[0], // Line 1: Segment 0 is a range mapping
954-
[], // Line 2: No range mappings
954+
[], // Line 2: No range mappings
955955
],
956956
});
957957

@@ -963,7 +963,7 @@ describe('TraceMap', () => {
963963
{ line: 1, column: 0 },
964964
{ line: 2, column: 0 },
965965
{ line: 3, column: 0 },
966-
]
966+
],
967967
);
968968

969969
// Test querying an offset inside RANGE 1 and RANGE 2 (Src Line 0, Col 2 -> line: 1, column: 2).
@@ -975,7 +975,7 @@ describe('TraceMap', () => {
975975
[
976976
{ line: 1, column: 2 },
977977
{ line: 2, column: 2 },
978-
]
978+
],
979979
);
980980

981981
// Test querying an offset past RANGE 1 but inside RANGE 2 (Src Line 0, Col 10 -> line: 1, column: 10).
@@ -984,18 +984,14 @@ describe('TraceMap', () => {
984984
// NORMAL: Does not offset.
985985
assert.deepEqual(
986986
allGeneratedPositionsFor(tracer, { source: 'input.js', line: 1, column: 10 }),
987-
[
988-
{ line: 2, column: 10 },
989-
]
987+
[{ line: 2, column: 10 }],
990988
);
991989

992990
// Test querying the normal segment that ends RANGE 1 (Src Line 10, Col 10 -> line: 11, column: 10).
993991
// NORMAL at Gen Line 0, Col 5.
994992
assert.deepEqual(
995993
allGeneratedPositionsFor(tracer, { source: 'input.js', line: 11, column: 10 }),
996-
[
997-
{ line: 1, column: 5 },
998-
]
994+
[{ line: 1, column: 5 }],
999995
);
1000996
});
1001997
});

0 commit comments

Comments
 (0)