Apache Superset uses a hybrid linting approach combining OXC (Oxidation Compiler) for standard rules and a custom AST-based checker for Superset-specific rules.
The linting system consists of two components:
OXC Linter (oxlint) - A Rust-based linter that's 50-100x faster than ESLint
oxlint.jsonnpm run lint or npm run lint-fixCustom Rules Checker - A Node.js AST-based checker for Superset-specific patterns
npm run check:custom-rules# Run both OXC and custom rules npm run lint:full # Run OXC linter only (faster for most checks) npm run lint # Fix auto-fixable issues with OXC npm run lint-fix # Run custom rules checker only npm run check:custom-rules # Run on specific files npm run lint-fix src/components/Button/index.tsx npm run check:custom-rules src/theme/*.tsx
The linting system is integrated with pre-commit hooks:
# Install pre-commit hooks pre-commit install # Run hooks manually on staged files pre-commit run # Run on specific files pre-commit run --files superset-frontend/src/file.tsx
oxlint.json)The OXC configuration includes:
The custom rules are implemented in scripts/check-custom-rules.js and check for:
@superset-ui/core Icons componentThe hybrid approach provides:
If you see this error when running npm run lint, ensure you're using the explicit config:
npx oxlint --config oxlint.json
Verify the AST parsing dependencies are installed:
npm ls @babel/parser @babel/traverse glob
Ensure your changes are staged:
git add . pre-commit run
scripts/check-custom-rules.jsfunction checkNewRule(ast, filepath) { traverse(ast, { // AST visitor pattern }); }
processFile()oxlint.jsonnpm run lintThis hybrid approach replaces the previous ESLint setup while maintaining all custom Superset linting rules. The migration provides:
The linting system is integrated into CI via GitHub Actions. See .github/workflows/superset-frontend-lint.yml for the CI configuration.