bit doesnt recognize .module.css as a legitimate file ending

Created on 3 Mar 2020  路  3Comments  路  Source: teambit/bit

Describe the bug

I added a file with the .module.css ending. bit did not recognize it as a valid file ending and added it to the module to the component name.

Steps to Reproduce

  1. create a file called component.module.css
  2. add it to bit with the -n flag
  3. the component was named componentmodule

Expected Behavior

bit should recognize that the .module part is not a part of the name.
even if bit doesn't recognize it, it should at least be replaced with -.

prioritmedium typbug

Most helpful comment

@davidfirst @GiladShoham - this is not a common scenario (adding only module.css file to component). I suggest to freeze it.

All 3 comments

Thanks @odedre for reporting this.

@Tallyb , @itaymendel , what do you suggest the best experience here?
As described, If I run bit add component.module.css, the component name is componentmodule.
According to the code, we replace camelCase with a dash but remove all dots. I guess we should also replace dots with dashes.

For a future reference, this is coming from the following function:

  static getValidIdChunk(chunk: string): string {
    if (!isValidIdChunk(chunk)) {
      chunk = chunk.replace(/\./g, '');
      chunk = decamelize(chunk, '-');
    }
    return chunk;
  }

I agree it should replace dots with dashes.

@davidfirst @GiladShoham - this is not a common scenario (adding only module.css file to component). I suggest to freeze it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amadeogallardo picture amadeogallardo  路  4Comments

JamesNorris11 picture JamesNorris11  路  4Comments

KutnerUri picture KutnerUri  路  3Comments

williamluke4 picture williamluke4  路  4Comments

JGJP picture JGJP  路  3Comments