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

[Breaking] refactor(eslint-mc-app): simplify and improve usage of eslint config #1961

Merged
merged 5 commits into from
Jan 22, 2021

Conversation

emmenko
Copy link
Member

@emmenko emmenko commented Jan 9, 2021

Our ESLint config hasn't been updated in a while. Furthermore, in this repo we were not using the mc-app config but a "custom" one specific for typescript.

Let's change that and use our own config here as well, with support for TypeScript out of the box.

So what changed here:

  • I decided to drop the airbnb base config and use instead the react-app config. The react-app config comes with some good defaults (also regarding TypeScript) and it's anyway what we look for in terms of tooling (react-scripts, babel, etc). So it's more aligned on that front as well.
  • No more many required peer dependencies to be installed. I think we should make it as simple as possible for users to set up their dev environment, and having to install >10 peer dependencies does not help much. Even though ESLint recommends to ship a sharable config with peer dependencies, I think the usability is still better if we only require eslint as a peer dependency.

    Note that all the dependencies are defined with a caret ^ version range, which gives a bit of flexibility to the consumers in case of version conflicts.

  • Cleaned up some of the rules.
  • Included some additional TypeScript config that we were using before anyway (extending what is already specified in react-app config).

@vercel
Copy link

vercel bot commented Jan 9, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/commercetools/merchant-center-application-kit/ajyibfkb8
✅ Preview: https://merchant-cente-git-nm-eslint-mc-app-impro-cab8f3.commercetools.now.sh

@changeset-bot
Copy link

changeset-bot bot commented Jan 9, 2021

🦋 Changeset detected

Latest commit: 07a5238

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@commercetools-frontend/eslint-config-mc-app Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@emmenko emmenko changed the title refactor(eslint-mc-app): simplify and improve usage of eslint config [Breaking] refactor(eslint-mc-app): simplify and improve usage of eslint config Jan 9, 2021
@tdeekens
Copy link
Contributor

tdeekens commented Jan 9, 2021

Nice. Let's finish internal refactors by earlier releases before loading teams with more things I'd suggest. Can you anticipate how many changes this would cause and how many are auto-fixable?

@vercel vercel bot temporarily deployed to Preview January 10, 2021 16:13 Inactive
@emmenko
Copy link
Member Author

emmenko commented Jan 10, 2021

Can you anticipate how many changes this would cause and how many are auto-fixable?

I tested this in our internal repo. It's all good, and it actually found a bunch of legit errors! 🤓

@emmenko emmenko requested a review from a team January 10, 2021 16:56
@@ -4,7 +4,7 @@
<a href="https://www.npmjs.com/package/@commercetools-frontend/eslint-config-mc-app"><img src="https://badgen.net/npm/v/@commercetools-frontend/eslint-config-mc-app" alt="Latest release (latest dist-tag)" /></a> <a href="https://www.npmjs.com/package/@commercetools-frontend/eslint-config-mc-app"><img src="https://badgen.net/npm/v/@commercetools-frontend/eslint-config-mc-app/next" alt="Latest release (next dist-tag)" /></a> <a href="https://bundlephobia.com/result?p=@commercetools-frontend/eslint-config-mc-app"><img src="https://badgen.net/bundlephobia/minzip/@commercetools-frontend/eslint-config-mc-app" alt="Minified + GZipped size" /></a> <a href="https://github.com/commercetools/merchant-center-application-kit/blob/master/LICENSE"><img src="https://badgen.net/github/license/commercetools/merchant-center-application-kit" alt="GitHub license" /></a>
</p>

ESLint config used by a MC application.
ESLint config used by a (Merchant Center) Custom Application.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need (Merchant Center)

@@ -3,6 +3,7 @@ import { Formik } from 'formik';
import { FormDialog } from '@commercetools-frontend/application-components';
import Spacings from '@commercetools-uikit/spacings';
import TextField from '@commercetools-uikit/text-field';
import TextInput from '@commercetools-uikit/text-input';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this related to the eslint udpate? 🤔
or was this something you just discovered on the way?

@emmenko emmenko force-pushed the nm-eslint-mc-app-improvements branch from 35ea6bd to f7ec8aa Compare January 19, 2021 18:42
@vercel vercel bot temporarily deployed to Preview January 19, 2021 18:43 Inactive
@vercel vercel bot temporarily deployed to Preview January 19, 2021 18:49 Inactive
@emmenko emmenko force-pushed the nm-eslint-mc-app-improvements branch from f27166e to ee4ede3 Compare January 20, 2021 09:26
@emmenko
Copy link
Member Author

emmenko commented Jan 20, 2021

@tdeekens @adnasa I think we're good to go now with this (major) release.

We can also include a bunch more breaking changes, for example "Remove deprecated hostnames" (#1829).

@vercel vercel bot temporarily deployed to Preview January 20, 2021 09:39 Inactive
Copy link
Contributor

@tdeekens tdeekens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Thanks for iterating on this!

@emmenko emmenko mentioned this pull request Jan 20, 2021
2 tasks
@vercel vercel bot temporarily deployed to Preview January 21, 2021 08:58 Inactive
@emmenko emmenko force-pushed the nm-eslint-mc-app-improvements branch from 69e7b71 to 07a5238 Compare January 22, 2021 14:19
@vercel vercel bot temporarily deployed to Preview January 22, 2021 14:19 Inactive
@emmenko emmenko merged commit 7f8b219 into master Jan 22, 2021
@emmenko emmenko deleted the nm-eslint-mc-app-improvements branch January 22, 2021 14:41
@ghost ghost mentioned this pull request Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants