twenty icon indicating copy to clipboard operation
twenty copied to clipboard

[Timebox] POC: use Nx Workspace Lint rules feature

Open thaisguigon opened this issue 1 year ago • 0 comments

Scope & Context

Our custom Eslint rules are written in Typescript and must be built before Eslint and VSCode can use them. Currently, the rules are built as a tgz file (eslint-plugin-twenty.tgz) to ensure they work from project installation.

This issue aims to leverage Nx's "workspace lint rules" feature (see https://nx.dev/nx-api/eslint/generators/workspace-rule) and how we can use it in our project, so we can avoid building a tgz file and still dynamically load eslint rules written in TS.

Technical inputs

  • Use Nx's generator to recreate the existing custom rules from eslint-plugin-twenty and load them in twenty-front's eslint config.
  • Configure an extendable eslint config at the root of the workspace, to set common base rules for all packages.
  • Use Nx's eslint plugin to set recommended configs.
  • Take inspiration from how Nx configures eslint for monorepos (see https://github.com/nrwl/nx-examples/tree/master).
  • Check that linting tools/eslint-rules and packages/twenty-front packages works.

thaisguigon avatar Dec 27 '23 10:12 thaisguigon