Skip to content

v5.0.0

Compare
Choose a tag to compare
@github-actions github-actions released this 06 May 16:54
· 429 commits to main since this release

5.0.0 (2022-05-06)

Foundry v5 is easier than ever to set up, adapts automatically to your project, and includes a slew of helpful new lint rules. The minimum Node version has been raised to ^14.17 || >=16 (i.e. Node 15 is not supported). Here's how to upgrade:

Automatic configuration ✨

Foundry analyses your package.json file and can automatically detect which environments your project runs in, which language it's written in, which frameworks are being used, and whether the project is open source. This eliminates the need for custom configuration in most cases and enables Foundry to adapt the tool configs as your project evolves. That's why the tool configs no longer accept an options argument, so you'll need to update them accordingly. Here's an example:

// .eslintrc.js

// This...
module.exports = require('@sumup/foundry/eslint')(
  {
    language: 'TypeScript',
    environments: ['Node', 'Browser'],
    frameworks: ['React', 'Emotion', 'Jest'],
    openSource: false,
  },
  {
    rules: {
      'max-len': 'off',
    },
  },
);

// ...becomes this:
module.exports = require('@sumup/foundry/eslint')({
  rules: {
    'max-len': 'off',
  },
});

Should the automatic detection be inaccurate, please open an issue so we can improve it for everyone. Alternatively, you can explicitly set the options under the foundry property in your package.json file:

{
  "foundry": {
    "environments": ["Browser"],
    "publish": true
  }
}

Refer to the documentation for all available configuration options.

New lint rules 🧿

Foundry v5 upgrades to ESLint 8 and includes new plugins for Next.js, Playwright, and browser compatibility.

Especially on larger codebases, the number of new lint errors can be overwhelming. In that case, we recommend using overrides to set the severity level of the new rules to warn, thus enabling you to address them gradually.

No more "templates" preset 🧹

The "templates" preset appeared to be mostly unused and the template files were quite outdated. Since the maintenance of the preset doesn't seem to be worth the effort, we decided to remove it. If you set up the preset but weren't using it, you should remove the plopfile.js file and the create-component script from the package.json file.

Troubleshooting

You might encounter an error like ESLint couldn't find the config/plugin/preset ... when running yarn lint after the upgrade. This can happen when duplicated or outdated sub-dependencies of Foundry are installed. In order to fix this, remove @sumup/foundry from the package.json file, run yarn, then add @sumup/foundry back to the package.json file and run yarn again. This forces a fresh install of Foundry's latest dependencies.


Full Changelog

Features

BREAKING CHANGES

  • Configuration options are now detected automatically. Any manual configuration in tooling config files should be removed.
  • Remove the 'templates' preset.
  • Increase the minimum Node version to ^14.17 || >=16.
  • Upgrade to ESLint 8 and upgrade all plugins and presets. Read the migration guide.
  • Upgrade to lint-staged 12. Read the release notes.
  • Enable Emotion 11 codemods.