eslint-plugin-svelte-bootstrap-icons
v1.0.0
Published
Plugin for always importing svelte bootstrap icons directly from declaration file instead of the barrel file.
Maintainers
Readme
eslint-plugin-svelte-bootstrap-icons
An ESLint plugin that enforces direct imports of Svelte Bootstrap Icons to improve application performance.
Installation
npm install eslint-plugin-svelte-bootstrap-iconsUsage
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,
});The Problem
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.
The Solution
This ESLint plugin will enforce direct imports of icons, like this:
import Alarm from 'svelte-bootstrap-icons/lib/Alarm.svelte';Rule Details
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
