Skip to content

Commit 6c2bc47

Browse files
authored
fix: pass eslint (#530)
* fix: pass eslint There are two types of errors that should not be treated as errors, configure eslint in the comments to ignore them. 1. @typescript-eslint/require-await, the code does not use await in async, but we do want a Promise. 2. @typescript-eslint/explicit-module-boundary-types, there is no explicit return statement in the function, but we really don't care about its return value. In order for eslint to make sense, I didn't disable these rules in the file but to line. * fix: update code to pass eslint instead of using comment to disable lint rules
1 parent f8ae39e commit 6c2bc47

File tree

9 files changed

+13
-13
lines changed

9 files changed

+13
-13
lines changed

src/Low.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ function createJSONFile(obj: unknown): string {
1717
return file
1818
}
1919

20-
export async function testNoAdapter() {
20+
export function testNoAdapter(): void {
2121
// Ignoring TypeScript error and pass incorrect argument
2222
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
2323
// @ts-ignore
2424
throws(() => new Low(), MissingAdapterError)
2525
}
2626

27-
export async function testLow() {
27+
export async function testLow(): Promise<void> {
2828
type Data = {
2929
a?: number
3030
b?: number
@@ -52,7 +52,7 @@ export async function testLow() {
5252
deepEqual(JSON.parse(data), newObj)
5353
}
5454

55-
export async function testLodash() {
55+
export async function testLodash(): Promise<void> {
5656
// Extend with lodash
5757
class LowWithLodash<T> extends Low<T> {
5858
chain: lodash.ExpChain<this['data']> = lodash.chain(this).get('data')

src/LowSync.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ function createJSONFile(obj: unknown): string {
1212
return file
1313
}
1414

15-
export async function testNoAdapter() {
15+
export function testNoAdapter(): void {
1616
// Ignoring TypeScript error and pass incorrect argument
1717
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
1818
// @ts-ignore
1919
throws(() => new LowSync(), MissingAdapterError)
2020
}
2121

22-
export async function testLowSync() {
22+
export function testLowSync(): void {
2323
type Data = {
2424
a?: number
2525
b?: number

src/adapters/JSONFile.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import tempy from 'tempy'
33

44
import { JSONFile } from './JSONFile.js'
55

6-
export async function testJSONFile() {
6+
export async function testJSONFile(): Promise<void> {
77
const obj = { a: 1 }
88

99
const filename = tempy.file()

src/adapters/JSONFileSync.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import tempy from 'tempy'
33

44
import { JSONFileSync } from './JSONFileSync.js'
55

6-
export async function testJSONFileSync() {
6+
export function testJSONFileSync(): void {
77
const obj = { a: 1 }
88

99
const filename = tempy.file()

src/adapters/LocalStorage.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ global.localStorage = {
2121
},
2222
}
2323

24-
export async function testLocalStorage() {
24+
export function testLocalStorage(): void {
2525
const obj = { a: 1 }
2626
const storage = new LocalStorage('key')
2727

src/adapters/Memory.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { deepStrictEqual as deepEqual, strictEqual as equal } from 'assert'
22

33
import { Memory } from './Memory.js'
44

5-
export async function testMemory() {
5+
export async function testMemory(): Promise<void> {
66
const obj = { a: 1 }
77

88
const memory = new Memory()

src/adapters/MemorySync.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { deepStrictEqual as deepEqual, strictEqual as equal } from 'assert'
22

33
import { MemorySync } from './MemorySync.js'
44

5-
export function testMemorySync() {
5+
export function testMemorySync(): void {
66
const obj = { a: 1 }
77

88
const memory = new MemorySync()

src/adapters/TextFile.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import tempy from 'tempy'
33

44
import { TextFile } from './TextFile.js'
55

6-
export async function testTextFile() {
6+
export async function testTextFile(): Promise<void> {
77
const str = 'foo'
88

99
const filename = tempy.file()
@@ -19,7 +19,7 @@ export async function testTextFile() {
1919
deepEqual(await file.read(), str)
2020
}
2121

22-
export async function testRaceCondition() {
22+
export async function testRaceCondition(): Promise<void> {
2323
const filename = tempy.file()
2424
const file = new TextFile(filename)
2525
const promises: Promise<void>[] = []

src/adapters/TextFileSync.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import tempy from 'tempy'
33

44
import { TextFileSync } from './TextFileSync.js'
55

6-
export async function testTextFileSync() {
6+
export function testTextFileSync(): void {
77
const str = 'foo'
88

99
const filename = tempy.file()

0 commit comments

Comments
 (0)