s-KaiNet / spfx-fast-serve

Improve your SharePoint Framework development flow by speeding up the "serve" command :rocket:
MIT License
135 stars 11 forks source link

eslint flat-config support #133

Closed nikolaiessel closed 5 months ago

nikolaiessel commented 5 months ago

I`m already using the new eslint flat-config fomat.

It seems this is actually not supported by fast-serve?

OoB I get the same error as in #126. If I add the following to the transformConfig:

    initialWebpackConfig.plugins.forEach(plugin =>
    {
        if (plugin.constructor.name === "ESLintWebpackPlugin")
        {
            plugin.options.configType = "flat";
            plugin.options.eslintPath = "eslint/use-at-your-own-risk";
        }
    });

I get still an error: ERROR in ESLint is not a constructor

It seems included Eslint/Plugin versions are to old to support this config-type?

s-KaiNet commented 5 months ago

It seems included Eslint/Plugin versions are to old to support this config-type?

Yes, and the short answer is that we have to wait SPFx 1.19 release to use flat configs with fast-serve.

Currently, I cannot do anything with that, because flat-configs were introduced in eslint-webpack-plugin@4.1.0, but 4.1.0 supports webpack 5 only, while the latest released SPFx 1.18 is based on webpack 4.

In SPFx 1.19 beta webpack 5 was introduced and I already added support for 4.1.0 eslint plugin in next fast-serve beta.