Prerequisites
Before starting, make sure you have:- Node.js 18 or higher
- A Gadget project with action files
- Basic familiarity with ESLint configuration
ESLint Plugin Setup
1
Install the plugin
Add
@aurelienbbn/eslint-plugin-gadget to your project along with ESLint v9+.2
Configure ESLint
Create or update your
eslint.config.js with the recommended preset:eslint.config.js
The plugin automatically activates on Gadget action files:
**/api/actions/**/*.{js,ts} and **/api/models/**/actions/**/*.{js,ts}3
Run ESLint
Validate your action files:If you have any validation errors, ESLint will report them with fixable suggestions.
4
Fix issues automatically
Many rules support auto-fixing. Run ESLint with the This will automatically fix issues like:
--fix flag:- Invalid timeout values (clamped to 900000ms)
- Numeric separators in options
- Empty
onSuccessexports - Missing
returnTypevalues
Example: Fixing a validation error
Here’s what you might see when running ESLint on an action file:api/models/widget/actions/create.ts
eslint . --fix, the file is corrected:
api/models/widget/actions/create.ts
UI Components Setup
1
Install the package
Add
@aurelienbbn/gadget-ui along with its peer dependencies:2
Configure Tailwind
Update your
tailwind.config.js to use the Gadget preset:tailwind.config.js
3
Import global styles
Add the global CSS to your main CSS file or root layout:This imports CSS variables for colors, shadows, typography, and theme support.
styles/globals.css
4
Use components
Import and use components in your React application:
app/page.tsx
Example: Theme switching
Toggle between dark and light themes by setting thedata-theme attribute on your root element:
app/theme-toggle.tsx
Next Steps
Now that you have both packages installed, explore the documentation:ESLint Rules
Browse all 16 validation rules organized by category
Component Library
Explore the full component API with examples
Configuration
Learn advanced ESLint configuration options
Design Tokens
Customize colors, typography, and theme behavior
Common Issues
ESLint doesn't validate my action files
ESLint doesn't validate my action files
Make sure your action files match the expected patterns:
**/api/actions/**/*.{js,ts}for global actions**/api/models/**/actions/**/*.{js,ts}for model actions
Tailwind classes aren't working
Tailwind classes aren't working
Ensure you:
- Added the Gadget preset to
tailwind.config.js - Included the UI package dist folder in your
contentarray - Imported the global styles in your CSS entry point
pnpm run build in the UI package if using local development.Components don't have proper theming
Components don't have proper theming
Check that:
- You imported
@aurelienbbn/gadget-ui/stylesin your global CSS - Your root HTML element has the
data-themeattribute set to “dark” or “light” - Your Tailwind config uses the Gadget preset (not a custom config)
Get Help
If you encounter issues:- Check the ESLint Plugin Configuration guide
- Review the UI Setup documentation
- Open an issue on GitHub
