8000 chore(schema): enable linting by DamianGlowala Β· Pull Request #22546 Β· nuxt/nuxt Β· GitHub
[go: up one dir, main page]

Skip to content

chore(schema): enable linting #22546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dist
node_modules
schema
packages/schema/schema
**/*.tmpl.*
sw.js
15 changes: 15 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@
"definedTags": ["__NO_SIDE_EFFECTS__"]
}]
},
"overrides": [
{
"files": ["packages/schema/**"],
"rules": {
"jsdoc/no-undefined-types": "off",
"jsdoc/valid-types": "off",
"jsdoc/check-tag-names": [
"error",
{
"definedTags": ["experimental"]
}
]
}
}
],
"settings": {
"jsdoc": {
"ignoreInternal": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/schema/src/config/adhoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default defineUntypedSchema({
/**
* An array of custom directories that will be auto-imported.
* Note that this option will not override the default directories (~/composables, ~/utils).
*
* @example
* ```js
* imports: {
Expand All @@ -57,9 +58,8 @@ export default defineUntypedSchema({
* Manually disable nuxt telemetry.
*
* @see [Nuxt Telemetry](https://github.com/nuxt/telemetry) for more information.
*
* @type {boolean | Record<string, any>}
*/
*/
telemetry: undefined,

/**
Expand Down
19 changes: 11 additions & 8 deletions packages/schema/src/config/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default defineUntypedSchema({
vue: {
/**
* Options for the Vue compiler that will be passed at build time.
*
* @see [documentation](https://vuejs.org/api/application.html#app-config-compileroptions)
* @type {typeof import('@vue/compiler-core').CompilerOptions}
*/
Expand All @@ -19,18 +20,20 @@ export default defineUntypedSchema({
* Include Vue compiler in runtime bundle.
*/
runtimeCompiler: {
$resolve: async (val, get) => val ?? await get('experimental.runtimeVueCompiler') ?? false,
$resolve: async (val, get) => val ?? await get('experimental.runtimeVueCompiler') ?? false
},

/**
* Vue Experimental: Enable reactive destructure for `defineProps`
*
* @see [Vue RFC#502](https://github.com/vuejs/rfcs/discussions/502)
* @type {boolean}
*/
propsDestructure: false,

/**
* Vue Experimental: Enable macro `defineModel`
*
* @see [Vue RFC#503](https://github.com/vuejs/rfcs/discussions/503)
* @type {boolean}
*/
Expand All @@ -45,24 +48,26 @@ export default defineUntypedSchema({
* The base path of your Nuxt application.
*
* This can be set at runtime by setting the NUXT_APP_BASE_URL environment variable.
*
* @example
* ```bash
* NUXT_APP_BASE_URL=/prefix/ node .output/server/index.mjs
* ```
*/
baseURL: {
$resolve: async (val) => val || process.env.NUXT_APP_BASE_URL || '/',
$resolve: val => val || process.env.NUXT_APP_BASE_URL || '/'
},

/** The folder name for the built site assets, relative to `baseURL` (or `cdnURL` if set). This is set at build time and should not be customized at runtime. */
buildAssetsDir: {
$resolve: async (val) => val || process.env.NUXT_APP_BUILD_ASSETS_DIR || '/_nuxt/',
$resolve: val => val || process.env.NUXT_APP_BUILD_ASSETS_DIR || '/_nuxt/'
},

/**
* An absolute URL to serve the public folder from (production-only).
*
* This can be set to a different value at runtime by setting the `NUXT_APP_CDN_URL` environment variable.
*
* @example
* ```bash
* NUXT_APP_CDN_URL=https://mycdn.org/ node .output/server/index.mjs
Expand Down Expand Up @@ -175,10 +180,11 @@ export default defineUntypedSchema({
* Customize Nuxt root element tag.
*
*/
rootTag: 'div',
rootTag: 'div'
},

/** A path to an HTML file, the contents of which will be inserted into any HTML page
/**
* A path to an HTML file, the contents of which will be inserted into any HTML page
* rendered with `ssr: false`.
*
* By default Nuxt will look in `~/app/spa-loading-template.html` for this file.
Expand Down Expand Up @@ -230,7 +236,6 @@ export default defineUntypedSchema({
* }
* </style>
* ```
*
* @type {string | false}
*/
spaLoadingTemplate: {
Expand All @@ -249,9 +254,7 @@ export default defineUntypedSchema({
* @note Plugins are also auto-registered from the `~/plugins` directory
* and these plugins do not need to be listed in `nuxt.config` unless you
* need to customize their order. All plugins are deduplicated by their src path.
*
* @see https://nuxt.com/docs/guide/directory-structure/plugins
*
* @example
* ```js
* plugins: [
Expand Down
32 changes: 17 additions & 15 deletions packages/schema/src/config/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default defineUntypedSchema({
}
const map: Record<string, string> = {
vite: '@nuxt/vite-builder',
webpack: '@nuxt/webpack-builder',
webpack: '@nuxt/webpack-builder'
}
return map[val] || val || (await get('vite') === false ? map.webpack : map.vite)
}
Expand All @@ -36,7 +36,7 @@ export default defineUntypedSchema({
server: true,
client: await get('dev')
})
},
}
},

/**
Expand Down Expand Up @@ -96,7 +96,6 @@ export default defineUntypedSchema({
* }
* ]
* ```
*
* @type {typeof import('../src/types/nuxt').NuxtTemplate<any>[]}
*/
templates: [],
Expand All @@ -113,7 +112,6 @@ export default defineUntypedSchema({
* }
* ```
* @type {boolean | typeof import('webpack-bundle-analyzer').BundleAnalyzerPlugin.Options | typeof import('rollup-plugin-visualizer').PluginVisualizerOptions}
*
*/
analyze: {
$resolve: async (val, get) => {
Expand All @@ -128,7 +126,7 @@ export default defineUntypedSchema({
filename: join(analyzeDir, '{name}.html')
}
}
},
}
},

/**
Expand All @@ -147,13 +145,13 @@ export default defineUntypedSchema({
* @type {Array<{ name: string, source?: string | RegExp, argumentLength: number }>}
*/
keyedComposables: {
$resolve: (val) => [
$resolve: val => [
{ name: 'defineNuxtComponent', argumentLength: 2 },
{ name: 'useState', argumentLength: 2 },
{ name: 'useFetch', argumentLength: 3 },
{ name: 'useAsyncData', argumentLength: 3 },
{ name: 'useLazyAsyncData', argumentLength: 3 },
{ name: 'useLazyFetch', argumentLength: 3 },
{ name: 'useLazyFetch', argumentLength: 3 }
].concat(val).filter(Boolean)
},

Expand All @@ -172,18 +170,22 @@ export default defineUntypedSchema({
composables: {
server: {
$resolve: async (val, get) => defu(val || {},
await get('dev') ? {} : {
vue: ['onBeforeMount', 'onMounted', 'onBeforeUpdate', 'onRenderTracked', 'onRenderTriggered', 'onActivated', 'onDeactivated', 'onBeforeUnmount'],
'#app': ['definePayloadReviver', 'definePageMeta']
}
await get('dev')
? {}
: {
vue: ['onBeforeMount', 'onMounted', 'onBeforeUpdate', 'onRenderTracked', 'onRenderTriggered', 'onActivated', 'onDeactivated', 'onBeforeUnmount'],
'#app': ['definePayloadReviver', 'definePageMeta']
}
)
},
client: {
$resolve: async (val, get) => defu(val || {},
await get('dev') ? {} : {
vue: ['onServerPrefetch', 'onRenderTracked', 'onRenderTriggered'],
'#app': ['definePayloadReducer', 'definePageMeta']
}
await get('dev')
? {}
: {
vue: ['onServerPrefetch', 'onRenderTracked', 'onRenderTriggered'],
'#app': ['definePayloadReducer', 'definePageMeta']
}
)
}
}
Expand Down
23 changes: 8 additions & 15 deletions packages/schema/src/config/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default defineUntypedSchema({
* You can use `github:`, `gitlab:`, `bitbucket:` or `https://` to extend from a remote git repository.
*
* @type {string|string[]}
*
*/
extends: null,

Expand All @@ -26,7 +25,6 @@ export default defineUntypedSchema({
* You can use `github:`, `gitlab:`, `bitbucket:` or `https://` to extend from a remote git repository.
*
* @type {string}
*
*/
theme: null,

Expand Down Expand Up @@ -170,15 +168,15 @@ export default defineUntypedSchema({
*
*/
debug: {
$resolve: async (val, get) => val ?? isDebug
$resolve: val => val ?? isDebug
},

/**
* Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time.
* If set to `false` generated pages will have no content.
*/
ssr: {
$resolve: (val) => val ?? true,
$resolve: val => val ?? true
},

/**
Expand All @@ -191,7 +189,6 @@ export default defineUntypedSchema({
* (in `node_modules`) and then will be resolved from project `srcDir` if `~` alias is used.
*
* @note Modules are executed sequentially so the order is important.
*
* @example
* ```js
* modules: [
Expand Down Expand Up @@ -252,12 +249,12 @@ export default defineUntypedSchema({
* and copied across into your `dist` folder when your app is generated.
*/
public: {
$resolve: async (val, get) => val || await get('dir.static') || 'public',
$resolve: async (val, get) => val || await get('dir.static') || 'public'
},

static: {
$schema: { deprecated: 'use `dir.public` option instead' },
$resolve: async (val, get) => val || await get('dir.public') || 'public',
$resolve: async (val, get) => val || await get('dir.public') || 'public'
}
},

Expand All @@ -274,11 +271,9 @@ export default defineUntypedSchema({
*
* @note Within a webpack context (image sources, CSS - but not JavaScript) you _must_ access
* your alias by prefixing it with `~`.
*
* @note These aliases will be automatically added to the generated `.nuxt/tsconfig.json` so you can get full
* type support and path auto-complete. In case you need to extend options provided by `./.nuxt/tsconfig.json`
* further, make sure to add them here or within the `typescript.tsConfig` property in `nuxt.config`.
*
* @example
* ```js
* export default {
Expand Down Expand Up @@ -309,7 +304,6 @@ export default defineUntypedSchema({
* }
* </style>
* ```
*
* @type {Record<string, string>}
*/
alias: {
Expand All @@ -328,7 +322,6 @@ export default defineUntypedSchema({
* Pass options directly to `node-ignore` (which is used by Nuxt to ignore files).
*
* @see [node-ignore](https://github.com/kaelzhang/node-ignore)
*
* @example
* ```js
* ignoreOptions: {
Expand All @@ -343,7 +336,7 @@ export default defineUntypedSchema({
* building if its filename starts with the prefix specified by `ignorePrefix`.
*/
ignorePrefix: {
$resolve: (val) => val ?? '-',
$resolve: val => val ?? '-'
},

/**
Expand Down Expand Up @@ -372,7 +365,7 @@ export default defineUntypedSchema({
* @type {Array<string | RegExp>}
*/
watch: {
$resolve: val => [].concat(val).filter((b: unknown) => typeof b === 'string' || b instanceof RegExp),
$resolve: val => [].concat(val).filter((b: unknown) => typeof b === 'string' || b instanceof RegExp)
},

/**
Expand All @@ -385,7 +378,7 @@ export default defineUntypedSchema({
* `watchOptions` to pass directly to webpack.
*
* @see [webpack@4 watch options](https://v4.webpack.js.org/configuration/watch/#watchoptions).
* */
*/
webpack: {
aggregateTimeout: 1000
},
Expand Down Expand Up @@ -464,7 +457,7 @@ export default defineUntypedSchema({
app: {
baseURL: (await get('app')).baseURL,
buildAssetsDir: (await get('app')).buildAssetsDir,
cdnURL: (await get('app')).cdnURL,
cdnURL: (await get('app')).cdnURL
}
})
}
Expand Down
5 changes: 1 addition & 4 deletions packages/schema/src/config/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ export default defineUntypedSchema({
* }
* })
* ```
*
*
* @type {boolean | { key: string; cert: string }}
*
*/
https: false,

Expand All @@ -43,6 +40,6 @@ export default defineUntypedSchema({
*
* @type {(data: { loading?: string }) => string}
*/
loadingTemplate: loadingTemplate
loadingTemplate
}
})
Loading
0