or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

config-generation.mddev-server-integration.mdextensibility.mdindex.mdmodule-configuration.md

module-configuration.mddocs/

0

# Module Configuration

1

2

Core module options and setup for integrating ESLint with Nuxt applications. The module is configured through the `eslint` key in `nuxt.config.ts`.

3

4

## Capabilities

5

6

### Module Options Interface

7

8

Main configuration interface for the @nuxt/eslint module.

9

10

```typescript { .api }

11

/**

12

* Main configuration interface for the @nuxt/eslint module

13

*/

14

interface ModuleOptions {

15

/**

16

* Options for ESLint flat config generation (.nuxt/eslint.config.mjs)

17

* Set to false to disable config generation

18

* Set to true to use default options

19

* Set to object to customize generation options

20

*/

21

config?: ConfigGenOptions | boolean;

22

23

/**

24

* Enable ESLint checker align with dev server or build process

25

* Not enabled by default

26

* Set to false to disable checker

27

* Set to true to use default checker options

28

* Set to object to customize checker options

29

*/

30

checker?: CheckerOptions | boolean;

31

}

32

```

33

34

### Default Configuration

35

36

The module comes with sensible defaults that work for most Nuxt projects.

37

38

```typescript { .api }

39

/**

40

* Default module options applied when not specified

41

*/

42

const defaults: ModuleOptions = {

43

config: true,

44

checker: false,

45

};

46

```

47

48

**Usage Examples:**

49

50

```typescript

51

// Basic usage with defaults

52

export default defineNuxtConfig({

53

modules: ['@nuxt/eslint']

54

})

55

56

// Enable both config generation and checker

57

export default defineNuxtConfig({

58

modules: ['@nuxt/eslint'],

59

eslint: {

60

config: true,

61

checker: true

62

}

63

})

64

65

// Disable config generation, enable checker only

66

export default defineNuxtConfig({

67

modules: ['@nuxt/eslint'],

68

eslint: {

69

config: false,

70

checker: {

71

lintOnStart: true,

72

emitError: true

73

}

74

}

75

})

76

77

// Custom configuration

78

export default defineNuxtConfig({

79

modules: ['@nuxt/eslint'],

80

eslint: {

81

config: {

82

configFile: 'custom/eslint.config.mjs',

83

autoInit: false

84

},

85

checker: {

86

include: ['src/**/*.ts'],

87

formatter: 'unix'

88

}

89

}

90

})

91

```

92

93

### Module Registration

94

95

The module is automatically registered with Nuxt's module system and provides configuration key registration.

96

97

```typescript { .api }

98

/**

99

* Module metadata for Nuxt registration

100

*/

101

interface ModuleMeta {

102

/** Module name for identification */

103

name: '@nuxt/eslint';

104

/** Configuration key in nuxt.config.ts */

105

configKey: 'eslint';

106

}

107

```

108

109

## Setup Process

110

111

The module setup process follows Nuxt's module lifecycle:

112

113

1. **Registration**: Module is registered with Nuxt module system

114

2. **Option Processing**: User configuration is merged with defaults

115

3. **Config Generation**: If enabled, ESLint config generation is set up

116

4. **Checker Integration**: If enabled, dev server integration is configured

117

5. **Hook Registration**: Custom hooks are registered for extensibility

118

119

The setup is conditional based on configuration:

120

- Config generation runs if `options.config` is truthy

121

- Checker integration only runs in development mode if `options.checker` is truthy

122

123

## Configuration Validation

124

125

The module performs basic validation on configuration options:

126

- Boolean values enable/disable features with default settings

127

- Object values allow detailed customization

128

- Invalid configurations will result in setup errors during Nuxt startup