twenty
twenty copied to clipboard
[Timebox] POC: use Nx Workspace Lint rules feature
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-twentyand load them intwenty-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-rulesandpackages/twenty-frontpackages works.