css-modules / postcss-modules-values

Pass arbitrary constants between your module files
ISC License
38 stars 6 forks source link

Error or Warning on value not found #7

Closed zsteinerjc closed 4 years ago

zsteinerjc commented 4 years ago

Is it possible to add an optional error or warning when a value is not found? For a large project it is difficult to confidently remove unused values without some feedback that a file is trying to import a value that is not found. Current imports fail silently with just the string of the value name getting passed along. For instance, if @value myColor: rebeccaPurple doesn't exist, then color: myColor is output. Sass for instance will throw an error when using a variable that doesn't exist. Looking for an option to replicate this behavior.

alexander-akait commented 4 years ago

No, it is impossible on postcss-modules-values side, because interpolation values going on css-loader side or postcss-modules-plugin

zsteinerjc commented 4 years ago

Thank you for the response. When you say it's possible, do you mean that it's possible to add the feature in the future or it's possible to configure an existing project with errors/warnings?

alexander-akait commented 4 years ago

I think the best solution here is write a stylelint rule

alexander-akait commented 4 years ago

Also new css-loader supported namedExport (it will be true by default in the near future) so you will get error on build step, so I want to close this issue