sveltejs / eslint-plugin-svelte3

An ESLint plugin for Svelte v3 components.
MIT License
372 stars 43 forks source link

Cannot set svelte3/ignore-styles to true when using eslintrc.json #43

Open radarsh opened 4 years ago

radarsh commented 4 years ago

In my project, we use the JSON config for ESLint and using it seems impossible to set svelte3/ignore-styles to true.

"settings": {
    "svelte3/ignore-styles": true
}

Gives me:

TypeError: processor_options.ignore_styles is not a function

From looking at the code, it seems that an assumption is made that svelte3/ignore-styles is always going to be a function, which clearly is impossible to specify using JSON config (eslintrc.json).

Conduitry commented 4 years ago

This was an intentional change in version 2. I understand that ESLint themselves are encouraging people to write CommonJS-formatted .eslintrc.js files, and requiring these to be functions is one less thing to worry about. But I can see how it would be annoying to be forced to convert to a CommonJS format just for this.

radarsh commented 4 years ago

Thanks for clarifying that. Yes, it was an annoyance to convert from JSON to JS eslintrc but at least it was a one-off.