@ovineko/spa-guard-eslint
v0.0.2-alpha-1
Published
ESLint rules for spa-guard (no-direct-lazy, no-direct-error-boundary)
Readme
@ovineko/spa-guard-eslint
ESLint plugin with rules that enforce spa-guard usage patterns: no-direct-lazy and no-direct-error-boundary.
Install
npm install --save-dev @ovineko/spa-guard-eslint eslintUsage
Add the recommended config to your eslint.config.js (flat config):
import spaGuard from "@ovineko/spa-guard-eslint";
export default [
spaGuard.configs.recommended,
// ... your other configs
];The recommended config enables both rules at "error" level with autofixes.
Rules
no-direct-lazy
Disallows importing lazy from react. Use lazyWithRetry from @ovineko/spa-guard-react instead.
// Bad - flagged by the rule
import { lazy } from "react";
// Good - autofix replaces it with:
import { lazyWithRetry } from "@ovineko/spa-guard-react";no-direct-error-boundary
Disallows importing from react-error-boundary. Use @ovineko/spa-guard-react/error-boundary instead.
// Bad - flagged by the rule
import { ErrorBoundary } from "react-error-boundary";
// Good - autofix replaces it with:
import { ErrorBoundary } from "@ovineko/spa-guard-react/error-boundary";Both rules provide autofixes and are fixable via eslint --fix.
API
plugin(default export) - ESLint plugin object withrulesandconfigsconfigs- Named export;configs.recommendedis the flat config objectrules- Named export; object withno-direct-lazyandno-direct-error-boundary
Related packages
- @ovineko/spa-guard - Core package
- @ovineko/spa-guard-react - React integration (lazyWithRetry, ErrorBoundary)
License
MIT
