Skip to content

Commit 40391c5

Browse files
refactor: apply formatting and minor code improvements
Co-authored-by: Junie <junie@jetbrains.com>
1 parent 00eec53 commit 40391c5

59 files changed

Lines changed: 93 additions & 308 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/appsscript/net/requireValidToken.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ export function requireValidToken(
2020
throw new AuthenticationException("No token provided.");
2121
}
2222

23-
const cleanToken = token.startsWith("Bearer ")
24-
? token.replace("Bearer ", "")
25-
: token;
23+
const cleanToken = token.startsWith("Bearer ") ? token.replace("Bearer ", "") : token;
2624

2725
const keysToCompare: string[] = Array.isArray(allowedKeys)
2826
? (allowedKeys as string[])

src/appsscript/sheet/appendColumns.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { isConsistent2DArray } from "../../lang";
33
import { requireSheet } from "./requireSheet";
44

55
export interface Options {
6-
76
/**
87
* Determines whether to insert columns after frozen columns.
98
* If `true`, columns will be added immediately to the right of any frozen columns, if they exist.

src/appsscript/sheet/appendRows.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { isConsistent2DArray } from "../../lang";
33
import { requireSheet } from "./requireSheet";
44

55
export interface AppendRowsOptions {
6-
76
/**
87
* Determines whether to insert rows after frozen rows.
98
* If `true`, rows will be added immediately after the frozen rows, if they exist.

src/appsscript/sheet/convertRichTextToHtml.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,7 @@ export function convertRichTextToHtml(
117117
attributes["style"] = _toStringStyles(styles);
118118
}
119119

120-
const attrString =
121-
Object.keys(attributes).length > 0
122-
? " " + _toStringAttrs(attributes)
123-
: "";
120+
const attrString = Object.keys(attributes).length > 0 ? " " + _toStringAttrs(attributes) : "";
124121

125122
const joinedOpenTags = tags.join("><");
126123

src/appsscript/sheet/doGridRangesIntersect.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
IllegalArgumentException,
3-
InvalidGridRangeException
4-
} from "../../exception";
1+
import { IllegalArgumentException, InvalidGridRangeException } from "../../exception";
52
import { isObject } from "../../lang";
63
import { isValidSheetId } from "./isValidSheetId";
74
import { isValidSheetName } from "./isValidSheetName";
@@ -21,10 +18,7 @@ import type { GridRange } from "./types";
2118
* @version 1.1.0
2219
* @environment `Google Apps Script`, `Browser`
2320
*/
24-
export function doGridRangesIntersect(
25-
gridRange1: GridRange,
26-
gridRange2: GridRange
27-
): boolean {
21+
export function doGridRangesIntersect(gridRange1: GridRange, gridRange2: GridRange): boolean {
2822
if (arguments.length === 0) {
2923
throw new IllegalArgumentException();
3024
}
@@ -43,8 +37,7 @@ export function doGridRangesIntersect(
4337
: true;
4438

4539
const sheetNamesMatch =
46-
isValidSheetName(gridRange1.sheetName) &&
47-
isValidSheetName(gridRange2.sheetName)
40+
isValidSheetName(gridRange1.sheetName) && isValidSheetName(gridRange2.sheetName)
4841
? gridRange1.sheetName === gridRange2.sheetName
4942
: true;
5043

src/appsscript/sheet/extractSheetNameFromA1Notation.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ import { parseA1Notation } from "./parseA1Notation";
2525
* @author Maksym Stoianov <stoianov.maksym@gmail.com>
2626
* @license Apache-2.0
2727
*/
28-
export function extractSheetNameFromA1Notation(
29-
a1Notation: string
30-
): string | null {
28+
export function extractSheetNameFromA1Notation(a1Notation: string): string | null {
3129
if (arguments.length === 0) {
3230
throw new IllegalArgumentException();
3331
}

src/appsscript/sheet/highlightHtml.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,7 @@ export function highlightHtml(
207207

208208
const attrValueEndIndex = match.index + fullMatchText.length;
209209

210-
richTextBuilder.setTextStyle(
211-
match.index,
212-
attrValueEndIndex,
213-
textStyles.attrName
214-
);
210+
richTextBuilder.setTextStyle(match.index, attrValueEndIndex, textStyles.attrName);
215211

216212
const attrValueStartIndex = attrNameEndIndex + '="'.length;
217213

@@ -228,9 +224,7 @@ export function highlightHtml(
228224

229225
const richTextValues = range
230226
.getDisplayValues()
231-
.map(cells =>
232-
cells.map(cell => _convertHtmlTagsToRichText(cell, textStyles))
233-
);
227+
.map((cells) => cells.map((cell) => _convertHtmlTagsToRichText(cell, textStyles)));
234228

235229
if (range.getNumRows() === 1 && range.getNumColumns() === 1) {
236230
range.setRichTextValue(richTextValues[0][0]);

src/appsscript/sheet/isCellGridRange.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ export function isCellGridRange(gridRange: GridRange): boolean {
2020
throw new InvalidGridRangeException();
2121
}
2222

23-
const { startRowIndex, endRowIndex, startColumnIndex, endColumnIndex } =
24-
gridRange;
23+
const { startRowIndex, endRowIndex, startColumnIndex, endColumnIndex } = gridRange;
2524

2625
if (
2726
nonNil(startRowIndex) &&

src/appsscript/sheet/isGridRangeContainedIn.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,8 @@ export function isGridRangeContainedIn(
3838

3939
if (!sheetIdsMatch || !sheetNamesMatch) {
4040
if (
41-
(containerGridRange.sheetId != null &&
42-
gridRange.sheetId != null &&
43-
!sheetIdsMatch) ||
44-
(containerGridRange.sheetName != null &&
45-
gridRange.sheetName != null &&
46-
!sheetNamesMatch)
41+
(containerGridRange.sheetId != null && gridRange.sheetId != null && !sheetIdsMatch) ||
42+
(containerGridRange.sheetName != null && gridRange.sheetName != null && !sheetNamesMatch)
4743
) {
4844
return false;
4945
}

src/appsscript/sheet/isGridRangeSameDimensions.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,13 @@ import type { GridRange } from "./types";
1616
* @version 1.1.0
1717
* @environment `Google Apps Script`, `Browser`
1818
*/
19-
export function isGridRangeSameDimensions(
20-
range1: GridRange,
21-
range2: GridRange
22-
): boolean {
19+
export function isGridRangeSameDimensions(range1: GridRange, range2: GridRange): boolean {
2320
if (!isObject(range1) || !isObject(range2)) {
2421
throw new InvalidGridRangeException();
2522
}
2623

27-
const getDimensions = (
28-
gridRange: GridRange
29-
): { height: number; width: number } | null => {
30-
const { startRowIndex, endRowIndex, startColumnIndex, endColumnIndex } =
31-
gridRange;
24+
const getDimensions = (gridRange: GridRange): { height: number; width: number } | null => {
25+
const { startRowIndex, endRowIndex, startColumnIndex, endColumnIndex } = gridRange;
3226

3327
if (
3428
isNil(startRowIndex) ||
@@ -58,8 +52,5 @@ export function isGridRangeSameDimensions(
5852
return false;
5953
}
6054

61-
return (
62-
dimensions1.height === dimensions2.height &&
63-
dimensions1.width === dimensions2.width
64-
);
55+
return dimensions1.height === dimensions2.height && dimensions1.width === dimensions2.width;
6556
}

0 commit comments

Comments
 (0)