Generate ESLint config from current Nuxt settings
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Core module options and setup for integrating ESLint with Nuxt applications. The module is configured through the eslint key in nuxt.config.ts.
Main configuration interface for the @nuxt/eslint module.
/**
* Main configuration interface for the @nuxt/eslint module
*/
interface ModuleOptions {
/**
* Options for ESLint flat config generation (.nuxt/eslint.config.mjs)
* Set to false to disable config generation
* Set to true to use default options
* Set to object to customize generation options
*/
config?: ConfigGenOptions | boolean;
/**
* Enable ESLint checker align with dev server or build process
* Not enabled by default
* Set to false to disable checker
* Set to true to use default checker options
* Set to object to customize checker options
*/
checker?: CheckerOptions | boolean;
}The module comes with sensible defaults that work for most Nuxt projects.
/**
* Default module options applied when not specified
*/
const defaults: ModuleOptions = {
config: true,
checker: false,
};Usage Examples:
// Basic usage with defaults
export default defineNuxtConfig({
modules: ['@nuxt/eslint']
})
// Enable both config generation and checker
export default defineNuxtConfig({
modules: ['@nuxt/eslint'],
eslint: {
config: true,
checker: true
}
})
// Disable config generation, enable checker only
export default defineNuxtConfig({
modules: ['@nuxt/eslint'],
eslint: {
config: false,
checker: {
lintOnStart: true,
emitError: true
}
}
})
// Custom configuration
export default defineNuxtConfig({
modules: ['@nuxt/eslint'],
eslint: {
config: {
configFile: 'custom/eslint.config.mjs',
autoInit: false
},
checker: {
include: ['src/**/*.ts'],
formatter: 'unix'
}
}
})The module is automatically registered with Nuxt's module system and provides configuration key registration.
/**
* Module metadata for Nuxt registration
*/
interface ModuleMeta {
/** Module name for identification */
name: '@nuxt/eslint';
/** Configuration key in nuxt.config.ts */
configKey: 'eslint';
}The module setup process follows Nuxt's module lifecycle:
The setup is conditional based on configuration:
options.config is truthyoptions.checker is truthyThe module performs basic validation on configuration options:
Install with Tessl CLI
npx tessl i tessl/npm-nuxt--eslint