Skip to content

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

License

Notifications You must be signed in to change notification settings

kvist-no/eslint-plugin-svelte-bootstrap-icons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published