komposable / komponent

An opinionated way of organizing front-end code in Ruby on Rails, based on components

Home Page:http://komponent.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sort index.js imports alphabetically after adding a component

Spone opened this issue · comments

I think we should sort the imports in the index.js file after adding a component using the generator.

If we implement this, let's add an option to disable this feature (at the generator level, and in config).

Hello,

I am currently working on this, I just wondering how you would like to handle if there is comments or any other code in the index.js

Options:

  1. remove everything that is not an import
  2. create a delimiter where the generator can write safely

Hi! Thanks for contributing :)

Personally I wouldn't mind removing everything that is not an import (it's an index file so theoretically it should only be used for imports).
But maybe it's better to add a delimiter just in case?

@sigmike @florentferry what do you think?

Hello,

The main purpose of this file is about listing others files, in theory only imports generated were been listed here. So keeping only imports is fine.

Great, it makes it easier.