or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

cli.mdconfiguration.mdindex.mdnodejs-api.mdoutput-formats.mdplugins.mdrules.md

cli.mddocs/

0

# Command Line Interface

1

2

Oxlint provides a comprehensive command-line interface for linting JavaScript and TypeScript files with extensive configuration options.

3

4

## Basic Syntax

5

6

```bash { .api }

7

oxlint [OPTIONS] [PATH...]

8

```

9

10

**Parameters:**

11

- `PATH...` - Files or directories to lint (defaults to current directory)

12

13

## Core Options

14

15

### Basic Configuration

16

17

```bash { .api }

18

# Configuration file (JSON only, comments supported)

19

oxlint --config .oxlintrc.json

20

oxlint -c path/to/config.json

21

22

# TypeScript configuration for path aliases and project references

23

oxlint --tsconfig ./tsconfig.json

24

25

# Initialize configuration with defaults

26

oxlint --init

27

```

28

29

### Rule Management

30

31

```bash { .api }

32

# Allow rules or categories (suppress linting)

33

oxlint --allow RULE_OR_CATEGORY

34

oxlint -A RULE_OR_CATEGORY

35

36

# Warn on rules or categories

37

oxlint --warn RULE_OR_CATEGORY

38

oxlint -W RULE_OR_CATEGORY

39

40

# Deny rules or categories (error level)

41

oxlint --deny RULE_OR_CATEGORY

42

oxlint -D RULE_OR_CATEGORY

43

```

44

45

**Rule Categories:**

46

- `correctness` - Code that is outright wrong or useless (default)

47

- `suspicious` - Code that is most likely wrong or useless

48

- `pedantic` - Strict lints with occasional false positives

49

- `style` - Code style and idiomatic patterns

50

- `nursery` - New lints under development

51

- `restriction` - Prevents use of certain language features

52

- `all` - All categories except nursery

53

54

### Fix Options

55

56

```bash { .api }

57

# Apply safe automatic fixes

58

oxlint --fix

59

60

# Apply suggestion fixes (may change behavior)

61

oxlint --fix-suggestions

62

63

# Apply dangerous fixes and suggestions

64

oxlint --fix-dangerously

65

```

66

67

### Output Control

68

69

```bash { .api }

70

# Output format selection

71

oxlint --format FORMAT

72

oxlint -f FORMAT

73

74

# Available formats: default, json, stylish, checkstyle, github, gitlab, junit, unix

75

76

# Warning handling

77

oxlint --quiet # Suppress warnings, errors only

78

oxlint --deny-warnings # Treat warnings as errors

79

oxlint --max-warnings 10 # Maximum warning threshold

80

```

81

82

### Plugin Management

83

84

```bash { .api }

85

# Enable plugins (off by default)

86

oxlint --react-plugin # React and React Hooks rules

87

oxlint --import-plugin # Import/export rules (experimental)

88

oxlint --jsdoc-plugin # JSDoc rules

89

oxlint --jest-plugin # Jest testing rules

90

oxlint --vitest-plugin # Vitest testing rules

91

oxlint --jsx-a11y-plugin # Accessibility rules

92

oxlint --nextjs-plugin # Next.js specific rules

93

oxlint --react-perf-plugin # React performance rules

94

oxlint --promise-plugin # Promise rules

95

oxlint --node-plugin # Node.js rules

96

oxlint --regex-plugin # Regular expression rules

97

oxlint --vue-plugin # Vue.js rules

98

99

# Disable plugins (on by default)

100

oxlint --disable-unicorn-plugin

101

oxlint --disable-oxc-plugin

102

oxlint --disable-typescript-plugin

103

```

104

105

### Advanced Options

106

107

```bash { .api }

108

# Performance and threading

109

oxlint --threads 4 # Number of CPU threads (default: auto)

110

oxlint --silent # Suppress all output

111

112

# Type-aware linting (requires TypeScript configuration)

113

oxlint --type-aware

114

115

# Configuration debugging

116

oxlint --print-config # Show resolved configuration

117

oxlint --disable-nested-config # Disable auto config file loading

118

119

# Rule information

120

oxlint --rules # List all available rules

121

122

# Experimental features

123

oxlint --experimental-js-plugins # Enable experimental JS plugins

124

```

125

126

