Closed tommy-mitchell closed 1 year ago
I'm using a script that generates boilerplate for a new React component that creates an empty ruleset for its associated class in a scss module file:
// Foo.tsx import styles from './Foo.module.scss'; function Foo() { return <div className={styles.foo}></div>; }
// Foo.module.scss .foo { @debug 'no styles added'; // included so Prettier doesn't complain }
But when this plugin creates Foo.module.scss.d.ts, it ignores the "empty" .foo class:
Foo.module.scss.d.ts
.foo
declare const classNames: { }; export = classNames;
I'd make a PR, but I couldn't find in the code where this was being filtered out.
As it turns out, the issue is that SCSS itself doesn’t emit empty rules. Adding a CSS comment does the trick:
.Foo { @debug “no styles added”; /* no styles added */ }
I'm using a script that generates boilerplate for a new React component that creates an empty ruleset for its associated class in a scss module file:
But when this plugin creates
Foo.module.scss.d.ts
, it ignores the "empty".foo
class:I'd make a PR, but I couldn't find in the code where this was being filtered out.