Skip to content

Commit

Permalink
Add eslint for TypeScript.
Browse files Browse the repository at this point in the history
  • Loading branch information
garg3133 committed Aug 9, 2023
1 parent 7231283 commit 771a4bf
Show file tree
Hide file tree
Showing 7 changed files with 526 additions and 35 deletions.
27 changes: 27 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,33 @@
"mocha": true,
"node": true
},
"overrides": [
{
"files": [
"**/*.ts"
],
"excludedFiles": [
"test/**/*.ts"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"ecmaFeatures": {
"jsx": false
},
"project": "./tsconfig.json"
}
}
],
"rules": {
"eqeqeq": [
"error",
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/addDetailedError.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NightwatchError } from "./types";
import {NightwatchError} from './types';

/**
* @method addDetailedError
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/browsername.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ class BrowserName {
get OPERA() {
return 'opera';
}
};
}

export = new BrowserName();
12 changes: 6 additions & 6 deletions lib/utils/createPromise.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Deferred } from "./types";
interface Deferred<T> {
promise: Promise<T>;
resolve: ((value: T | PromiseLike<T>) => void);
reject: ((reason?: unknown) => void);
}

export = function createPromise<T>(): Deferred<T> {
const deferred: Deferred<T> = {
resolve: null,
reject: null,
promise: null
};
const deferred = <Deferred<T>> {};

deferred.promise = new Promise((resolve, reject) => {
deferred.resolve = resolve;
Expand Down
12 changes: 3 additions & 9 deletions lib/utils/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
export interface NightwatchError extends Error {
detailedErr: string;
link: string;
help: string[];
}

export interface Deferred<T> {
promise: Promise<T> | null;
resolve: ((value: T | PromiseLike<T>) => void) | null;
reject: ((reason?: any) => void) | null;
detailedErr: string;
link: string;
help: string[];
}
Loading

0 comments on commit 771a4bf

Please sign in to comment.