mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 23:52:06 +00:00
chore(types): lint types (#8630)
This commit is contained in:
parent
2de9a6d3bc
commit
cff123cc9d
16
.eslintrc.js
16
.eslintrc.js
@ -72,5 +72,21 @@ module.exports = {
|
||||
rules: {
|
||||
'standard/no-callback-literal': 'off'
|
||||
}
|
||||
}, {
|
||||
files: ['**/*.ts'],
|
||||
env: { browser: true, es6: true, node: true },
|
||||
extends: [
|
||||
'@nuxtjs/eslint-config-typescript'
|
||||
],
|
||||
globals: { Atomics: 'readonly', SharedArrayBuffer: 'readonly' },
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
ecmaFeatures: { jsx: true },
|
||||
ecmaVersion: 2018,
|
||||
sourceType: 'module'
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/no-explicit-any': 0
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
"clean:test": "rimraf test/fixtures/*/dist test/fixtures/*/.nuxt*/",
|
||||
"dev": "jiti ./scripts/dev.js",
|
||||
"postinstall": "lerna link && yarn dev",
|
||||
"lint": "eslint --ext .js,.mjs,.vue .",
|
||||
"lint": "eslint --ext .js,.mjs,.vue,.ts .",
|
||||
"lint:app": "eslint-multiplexer eslint --ignore-path packages/vue-app/template/.eslintignore 'test/fixtures/!(missing-plugin)/.nuxt!(-dev)/**' | eslint-multiplexer -b",
|
||||
"ls-lint": "npx @ls-lint/ls-lint",
|
||||
"nuxt": "jiti ./packages/cli/bin/nuxt-cli.js",
|
||||
@ -37,11 +37,14 @@
|
||||
"@babel/preset-env": "^7.12.11",
|
||||
"@ls-lint/ls-lint": "^1.9.2",
|
||||
"@nuxtjs/eslint-config": "^5.0.0",
|
||||
"@nuxtjs/eslint-config-typescript": "^5.0.0",
|
||||
"@rollup/plugin-alias": "^3.1.1",
|
||||
"@rollup/plugin-commonjs": "^17.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^11.0.1",
|
||||
"@rollup/plugin-replace": "^2.3.4",
|
||||
"@typescript-eslint/eslint-plugin": "^4.13.0",
|
||||
"@typescript-eslint/parser": "^4.13.0",
|
||||
"@vue/server-test-utils": "^1.1.2",
|
||||
"@vue/test-utils": "^1.1.2",
|
||||
"babel-eslint": "^10.1.0",
|
||||
|
2
packages/config/index.d.ts
vendored
2
packages/config/index.d.ts
vendored
@ -1,3 +1,3 @@
|
||||
// Dummy type definition file to provide backward compatibility
|
||||
// around Nuxt modules extending `@nuxt/config` for Nuxt < 2.9
|
||||
declare module "@nuxt/config"
|
||||
declare module '@nuxt/config'
|
||||
|
23
packages/types/app/index.d.ts
vendored
23
packages/types/app/index.d.ts
vendored
@ -15,6 +15,16 @@ import './vuex'
|
||||
|
||||
type NuxtState = Record<string, any>
|
||||
|
||||
export interface NuxtAppOptions extends ComponentOptions<Vue> {
|
||||
[key: string]: any // TBD
|
||||
}
|
||||
|
||||
export interface NuxtError {
|
||||
message?: string
|
||||
path?: string
|
||||
statusCode?: number
|
||||
}
|
||||
|
||||
export interface Context {
|
||||
$config: NuxtRuntimeConfig
|
||||
|
||||
@ -79,6 +89,7 @@ export interface Context {
|
||||
beforeNuxtRender(fn: (params: { Components: VueRouter['getMatchedComponents'], nuxtState: NuxtState }) => void): void
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export type Middleware = string | ((ctx: Context, cb: Function) => Promise<void> | void)
|
||||
export type Inject = (key: string, value: any) => void
|
||||
export type Plugin = (ctx: Context, inject: Inject) => Promise<void> | void
|
||||
@ -96,21 +107,17 @@ export interface Transition {
|
||||
leaveToClass?: string
|
||||
leaveActiveClass?: string
|
||||
beforeEnter?(el: HTMLElement): void
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
enter?(el: HTMLElement, done: Function): void
|
||||
afterEnter?(el: HTMLElement): void
|
||||
enterCancelled?(el: HTMLElement): void
|
||||
beforeLeave?(el: HTMLElement): void
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
leave?(el: HTMLElement, done: Function): void
|
||||
afterLeave?(el: HTMLElement): void
|
||||
leaveCancelled?(el: HTMLElement): void
|
||||
}
|
||||
|
||||
export interface NuxtError {
|
||||
message?: string
|
||||
path?: string
|
||||
statusCode?: number
|
||||
}
|
||||
|
||||
export interface DefaultNuxtLoading extends Vue {
|
||||
canSucceed: boolean
|
||||
clear(): void
|
||||
@ -146,10 +153,6 @@ export interface CustomNuxtLoading extends Vue {
|
||||
|
||||
export type NuxtLoading = DefaultNuxtLoading | CustomNuxtLoading
|
||||
|
||||
export interface NuxtAppOptions extends ComponentOptions<Vue> {
|
||||
[key: string]: any // TBD
|
||||
}
|
||||
|
||||
export interface NuxtApp extends Vue {
|
||||
$options: NuxtAppOptions
|
||||
$loading: NuxtLoading
|
||||
|
4
packages/types/app/vue.d.ts
vendored
4
packages/types/app/vue.d.ts
vendored
@ -5,11 +5,13 @@
|
||||
import Vue from 'vue'
|
||||
import { MetaInfo } from 'vue-meta'
|
||||
import { Route } from 'vue-router'
|
||||
import { Context, Middleware, Transition, NuxtApp } from './index'
|
||||
import { NuxtRuntimeConfig } from '../config/runtime'
|
||||
import { Context, Middleware, Transition, NuxtApp } from './index'
|
||||
|
||||
declare module 'vue/types/options' {
|
||||
// eslint-disable-next-line no-unused-vars,@typescript-eslint/no-unused-vars
|
||||
interface ComponentOptions<V extends Vue> {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
asyncData?(ctx: Context): Promise<object | void> | object | void
|
||||
fetch?(ctx: Context): Promise<void> | void
|
||||
fetchKey?: string | ((getKey: (id: string) => number) => string)
|
||||
|
2
packages/types/app/vuex.d.ts
vendored
2
packages/types/app/vuex.d.ts
vendored
@ -1,8 +1,8 @@
|
||||
import Store from 'vuex'
|
||||
import VueRouter from 'vue-router'
|
||||
import { NuxtAppOptions } from '.'
|
||||
|
||||
declare module 'vuex/types/index' {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
interface Store<S> {
|
||||
app: NuxtAppOptions
|
||||
$router: VueRouter
|
||||
|
1
packages/types/config/build.d.ts
vendored
1
packages/types/config/build.d.ts
vendored
@ -90,6 +90,7 @@ interface NuxtBabelOptions extends Pick<TransformOptions, Exclude<keyof Transfor
|
||||
cacheDirectory?: boolean
|
||||
cacheIdentifier?: string
|
||||
customize?: string | null
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
presets?: ((env: NuxtBabelPresetEnv & NuxtWebpackEnv, defaultPreset: [string, object]) => PluginItem[] | void) | PluginItem[] | null
|
||||
plugins?: ((env: NuxtBabelPresetEnv & NuxtWebpackEnv) => NonNullable<TransformOptions['plugins']>) | TransformOptions['plugins']
|
||||
}
|
||||
|
1
packages/types/config/generate.d.ts
vendored
1
packages/types/config/generate.d.ts
vendored
@ -21,6 +21,7 @@ export interface NuxtOptionsGenerate {
|
||||
routes?: NuxtOptionsGenerateRoute[] | NuxtOptionsGenerateRoutesFunction | NuxtOptionsGenerateRoutesFunctionWithCallback
|
||||
subFolders?: boolean
|
||||
cache?: false | {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
ignore?: string[] | Function,
|
||||
globbyOptions?: GlobbyOptions
|
||||
}
|
||||
|
2
packages/types/config/index.d.ts
vendored
2
packages/types/config/index.d.ts
vendored
@ -73,4 +73,4 @@ export interface NuxtOptions extends Configuration {
|
||||
watchers: NuxtOptionsWatchers
|
||||
}
|
||||
|
||||
export interface NuxtConfig extends Partial<NuxtOptions> {}
|
||||
export type NuxtConfig = Partial<NuxtOptions>
|
||||
|
2
packages/types/config/render.d.ts
vendored
2
packages/types/config/render.d.ts
vendored
@ -50,7 +50,7 @@ export interface NuxtOptionsRender {
|
||||
bundleRenderer?: BundleRendererOptions
|
||||
compressor?: CompressionOptions | NuxtOptionsServerMiddleware | false
|
||||
csp?: boolean | CspOptions
|
||||
crossorigin?: "anonymous" | "use-credentials" | ""
|
||||
crossorigin?: 'anonymous' | 'use-credentials' | ''
|
||||
dist?: ServeStaticOptions
|
||||
etag?: NuxtEtagOptions | false
|
||||
fallback?: {
|
||||
|
@ -61,7 +61,9 @@ options.loading = true
|
||||
|
||||
const middlewares: Middleware[] = [
|
||||
'foo',
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
() => {},
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
async () => {}
|
||||
]
|
||||
|
||||
|
2
packages/vue-app/index.d.ts
vendored
2
packages/vue-app/index.d.ts
vendored
@ -1,3 +1,3 @@
|
||||
// Dummy type definition file to provide backward compatibility
|
||||
// around Nuxt modules extending `@nuxt/vue-app` for Nuxt < 2.9
|
||||
declare module "@nuxt/vue-app"
|
||||
declare module '@nuxt/vue-app'
|
||||
|
82
yarn.lock
82
yarn.lock
@ -1960,7 +1960,16 @@
|
||||
rc9 "^1.2.0"
|
||||
std-env "^2.2.1"
|
||||
|
||||
"@nuxtjs/eslint-config@^5.0.0":
|
||||
"@nuxtjs/eslint-config-typescript@^5.0.0":
|
||||
version "5.0.0"
|
||||
resolved "https://registry.npmjs.org/@nuxtjs/eslint-config-typescript/-/eslint-config-typescript-5.0.0.tgz#060c1402e559b1df78c8c19b2f5a873eac53cab2"
|
||||
integrity sha512-jw6h/WsdPc5i5l+a3DmEdpoAbFE4Tt7X6DBdXY7gfAsZ6bfzjoMzoHYaAmUk2tWkRDZmYvP6YANkbvi3X3pPAg==
|
||||
dependencies:
|
||||
"@nuxtjs/eslint-config" "5.0.0"
|
||||
"@typescript-eslint/eslint-plugin" "^4.7.0"
|
||||
"@typescript-eslint/parser" "^4.7.0"
|
||||
|
||||
"@nuxtjs/eslint-config@5.0.0", "@nuxtjs/eslint-config@^5.0.0":
|
||||
version "5.0.0"
|
||||
resolved "https://registry.npmjs.org/@nuxtjs/eslint-config/-/eslint-config-5.0.0.tgz#d66143ee4ada9d944de0bfbe2d7e4693a2e20d60"
|
||||
integrity sha512-xoi0CPpFj4hOTz5xMiqGK314276gOmI+8W+3tgybqsKiKQBFXe1IOUjHzsuGqkS44iGy+GmmrwA387ojvKnhkQ==
|
||||
@ -2605,6 +2614,32 @@
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@typescript-eslint/eslint-plugin@^4.13.0", "@typescript-eslint/eslint-plugin@^4.7.0":
|
||||
version "4.13.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.13.0.tgz#5f580ea520fa46442deb82c038460c3dd3524bb6"
|
||||
integrity sha512-ygqDUm+BUPvrr0jrXqoteMqmIaZ/bixYOc3A4BRwzEPTZPi6E+n44rzNZWaB0YvtukgP+aoj0i/fyx7FkM2p1w==
|
||||
dependencies:
|
||||
"@typescript-eslint/experimental-utils" "4.13.0"
|
||||
"@typescript-eslint/scope-manager" "4.13.0"
|
||||
debug "^4.1.1"
|
||||
functional-red-black-tree "^1.0.1"
|
||||
lodash "^4.17.15"
|
||||
regexpp "^3.0.0"
|
||||
semver "^7.3.2"
|
||||
tsutils "^3.17.1"
|
||||
|
||||
"@typescript-eslint/experimental-utils@4.13.0":
|
||||
version "4.13.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.13.0.tgz#9dc9ab375d65603b43d938a0786190a0c72be44e"
|
||||
integrity sha512-/ZsuWmqagOzNkx30VWYV3MNB/Re/CGv/7EzlqZo5RegBN8tMuPaBgNK6vPBCQA8tcYrbsrTdbx3ixMRRKEEGVw==
|
||||
dependencies:
|
||||
"@types/json-schema" "^7.0.3"
|
||||
"@typescript-eslint/scope-manager" "4.13.0"
|
||||
"@typescript-eslint/types" "4.13.0"
|
||||
"@typescript-eslint/typescript-estree" "4.13.0"
|
||||
eslint-scope "^5.0.0"
|
||||
eslint-utils "^2.0.0"
|
||||
|
||||
"@typescript-eslint/experimental-utils@^4.0.1":
|
||||
version "4.12.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.12.0.tgz#372838e76db76c9a56959217b768a19f7129546b"
|
||||
@ -2617,6 +2652,16 @@
|
||||
eslint-scope "^5.0.0"
|
||||
eslint-utils "^2.0.0"
|
||||
|
||||
"@typescript-eslint/parser@^4.13.0", "@typescript-eslint/parser@^4.7.0":
|
||||
version "4.13.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.13.0.tgz#c413d640ea66120cfcc37f891e8cb3fd1c9d247d"
|
||||
integrity sha512-KO0J5SRF08pMXzq9+abyHnaGQgUJZ3Z3ax+pmqz9vl81JxmTTOUfQmq7/4awVfq09b6C4owNlOgOwp61pYRBSg==
|
||||
dependencies:
|
||||
"@typescript-eslint/scope-manager" "4.13.0"
|
||||
"@typescript-eslint/types" "4.13.0"
|
||||
"@typescript-eslint/typescript-estree" "4.13.0"
|
||||
debug "^4.1.1"
|
||||
|
||||
"@typescript-eslint/scope-manager@4.12.0":
|
||||
version "4.12.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.12.0.tgz#beeb8beca895a07b10c593185a5612f1085ef279"
|
||||
@ -2625,11 +2670,24 @@
|
||||
"@typescript-eslint/types" "4.12.0"
|
||||
"@typescript-eslint/visitor-keys" "4.12.0"
|
||||
|
||||
"@typescript-eslint/scope-manager@4.13.0":
|
||||
version "4.13.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.13.0.tgz#5b45912a9aa26b29603d8fa28f5e09088b947141"
|
||||
integrity sha512-UpK7YLG2JlTp/9G4CHe7GxOwd93RBf3aHO5L+pfjIrhtBvZjHKbMhBXTIQNkbz7HZ9XOe++yKrXutYm5KmjWgQ==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "4.13.0"
|
||||
"@typescript-eslint/visitor-keys" "4.13.0"
|
||||
|
||||
"@typescript-eslint/types@4.12.0":
|
||||
version "4.12.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.12.0.tgz#fb891fe7ccc9ea8b2bbd2780e36da45d0dc055e5"
|
||||
integrity sha512-N2RhGeheVLGtyy+CxRmxdsniB7sMSCfsnbh8K/+RUIXYYq3Ub5+sukRCjVE80QerrUBvuEvs4fDhz5AW/pcL6g==
|
||||
|
||||
"@typescript-eslint/types@4.13.0":
|
||||
version "4.13.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.13.0.tgz#6a7c6015a59a08fbd70daa8c83dfff86250502f8"
|
||||
integrity sha512-/+aPaq163oX+ObOG00M0t9tKkOgdv9lq0IQv/y4SqGkAXmhFmCfgsELV7kOCTb2vVU5VOmVwXBXJTDr353C1rQ==
|
||||
|
||||
"@typescript-eslint/typescript-estree@4.12.0":
|
||||
version "4.12.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.12.0.tgz#3963418c850f564bdab3882ae23795d115d6d32e"
|
||||
@ -2644,6 +2702,20 @@
|
||||
semver "^7.3.2"
|
||||
tsutils "^3.17.1"
|
||||
|
||||
"@typescript-eslint/typescript-estree@4.13.0":
|
||||
version "4.13.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.13.0.tgz#cf6e2207c7d760f5dfd8d18051428fadfc37b45e"
|
||||
integrity sha512-9A0/DFZZLlGXn5XA349dWQFwPZxcyYyCFX5X88nWs2uachRDwGeyPz46oTsm9ZJE66EALvEns1lvBwa4d9QxMg==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "4.13.0"
|
||||
"@typescript-eslint/visitor-keys" "4.13.0"
|
||||
debug "^4.1.1"
|
||||
globby "^11.0.1"
|
||||
is-glob "^4.0.1"
|
||||
lodash "^4.17.15"
|
||||
semver "^7.3.2"
|
||||
tsutils "^3.17.1"
|
||||
|
||||
"@typescript-eslint/visitor-keys@4.12.0":
|
||||
version "4.12.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.12.0.tgz#a470a79be6958075fa91c725371a83baf428a67a"
|
||||
@ -2652,6 +2724,14 @@
|
||||
"@typescript-eslint/types" "4.12.0"
|
||||
eslint-visitor-keys "^2.0.0"
|
||||
|
||||
"@typescript-eslint/visitor-keys@4.13.0":
|
||||
version "4.13.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.13.0.tgz#9acb1772d3b3183182b6540d3734143dce9476fe"
|
||||
integrity sha512-6RoxWK05PAibukE7jElqAtNMq+RWZyqJ6Q/GdIxaiUj2Ept8jh8+FUVlbq9WxMYxkmEOPvCE5cRSyupMpwW31g==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "4.13.0"
|
||||
eslint-visitor-keys "^2.0.0"
|
||||
|
||||
"@vue/babel-helper-vue-jsx-merge-props@^1.2.1":
|
||||
version "1.2.1"
|
||||
resolved "https://registry.npmjs.org/@vue/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-1.2.1.tgz#31624a7a505fb14da1d58023725a4c5f270e6a81"
|
||||
|
Loading…
Reference in New Issue
Block a user