Skip to content

Commit

Permalink
refactor: eslint more strict
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed Oct 12, 2021
1 parent 2fa2557 commit 0605ad8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 24 deletions.
23 changes: 5 additions & 18 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"root": true,
"env": { "browser": true, "node": true },
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"ignorePatterns": ["tests"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"root": true,
"env": {
"browser": true,
"amd": true,
"node": true
},
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
]
"@typescript-eslint/no-explicit-any": "off"
}
}
2 changes: 1 addition & 1 deletion src/interceptors/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class CacheRequestInterceptor implements AxiosInterceptor<CacheRequestCon
* Add a default reject handler to catch when the request is
* aborted without others waiting for it.
*/
this.axios.waiting[key]?.catch(() => {});
this.axios.waiting[key]?.catch(() => undefined);

await this.axios.storage.set(key, {
state: 'loading',
Expand Down
8 changes: 4 additions & 4 deletions src/util/deferred.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ export interface Deferred<T, E> extends Promise<T> {
* @returns The deferred promise
*/
export function deferred<T, E>(): Deferred<T, E> {
let reject: Deferred<T, E>['reject'] = () => {};
let resolve: Deferred<T, E>['resolve'] = () => {};
let reject: Deferred<T, E>['reject'] = () => undefined;
let resolve: Deferred<T, E>['resolve'] = () => undefined;

const promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
}) as Deferred<T, E>;

promise.resolve = resolve;
promise.reject = reject;
promise.resolve = (...args) => resolve(...args);
promise.reject = (...args) => reject(...args);

return promise;
}
2 changes: 1 addition & 1 deletion test/storage/storages.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CacheStorage } from '../../src/storage/types';

export function testStorage(name: string, Storage: () => CacheStorage) {
export function testStorage(name: string, Storage: () => CacheStorage): void {
it(`tests ${name} storage methods`, async () => {
const storage = Storage();

Expand Down

0 comments on commit 0605ad8

Please sign in to comment.