or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

best-practices-rules.mdcode-quality-rules.mdindex.mdplugin-configuration.mdstyle-formatting-rules.mdtype-safety-rules.md

plugin-configuration.mddocs/

0

# Plugin Configuration

1

2

Core plugin setup and configuration presets for different TypeScript ESLint project requirements. Provides both legacy ESLint RC and modern flat configuration formats.

3

4

## Capabilities

5

6

### Main Plugin Export

7

8

The default export providing the ESLint plugin with all rules and configurations.

9

10

```typescript { .api }

11

/**

12

* Main ESLint plugin export with rules, configurations, and metadata

13

*/

14

interface PluginExport {

15

/** Legacy ESLint RC configuration presets */

16

configs: Record<string, ClassicConfig.Config>;

17

/** Plugin metadata including name and version */

18

meta: FlatConfig.PluginMeta;

19

/** All available TypeScript ESLint rules */

20

rules: TypeScriptESLintRules;

21

}

22

```

23

24

**Usage Example:**

25

26

```typescript

27

import plugin from "@typescript-eslint/eslint-plugin";

28

29

// Access configurations

30

const recommendedConfig = plugin.configs.recommended;

31

32

// Access individual rules

33

const noUnusedVarsRule = plugin.rules["no-unused-vars"];

34

35

// Plugin metadata

36

console.log(plugin.meta.name); // "@typescript-eslint/eslint-plugin"

37

console.log(plugin.meta.version); // "8.42.0"

38

```

39

40

### Raw Plugin Export

41

42

Extended plugin export with flat configurations and parser integration.

43

44

```typescript { .api }

45

/**

46

* Extended plugin export with flat configs and parser

47

*/

48

interface RawPluginExport {

49

/** Flat configuration presets for ESLint 9+ */

50

flatConfigs: Record<string, FlatConfig.Config | FlatConfig.ConfigArray>;

51

/** TypeScript ESLint parser instance */

52

parser: FlatConfig.Parser;

53

/** Main plugin export */

54

plugin: PluginExport;

55

}

56

```

57

58

**Usage Example:**

59

60

```typescript

61

import { plugin, parser, flatConfigs } from "@typescript-eslint/eslint-plugin/use-at-your-own-risk/raw-plugin";

62

63

// Use flat configuration

64

export default [

65

...flatConfigs["flat/recommended"],

66

{

67

languageOptions: {

68

parser: parser,

69

parserOptions: {

70

project: "./tsconfig.json"

71

}

72

},

73

plugins: {

74

"@typescript-eslint": plugin

75

}

76

}

77

];

78

```

79

80

### Legacy Configuration Presets

81

82

Pre-configured rule sets for legacy ESLint RC format.

83

84

```typescript { .api }

85

interface LegacyConfigs {

86

/** All available rules enabled */

87

all: ClassicConfig.Config;

88

/** Base configuration */

89

base: ClassicConfig.Config;

90

/** Disables type-checked rules */

91

"disable-type-checked": ClassicConfig.Config;

92

/** ESLint recommended rules overrides */

93

"eslint-recommended": ClassicConfig.Config;

94

/** Recommended TypeScript rules */

95

recommended: ClassicConfig.Config;

96

/** @deprecated Use recommended-type-checked instead */

97

"recommended-requiring-type-checking": ClassicConfig.Config;

98

/** Recommended rules requiring type checking */

99

"recommended-type-checked": ClassicConfig.Config;

100

/** Only type-checked recommended rules */

101

"recommended-type-checked-only": ClassicConfig.Config;

102

/** Strict rule enforcement */

103

strict: ClassicConfig.Config;

104

/** Strict rules with type checking */

105

"strict-type-checked": ClassicConfig.Config;

106

/** Only strict type-checked rules */

107

"strict-type-checked-only": ClassicConfig.Config;

108

/** Code style rules */

109

stylistic: ClassicConfig.Config;

110

/** Stylistic rules with type checking */

111

"stylistic-type-checked": ClassicConfig.Config;

112

/** Only stylistic type-checked rules */

113

"stylistic-type-checked-only": ClassicConfig.Config;

114

}

115

```

116

117

**Usage Example:**

118

119

```javascript

120

// .eslintrc.js

121

module.exports = {

122

parser: "@typescript-eslint/parser",

123

plugins: ["@typescript-eslint"],

124

extends: [

125

"@typescript-eslint/recommended",

126

"@typescript-eslint/recommended-type-checked"

127

],

128

parserOptions: {

129

project: "./tsconfig.json"

130

}

131

};

132

```

133

134

### Flat Configuration Presets

135

136

Modern flat configuration presets for ESLint 9+.

137

138

