eslint-plugin-postcss-modules icon indicating copy to clipboard operation
eslint-plugin-postcss-modules copied to clipboard

Only load deasync module if needed

Open zacharyliu opened this issue 2 years ago • 0 comments

The deasync module is not compatible with Electron (https://github.com/abbr/deasync/issues/81), making it impossible to use this plugin with VSCode's ESLint plugin since it errors on load. But this module is only actually needed if an async postcss config is encountered, which is not the default. Moving the require call inside of the function body means that we don't load the module unless it's needed.

I was able to verify that the plugin works in VSCode after this change, but I'm not sure the best way to test this with the automated tests given that deasync also doesn't work in them. One option is to mock the deasync module and assert that it is/isn't called in the parser test.

zacharyliu avatar Mar 08 '22 19:03 zacharyliu