style: introduce @typescript-eslint/recommended

This commit is contained in:
harttle
2019-07-06 14:33:34 +08:00
parent e6f5f1cd85
commit 88c89fe3b3
48 changed files with 260 additions and 235 deletions
+7 -4
View File
@@ -2,17 +2,20 @@ import { isString, forOwn } from '../../src/util/underscore'
import fs from '../../src/fs/node'
import { resolve } from 'path'
type fileDescriptor = { mode: string, content: string }
interface FileDescriptor {
mode: string;
content: string;
}
let files: { [path: string]: fileDescriptor } = {}
let files: { [path: string]: FileDescriptor } = {}
const readFile = fs.readFile
const exists = fs.exists
export function mock (options: { [path: string]: (string | fileDescriptor) }) {
export function mock (options: { [path: string]: (string | FileDescriptor) }) {
forOwn(options, (val, key) => {
files[resolve(key)] = isString(val)
? { mode: '33188', content: val }
: val as fileDescriptor
: val as FileDescriptor
})
fs.readFile = async function (path) {
const file = files[path]