chore: fix eslint/ts errors

This commit is contained in:
pooya parsa 2020-10-29 17:36:15 +01:00
parent d7f82cc6b0
commit 2e17133615
5 changed files with 17 additions and 26 deletions

View File

@ -72,14 +72,6 @@ interface UrlLoaderOptions {
mimetype?: string mimetype?: string
} }
interface WebpackEnv {
isClient: boolean
isDev: boolean
isLegacy: boolean
isModern: boolean
isServer: boolean
}
interface PostcssOrderPresetFunctions { interface PostcssOrderPresetFunctions {
cssnanoLast: (names: string[]) => string[] cssnanoLast: (names: string[]) => string[]
presetEnvAndCssnanoLast: (names: string[]) => string[] presetEnvAndCssnanoLast: (names: string[]) => string[]
@ -97,7 +89,7 @@ interface PostcssConfiguration {
order?: PostcssOrderPreset | string[] | ((names: string[], presets: PostcssOrderPresetFunctions) => string[]) order?: PostcssOrderPreset | string[] | ((names: string[], presets: PostcssOrderPresetFunctions) => string[])
plugins?: { plugins?: {
[key: string]: false | { [key: string]: any } [key: string]: false | { [key: string]: any }
} | ((loader: any) => PostcssPlugin<any>[]) | Array<[string | PostcssPlugin<any>, any] | string | PostcssPlugin<any>> } | ((loader: any) => PostcssPlugin[]) | Array<[string | PostcssPlugin, any] | string | PostcssPlugin>
preset?: { preset?: {
autoprefixer?: false | AutoprefixerOptions autoprefixer?: false | AutoprefixerOptions
browsers?: string browsers?: string
@ -106,19 +98,13 @@ interface PostcssConfiguration {
[key: string]: boolean | { [key: string]: any } [key: string]: boolean | { [key: string]: any }
} }
importFrom?: string | string[] | Partial<PostcssVariableMap> | (() => Partial<PostcssVariableMap>) importFrom?: string | string[] | Partial<PostcssVariableMap> | (() => Partial<PostcssVariableMap>)
insertAfter?: { [key: string]: PostcssPlugin<any> } insertAfter?: { [key: string]: PostcssPlugin }
insertBefore?: { [key: string]: PostcssPlugin<any> } insertBefore?: { [key: string]: PostcssPlugin }
preserve?: boolean preserve?: boolean
stage?: 0 | 1 | 2 | 3 | 4 | false stage?: 0 | 1 | 2 | 3 | 4 | false
} }
} }
interface VueStyleOptions {
manualInject?: boolean
ssrId?: boolean
shadowMode?: boolean
}
interface Loaders { interface Loaders {
css?: CssLoaderOptions css?: CssLoaderOptions
cssModules?: CssLoaderOptions cssModules?: CssLoaderOptions

View File

@ -23,7 +23,7 @@ interface RequireModuleOptions {
export default class Resolver { export default class Resolver {
_require: NodeJS.Require _require: NodeJS.Require
_resolve: RequireResolve _resolve: NodeJS.RequireResolve
nuxt: Nuxt nuxt: Nuxt
options: Nuxt['options'] options: Nuxt['options']

View File

@ -46,7 +46,7 @@ export default async function renderAndGetWindow (
if (options.virtualConsole) { if (options.virtualConsole) {
if (options.virtualConsole === undefined) { if (options.virtualConsole === undefined) {
options.virtualConsole = new jsdom.VirtualConsole().sendTo(consola as unknown as Console) options.virtualConsole = new jsdom.VirtualConsole().sendTo(consola as unknown as typeof console)
} }
// Throw error when window creation failed // Throw error when window creation failed
options.virtualConsole.on('jsdomError', jsdomErrHandler) options.virtualConsole.on('jsdomError', jsdomErrHandler)

View File

@ -17,10 +17,10 @@ export const ModernBrowsers = {
'Mobile Safari': '10.3' 'Mobile Safari': '10.3'
} as const } as const
type ModernBrowsers = { -readonly [key in keyof typeof ModernBrowsers]: SemVer } type ModernBrowsersT = { -readonly [key in keyof typeof ModernBrowsers]: SemVer }
let semver: typeof import('semver') let semver: typeof import('semver')
let __modernBrowsers: ModernBrowsers let __modernBrowsers: ModernBrowsersT
const getModernBrowsers = () => { const getModernBrowsers = () => {
if (__modernBrowsers) { if (__modernBrowsers) {
@ -35,7 +35,7 @@ const getModernBrowsers = () => {
if (version) { allBrowsers[browser] = version } if (version) { allBrowsers[browser] = version }
return allBrowsers return allBrowsers
}, },
{} as ModernBrowsers {} as ModernBrowsersT
) )
return __modernBrowsers return __modernBrowsers
} }

View File

@ -1,9 +1,14 @@
import serialize from 'serialize-javascript' import serialize from 'serialize-javascript'
export function normalizeFunctions (obj: Array<any>): Array<any> // eslint-disable-next-line no-redeclare
export function normalizeFunctions (obj: null): null export function normalizeFunctions(obj: Array<any>): Array<any>
export function normalizeFunctions (obj: Function): Function // eslint-disable-next-line no-redeclare
export function normalizeFunctions (obj: Record<string, any>): Record<string, any> export function normalizeFunctions(obj: null): null
// eslint-disable-next-line no-redeclare
export function normalizeFunctions(obj: Function): Function
// eslint-disable-next-line no-redeclare
export function normalizeFunctions(obj: Record<string, any>): Record<string, any>
// eslint-disable-next-line no-redeclare
export function normalizeFunctions (obj: Array<unknown> | null | Function | Record<string, any>) { export function normalizeFunctions (obj: Array<unknown> | null | Function | Record<string, any>) {
if (typeof obj !== 'object' || Array.isArray(obj) || obj === null) { if (typeof obj !== 'object' || Array.isArray(obj) || obj === null) {
return obj return obj