taiga-family/configurations

๐Ÿš€ - New eslint rule `@taiga-ui/no-invalid-icon-name`

Closed this issue ยท 0 comments

Description

Which @taiga-ui/* package(s) are relevant/releated to the feature request?

eslint-plugin

Description

Check that all icons inside our components are actually exists.

Suggested solution

  1. Look for all occurence of tuiIcon... inside projects/** and NOT inside ['projects/icons/**', 'projects/demo/**']
    (all these paths should be configurable parameters because they will be different for our proprietary repo)
  2. Check that this icon exits inside projects/icons/constants/icons.ts
    (this path should be configurable parameter because it will be different for our proprietary repo)

Examples

Valid โœ…

get icon(): string {
    return this.isPasswordHidden ? 'tuiIconHideLarge' : 'tuiIconShowLarge';
}

Invalid โŒ

get icon(): string {
    return this.isPasswordHidden ? 'tuiIconNotShowLarge' : 'tuiIconShowLarge';
                                    ~~~~~~~~~~~~~~~~~~~~
}

Valid โœ…

<tui-svg src="tuiIconChevronDown"></tui-svg>

Invalid โŒ

<tui-svg src="tuiIconChevroletDown"></tui-svg>
              ~~~~~~~~~~~~~~~~~~~~