### Ignore Patterns

127

128

```bash { .api }

129

# Command-line ignore patterns

130

oxlint --ignore-pattern "**/*.test.js"

131

oxlint --ignore-pattern "dist/*"

132

133

# Specify custom ignore file (default: .eslintignore)

134

oxlint --ignore-path .myignore

135

136

# Disable all ignore file processing

137

oxlint --no-ignore

138

139

# Ignore file support

140

# Reads .oxlintignore, .eslintignore, and .gitignore files automatically

141

```

142

143

### Inline Configuration

144

145

```bash { .api }

146

# Report unused disable directives

147

oxlint --report-unused-disable-directives

148

149

# Report with specific severity (allow|warn|error)

150

oxlint --report-unused-disable-directives-severity allow

151

oxlint --report-unused-disable-directives-severity warn

152

oxlint --report-unused-disable-directives-severity error

153

```

154

155

## Usage Examples

156

157

### Basic Linting

158

159

```bash

160

# Lint current directory with default settings

161

oxlint

162

163

# Lint specific files and directories

164

oxlint src/ test/ index.js

165

166

# Lint with configuration file

167

oxlint --config .oxlintrc.json src/

168

```

169

170

### Rule Configuration

171

172

```bash

173

# Allow all rules, then deny specific categories

174

oxlint -A all -D correctness -D suspicious src/

175

176

# Mix of allow/deny for fine-grained control

177

oxlint -D suspicious --allow no-debugger -W pedantic src/

178

```

179

180

### Plugin Usage

181

182

```bash

183

# Enable React and import plugins for React projects

184

oxlint --react-plugin --import-plugin --tsconfig tsconfig.json src/

185

186

# Disable default plugins for minimal linting

187

oxlint --disable-unicorn-plugin --disable-oxc-plugin src/

188

```

189

190

### Fix and Format

191

192

```bash

193

# Apply safe fixes with JSON output

194

oxlint --fix --format json src/

195

196

# Apply all fixes including dangerous ones

197

oxlint --fix-dangerously src/

198

199

# GitHub Actions integration

200

oxlint --format github src/

201

```

202

203

### CI/CD Integration

204

205

```bash

206

# Fail build on any warnings

207

oxlint --deny-warnings --format junit src/ > test-results.xml

208

209

# Set warning threshold for gradual adoption

210

oxlint --max-warnings 50 src/

211

212

# Quiet mode for CI (errors only)

213

oxlint --quiet --format checkstyle src/

214

```

215

216

## Exit Codes

217

218

### Success (0)

219

- `LintSucceeded` - No errors found

220

- `PrintConfigResult` - Configuration printed successfully

221

- `ConfigFileInitSucceeded` - Config file created successfully

222

- `LintNoFilesFound` - No files to lint (currently returns 0)

223

224

### Failure (1)

225

- `LintFoundErrors` - Linting errors found

226

- `LintMaxWarningsExceeded` - Warning threshold exceeded

227

- `LintNoWarningsAllowed` - Warnings found when --deny-warnings used

228

- `ConfigFileInitFailed` - Failed to create config file

229

- `InvalidOptionConfig` - Invalid configuration file

230

- `InvalidOptionTsConfig` - Invalid tsconfig.json

231

- `InvalidOptionSeverityWithoutFilter` - Severity option without rule filter

232

- `InvalidOptionSeverityWithoutPluginName` - Severity without plugin name

233

- `InvalidOptionSeverityWithoutRuleName` - Severity without rule name

234

- `TsGoLintError` - Type-aware linting error

235

236

## Environment Variables

237

238

```bash { .api }

239

# Control logging levels and targets for debugging

240

OXC_LOG=oxc_resolver oxlint --import-plugin src/

241

OXC_LOG=debug oxlint src/

242

243

# Version override (build-time only)

244

OXC_VERSION=custom-build

245

```

246

247

## File Extensions

248

249

Supported file extensions:

250

- **JavaScript**: `.js`, `.mjs`, `.cjs`, `.jsx`

251

- **TypeScript**: `.ts`, `.mts`, `.cts`, `.tsx`

252

- **Vue**: `.vue` (requires --vue-plugin)

253

- **Svelte**: `.svelte` (basic support)

254

- **Astro**: `.astro` (basic support)