An ESLint plugin that enforces direct imports of Svelte Bootstrap Icons to improve application performance.
npm install eslint-plugin-svelte-bootstrap-icons
To use the recommended configuration, add the following to your eslint configuration:
import eslintPluginSvelteBootstrapIcons from 'eslint-plugin-svelte-bootstrap-icons';
export default tseslint.config({
eslintPluginSvelteBootstrapIcons.configs.recommended,
});
When importing icons from svelte-bootstrap-icons
using the barrel file (index), like this:
import { Alarm, Bell } from 'svelte-bootstrap-icons';
This will import all icons, which can lead to a large bundle size and slow down your application.
This ESLint plugin will enforce direct imports of icons, like this:
import Alarm from 'svelte-bootstrap-icons/lib/Alarm.svelte';
The rule svelte-bootstrap-icons/direct-icon-imports
will:
- ❌ Prevent imports from the barrel file
- ✅ Allow direct imports from individual icon files
- 🔧 Automatically fix incorrect import