Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Style with interface doesn't mark as incorrent when it in incorrect type #88

Open
SatarisGIT opened this issue Jan 4, 2019 · 0 comments

Comments

@SatarisGIT
Copy link

Hello!

I have problem with newest version of this loader.
SCSS:

.testmodule {

     color: green;

     &__testmoduleelement {

          color: red;

          &--modifier {
               color: blue;
          }
          
     }
}

will generate

export interface IDevModuleScss {
  'testmodule': string;
  'testmodule__testmoduleelement': string;
  'testmodule__testmoduleelement--modifier': string;
}

export const locals: IDevModuleScss;
export default locals;

(export default locals; - added manually)

importing:

import styles from './dev.module.scss'

It is work great, lint will suggest what classes i can use, example: (React)

<div className={styles["testmodule__testmoduleelement--modifier"]}>
Test
</div>

But when i REMOVE this class from SCSS, lint will not mark this line as incorrect. I can use any string of class name!

                  <div className={styles["incorrect ClAsS NaMe"]}>
                         Test
                    </div>

And it still will be "OK".

Can you add something like

type Options = "hello" | "world";
var foo: Options;
foo = "hello"; // Okay 
foo = "asdf"; // Error!

instead of simple interface?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant