Skip to content
This repository was archived by the owner on Oct 30, 2020. It is now read-only.
This repository was 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

Description

@patryk-sliz

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions