eslint.config.js). It provides two preset configs (recommended and strict) and automatically detects Gadget action files.
Basic configuration
Import the plugin and use a preset:eslint.config.js
- Critical validation errors (invalid options, params, timeout) at
error - Runtime safety and best practices at
warn
File pattern detection
Most rules only activate on files matching Gadget action file patterns:**/api/actions/**/*.{js,ts}(global actions)**/api/models/**/actions/**/*.{js,ts}(model actions)
Exceptions: Global rules
Two enqueue-related rules apply to all files becauseapi.enqueue() can be called anywhere:
action-no-enqueue-max-concurrency-exceededaction-no-implicit-enqueue-retries
api.enqueue() calls.
Overriding rules
You can adjust individual rule severity by adding a second config object:eslint.config.js
Override patterns
- Disable a rule
- Change severity
- Apply to specific files
Combining with other configs
The plugin works alongside other ESLint configs. Place it before or after other configs depending on precedence:eslint.config.js
Configs listed later override rules from earlier configs. If you want Gadget rules to take precedence, place
gadget.configs last.Strict mode
Usestrict config to enforce all rules at error level:
eslint.config.js
Ignoring files
Use ESLint’signores key to exclude files:
eslint.config.js
Custom plugin usage
If you prefer manual rule configuration, access the plugin object directly:eslint.config.js
Type information
The plugin does not require TypeScript type information (parserServices). All rules operate on the AST level, so you do not need to configure@typescript-eslint/parser unless you are using other type-aware rules.
Example: Production config
Here is a complete config for a Gadget project:eslint.config.js
Next steps
Configs
Compare recommended vs strict configs
Rules
Browse the full rule documentation
