Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of EsLint with CRA4 #219

Merged
merged 19 commits into from Dec 8, 2020

Conversation

alexasselin008
Copy link
Contributor

@alexasselin008 alexasselin008 commented Dec 1, 2020

As noted in this issue, eslint-loader has been deleted from create-react-app in version 4.0. Now eslint is being delivered through eslint-webpack-plugin, not eslint-loader. ­reference.

This PR adds the following code :

  • 3 new method (getPlugin, removePlugins, pluginByName) in a new file plugin.js
  • modification in eslint.js to support eslint being loaded from a plugin instead of a loader.
  • After discussing with Craco Author @patricklafrance, this project will no longer be backward compatible. It will only support the latest version of CRA.

@alexasselin008
Copy link
Contributor Author

Release Notes

Migration Path from 5.8.0

Eslint-loader has been deleted from create-react-app in version 4.0. Now eslint is being delivered through eslint-webpack-plugin, not eslint-loader.
View Changes.

The property loaderOptions is now named pluginOptions

CRACO 5.8

    eslint: {
        enable: true /* (default value) */,
        mode: "extends" /* (default value) */ || "file",
        configure: { /* Any eslint configuration options: https://eslint.org/docs/user-guide/configuring */ },
        configure: (eslintConfig, { env, paths }) => { return eslintConfig; },
        --> loaderOptions: { /* Any eslint-loader configuration options: https://github.com/webpack-contrib/eslint-loader. */ },
        --> loaderOptions: (eslintOptions, { env, paths }) => { return eslintOptions; }
    },

CRACO 6.0

    eslint: {
        enable: true /* (default value) */,
        mode: "extends" /* (default value) */ || "file",
        configure: { /* Any eslint configuration options: https://eslint.org/docs/user-guide/configuring */ },
        configure: (eslintConfig, { env, paths }) => { return eslintConfig; },
        --> pluginOptions: { /* Any eslint-loader configuration options: https://eslint.org/docs/developer-guide/nodejs-api#%E2%97%86-new-eslint-options. */ },
        --> pluginOptions: (eslintOptions, { env, paths }) => { return eslintOptions; }
    },

@patricklafrance patricklafrance merged commit 1e4f912 into dilanx:master Dec 8, 2020
@patricklafrance
Copy link
Contributor

🥇 thanks for taking care of this @alexasselin008

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants