eslint-plugin-svelte-bootstrap-icons Svelte Themes

Eslint Plugin Svelte Bootstrap Icons

An ESLint plugin that enforces direct imports of Svelte Bootstrap Icons to improve application performance.

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-icons

Usage

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

Top categories

Loading Svelte Themes