or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

configuration.mdindex.mdlegacy-api.mdpresets.mdproject-config.md

legacy-api.mddocs/

0

# Legacy API

1

2

Deprecated functions provided for backward compatibility with versions ≤14.2.0. These functions are maintained for existing projects but should not be used in new projects.

3

4

## Capabilities

5

6

### createConfig Function (Deprecated)

7

8

Legacy configuration function that creates ESLint configs with simplified options.

9

10

```typescript { .api }

11

import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';

12

13

/**

14

* @deprecated Use `defineConfigWithVueTs` + `vueTsConfigs` instead

15

* Creates ESLint configuration with legacy options format

16

* @param options - Configuration options with extends and script language support

17

* @returns ESLint flat configuration array

18

*/

19

export default function createConfig(options?: ConfigOptions): FlatConfig.ConfigArray;

20

21

type ConfigOptions = ProjectOptions & {

22

/** Array of config names to extend from typescript-eslint. Defaults to `['recommended']` */

23

extends?: ExtendableConfigName[];

24

/**

25

* @deprecated Use ProjectOptions.scriptLangs instead

26

* Record of script languages with boolean flags

27

*/

28

supportedScriptLangs?: Record<ScriptLang, boolean>;

29

};

30

31

interface ProjectOptions {

32

tsSyntaxInTemplates?: boolean;

33

scriptLangs?: ScriptLang[];

34

allowComponentTypeUnsafety?: boolean;

35

rootDir?: string;

36

}

37

38

type ScriptLang = "ts" | "tsx" | "js" | "jsx";

39

type ExtendableConfigName =

40

| "all" | "base" | "disableTypeChecked" | "eslintRecommended"

41

| "recommended" | "recommendedTypeChecked" | "recommendedTypeCheckedOnly"

42

| "strict" | "strictTypeChecked" | "strictTypeCheckedOnly"

43

| "stylistic" | "stylisticTypeChecked" | "stylisticTypeCheckedOnly";

44

```

45

46

**Usage Examples (Legacy):**

47

48

```typescript

49

// Legacy import style

50

import createConfig from "@vue/eslint-config-typescript";

51

52

// Basic configuration

53

export default createConfig();

54

55

// Configuration with extends

56

export default createConfig({

57

extends: ["recommended", "stylistic"],

58

});

59

60

// Configuration with script language support

61

export default createConfig({

62

extends: ["strictTypeChecked"],

63

supportedScriptLangs: {

64

ts: true,

65

tsx: false,

66

js: false,

67

jsx: false,

68

},

69

rootDir: process.cwd(),

70

});

71

```

72

73

**Migration to Modern API:**

74

75

```typescript

76

// OLD (deprecated)

77

import createConfig from "@vue/eslint-config-typescript";

78

79

export default createConfig({

80

extends: ["recommended", "stylistic"],

81

supportedScriptLangs: { ts: true, js: false, tsx: false, jsx: false },

82

});

83

84

// NEW (recommended)

85

import {

86

defineConfigWithVueTs,

87

vueTsConfigs,

88

configureVueProject

89

} from "@vue/eslint-config-typescript";

90

91

configureVueProject({

92

scriptLangs: ["ts"],

93

});

94

95

export default defineConfigWithVueTs(

96

vueTsConfigs.recommended,

97

vueTsConfigs.stylistic,

98

);

99

```

100

101

### defineConfig Function (Deprecated)

102

103

Deprecated alias for `defineConfigWithVueTs` function.

104

105

```typescript { .api }

106

/**

107

* @deprecated `defineConfig` is renamed to `defineConfigWithVueTs` in 14.3.0

108

* Alias for defineConfigWithVueTs function

109

*/

110

export const defineConfig: typeof defineConfigWithVueTs;

111

```

112

113

**Usage Examples (Legacy):**

114

115

```typescript

116

// OLD (deprecated)

117

import { defineConfig, vueTsConfigs } from "@vue/eslint-config-typescript";

118

119

export default defineConfig(vueTsConfigs.recommended);

120

121

// NEW (recommended)

122

import { defineConfigWithVueTs, vueTsConfigs } from "@vue/eslint-config-typescript";

123

124

export default defineConfigWithVueTs(vueTsConfigs.recommended);

125

```

126

127

### Legacy Configuration Behavior

128

129

#### Automatic Migration

130

131

The `createConfig` function automatically:

132

133

1. Converts `supportedScriptLangs` object to `scriptLangs` array

134

2. Calls `configureVueProject` internally with converted options

135

3. Maps `extends` array to corresponding `vueTsConfigs` entries

136

4. Returns result from `defineConfigWithVueTs`

137

138

#### Error Handling

139

140

Provides enhanced error messages for common migration issues:

141

142

```typescript

143

// Invalid config name detection

144

createConfig({ extends: ["recommended-type-checked"] });

145

// Error: The config name "recommended-type-checked" is not supported in "extends".

146

// Please use "recommendedTypeChecked" instead.

147

148

// Unknown config detection

149

createConfig({ extends: ["unknown-config"] });

150

// Error: Unknown config name in "extends": unknown-config.

151

```

152

153

#### Default Values

154

155

```typescript

156

// Default configuration when no options provided

157

const defaultOptions = {

158

extends: ["recommended"],

159

supportedScriptLangs: {

160

ts: true,

161

tsx: false,

162

js: false,

163

jsx: false

164

},

165

rootDir: process.cwd(),

166

};

167

```

168

169

### Migration Guide

170

171

#### Step 1: Update Imports

172

173

```typescript

174

// Before

175

import createConfig from "@vue/eslint-config-typescript";

176

import { defineConfig } from "@vue/eslint-config-typescript";

177

178

// After

179

import {

180

defineConfigWithVueTs,

181

vueTsConfigs,

182

configureVueProject,

183

} from "@vue/eslint-config-typescript";

184

```

185

186

#### Step 2: Replace Function Calls

187

188

```typescript

189

// Before - createConfig

190

export default createConfig({

191

extends: ["strict"],

192

supportedScriptLangs: { ts: true, js: true, tsx: false, jsx: false },

193

});

194

195

// After - modern API

196

configureVueProject({

197

scriptLangs: ["ts", "js"],

198

});

199

200

export default defineConfigWithVueTs(vueTsConfigs.strict);

201

```

202

203

#### Step 3: Handle Complex Configurations

204

205

```typescript

206

// Before - mixed legacy/modern patterns

207

export default createConfig({

208

extends: ["recommendedTypeChecked"],

209

// Custom rules were difficult to add

210

});

211

212

// After - full flexibility

213

configureVueProject({

214

scriptLangs: ["ts"],

215

tsSyntaxInTemplates: true,

216

});

217

218

export default defineConfigWithVueTs(

219

vueTsConfigs.recommendedTypeChecked,

220

{

221

name: "custom-overrides",

222

files: ["**/*.vue"],

223

rules: {

224

// Easy to add custom rules

225

"vue/multi-word-component-names": "off",

226

},

227

},

228

);

229

```

230

231

### Deprecation Timeline

232

233

- **14.2.0 and earlier**: `createConfig` was the primary API

234

- **14.3.0**: `defineConfig` renamed to `defineConfigWithVueTs`, `defineConfig` marked deprecated

235

- **15.0.0**: `createConfig` will be removed, `defineConfig` alias will be removed

236

237

**Recommendation**: Migrate to the modern API (`defineConfigWithVueTs` + `vueTsConfigs` + `configureVueProject`) for better flexibility and future compatibility.