```typescript { .api }

139

interface FlatConfigs {

140

/** All available rules enabled */

141

"flat/all": FlatConfig.ConfigArray;

142

/** Base configuration */

143

"flat/base": FlatConfig.Config;

144

/** Disables type-checked rules */

145

"flat/disable-type-checked": FlatConfig.Config;

146

/** ESLint recommended rules overrides */

147

"flat/eslint-recommended": FlatConfig.Config;

148

/** Recommended TypeScript rules */

149

"flat/recommended": FlatConfig.ConfigArray;

150

/** Recommended rules requiring type checking */

151

"flat/recommended-type-checked": FlatConfig.ConfigArray;

152

/** Only type-checked recommended rules */

153

"flat/recommended-type-checked-only": FlatConfig.ConfigArray;

154

/** Strict rule enforcement */

155

"flat/strict": FlatConfig.ConfigArray;

156

/** Strict rules with type checking */

157

"flat/strict-type-checked": FlatConfig.ConfigArray;

158

/** Only strict type-checked rules */

159

"flat/strict-type-checked-only": FlatConfig.ConfigArray;

160

/** Code style rules */

161

"flat/stylistic": FlatConfig.ConfigArray;

162

/** Stylistic rules with type checking */

163

"flat/stylistic-type-checked": FlatConfig.ConfigArray;

164

/** Only stylistic type-checked rules */

165

"flat/stylistic-type-checked-only": FlatConfig.ConfigArray;

166

}

167

```

168

169

**Usage Example:**

170

171

```typescript

172

// eslint.config.js

173

import tseslint from "@typescript-eslint/eslint-plugin/use-at-your-own-risk/raw-plugin";

174

175

export default [

176

...tseslint.flatConfigs["flat/recommended-type-checked"],

177

{

178

languageOptions: {

179

parser: tseslint.parser,

180

parserOptions: {

181

project: true

182

}

183

}

184

}

185

];

186

```

187

188

### Parser Integration

189

190

TypeScript ESLint parser for processing TypeScript syntax.

191

192

```typescript { .api }

193

/**

194

* TypeScript ESLint parser instance

195

*/

196

interface Parser {

197

/** Parser metadata */

198

meta: ParserMeta;

199

/** Main parsing function for ESLint */

200

parseForESLint(code: string, options: ParserOptions): ParseResult;

201

}

202

203

interface ParserOptions {

204

/** Path to TypeScript configuration file */

205

project?: string | string[] | boolean;

206

/** Additional TypeScript compiler options */

207

tsconfigRootDir?: string;

208

/** ESLint-specific options */

209

ecmaVersion?: number;

210

sourceType?: "script" | "module";

211

ecmaFeatures?: Record<string, boolean>;

212

}

213

```

214

215

**Usage Example:**

216

217

```typescript

218

import { parser } from "@typescript-eslint/eslint-plugin/use-at-your-own-risk/raw-plugin";

219

220

export default [

221

{

222

languageOptions: {

223

parser: parser,

224

parserOptions: {

225

project: ["./tsconfig.json", "./packages/*/tsconfig.json"],

226

tsconfigRootDir: __dirname

227

}

228

}

229

}

230

];

231

```

232

233

## Configuration Examples

234

235

### Basic Setup

236

237

```javascript

238

// .eslintrc.js - Basic setup

239

module.exports = {

240

parser: "@typescript-eslint/parser",

241

plugins: ["@typescript-eslint"],

242

extends: ["@typescript-eslint/recommended"],

243

rules: {

244

"@typescript-eslint/no-unused-vars": "error"

245

}

246

};

247

```

248

249

### Type-Checked Setup

250

251

```javascript

252

// .eslintrc.js - With type checking

253

module.exports = {

254

parser: "@typescript-eslint/parser",

255

plugins: ["@typescript-eslint"],

256

extends: ["@typescript-eslint/recommended-type-checked"],

257

parserOptions: {

258

project: "./tsconfig.json"

259

},

260

rules: {

261

"@typescript-eslint/no-floating-promises": "error",

262

"@typescript-eslint/no-unsafe-assignment": "warn"

263

}

264

};

265

```

266

267

### Flat Config Setup

268

269

```typescript

270

// eslint.config.js - Modern flat config

271

import tseslint from "@typescript-eslint/eslint-plugin/use-at-your-own-risk/raw-plugin";

272

273

export default [

274

...tseslint.flatConfigs["flat/strict-type-checked"],

275

{

276

languageOptions: {

277

parser: tseslint.parser,

278

parserOptions: {

279

project: true

280

}

281

},

282

rules: {

283

"@typescript-eslint/explicit-function-return-type": "error"

284

}

285

}

286

];

287

```

288

289

## Types

290

291

```typescript { .api }

292

interface ClassicConfig {

293

extends?: string[];

294

plugins?: string[];

295

rules?: Record<string, RuleConfig>;

296

parser?: string;

297

parserOptions?: ParserOptions;

298

env?: Record<string, boolean>;

299

globals?: Record<string, boolean>;

300

}

301

302

interface FlatConfig {

303

languageOptions?: {

304

parser?: Parser;

305

parserOptions?: ParserOptions;

306

globals?: Record<string, boolean>;

307

ecmaVersion?: number;

308

sourceType?: "script" | "module";

309

};

310

plugins?: Record<string, Plugin>;

311

rules?: Record<string, RuleConfig>;

312

files?: string[];

313

ignores?: string[];

314

}

315

316

interface PluginMeta {

317

name: string;

318

version: string;

319

}

320

321

type RuleConfig =

322

| "off" | "warn" | "error"

323

| 0 | 1 | 2

324

| [("off" | "warn" | "error" | 0 | 1 | 2), ...unknown[]];

325

326

interface ParseResult {

327

ast: Program;

328

scopeManager: ScopeManager;

329

visitorKeys: VisitorKeys;

330

}

331

```