finsweet / developer-starter

Developer starter template for Finsweet projects.
https://www.finsweet.com/
187 stars 67 forks source link

Update eslint/prettier rules with new import sorting logic #23

Closed alexiglesias93 closed 1 year ago

alexiglesias93 commented 1 year ago

The @trivago/prettier-plugin-sort-imports dependency worked great for sorting imports, but it causes too many conflicts when used along other plugins, plus it doesn't support the new TypeScript 4.9 satisfies operator.

I've been wanting to find a replacement for that plugin for a long time, and found the perfect solution: eslint-plugin-simple-import-sort. Instead of being a prettier plugin, it's an eslint plugin, which solves many integration issues that the trivago version caused.

I've included this plugin in @finsweet/eslint-config v2.0.0 (note that this is a breaking change, hence the major version bump) and updated this starter template to reflect the new config.

Also, to ensure all our devs are properly fixing the prettier and eslint issues automatically, I've added workspace specific rules for formatting on save:

{
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  }
}

@robertkibet Can you please implement these changes in the monorepo-starter template too?