Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,27 @@
"prefer-arrow-callback": 2,
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/ban-types": 1,
"@typescript-eslint/no-empty-function": 1
},
"@typescript-eslint/no-empty-function": 1,
// disable the rule for all files
"@typescript-eslint/explicit-member-accessibility": "off"
},
"overrides": [
{
// enable the rule specifically for TypeScript files
"files": ["*.ts", "*.tsx"],
"rules": {
"@typescript-eslint/explicit-member-accessibility": [
"error", {
"accessibility": "explicit",
"overrides": {
"accessors": "explicit",
"constructors": "no-public",
"methods": "explicit",
"properties": "explicit",
"parameterProperties": "explicit"
}}]
}
}],
"env": {
"browser": true,
"node": true,
Expand Down
4 changes: 3 additions & 1 deletion e2e/selenium.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/* eslint @typescript-eslint/ban-ts-ignore: 0 */
import path from "path";
import webdriver from "selenium-webdriver";

Expand Down Expand Up @@ -54,8 +54,10 @@ it("loader should load map and getCenter", async () => {

await expect(
driver.executeAsyncScript((apiKey: string) => {
/* eslint-disable no-undef */
// @ts-ignore-next-line
const callback = arguments[arguments.length - 1];
/* eslint-enable no-undef */

// @ts-ignore-next-line
const { expect } = window.jestLite.core;
Expand Down
2 changes: 1 addition & 1 deletion src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/* eslint @typescript-eslint/no-explicit-any: 0 */
import { DEFAULT_ID, Loader, LoaderOptions } from ".";

jest.useFakeTimers();
Expand Down
36 changes: 18 additions & 18 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,56 +188,56 @@ export class Loader {
/**
* See [[LoaderOptions.version]]
*/
version: string;
public readonly version: string;
/**
* See [[LoaderOptions.apiKey]]
*/
apiKey: string;
public readonly apiKey: string;
/**
* See [[LoaderOptions.channel]]
*/
channel: string;
public readonly channel: string;
/**
* See [[LoaderOptions.client]]
*/
client: string;
public readonly client: string;
/**
* See [[LoaderOptions.id]]
*/
id: string;
public readonly id: string;
/**
* See [[LoaderOptions.libraries]]
*/
libraries: Libraries;
public readonly libraries: Libraries;
/**
* See [[LoaderOptions.language]]
*/
language: string;
public readonly language: string;

/**
* See [[LoaderOptions.region]]
*/
region: string;
public readonly region: string;

/**
* See [[LoaderOptions.mapIds]]
*/
mapIds: string[];
public readonly mapIds: string[];

/**
* See [[LoaderOptions.nonce]]
*/
nonce: string | null;
public readonly nonce: string | null;

/**
* See [[LoaderOptions.retries]]
*/
retries: number;
public readonly retries: number;

/**
* See [[LoaderOptions.url]]
*/
url: string;
public readonly url: string;

private CALLBACK = "__googleMapsCallback";
private callbacks: ((e: ErrorEvent) => void)[] = [];
Expand Down Expand Up @@ -298,7 +298,7 @@ export class Loader {
Loader.instance = this;
}

get options(): LoaderOptions {
public get options(): LoaderOptions {
return {
version: this.version,
apiKey: this.apiKey,
Expand All @@ -323,7 +323,7 @@ export class Loader {
*
* @ignore
*/
createUrl(): string {
public createUrl(): string {
let url = this.url;

url += `?callback=${this.CALLBACK}`;
Expand Down Expand Up @@ -366,7 +366,7 @@ export class Loader {
/**
* Load the Google Maps JavaScript API script and return a Promise.
*/
load(): Promise<typeof google> {
public load(): Promise<typeof google> {
return this.loadPromise();
}

Expand All @@ -375,7 +375,7 @@ export class Loader {
*
* @ignore
*/
loadPromise(): Promise<typeof google> {
public loadPromise(): Promise<typeof google> {
return new Promise((resolve, reject) => {
this.loadCallback((err: ErrorEvent) => {
if (!err) {
Expand All @@ -390,7 +390,7 @@ export class Loader {
/**
* Load the Google Maps JavaScript API script with a callback.
*/
loadCallback(fn: (e: ErrorEvent) => void): void {
public loadCallback(fn: (e: ErrorEvent) => void): void {
this.callbacks.push(fn);
this.execute();
}
Expand Down Expand Up @@ -421,7 +421,7 @@ export class Loader {
document.head.appendChild(script);
}

deleteScript(): void {
public deleteScript(): void {
const script = document.getElementById(this.id);
if (script) {
script.remove();
Expand Down