cismet / carma

carma monorepo: cids architecture for reactive mapping applications
0 stars 1 forks source link

NX DX: Convert eslint configs to flat format. #84

Open mxfh opened 1 month ago

mxfh commented 1 month ago

Migration from .eslintrc.json to flat format eslint.config.js|mjsis recommended by eslint migrate configs eslint docs:

NX provides a tool but that seems to generate quite verbose and buggy since it keeps in backwards compatibility. https://nx.dev/nx-api/eslint/generators/convert-to-flat-config https://nx.dev/recipes/tips-n-tricks/flat-config

nx issue https://github.com/nrwl/nx/issues/22782

recommendation, only migrate to new flat format once the output of

nx generate convert-to-flat-config is .mts modules and matches what

@eslint/migrate-config .eslintrc.json

does

mxfh commented 1 month ago

-- currently postponed

Ideally the build process (here vite) and the linting alone should be identical. for now they are not.

We need a strategy to share some common eslint settings across the nx projects. the eslint setting should be aware of the tsconfig settings. the eslint settings should use some common recommendation rule as baseline. ideally a strict rulesset.

There are some caveats as that flat config files are not fully supported yet. using a single shared eslint.config for the whole monorepo makes in not diectly possible to use the corresponting tsconfig json for each project.

https://typescript-eslint.io/getting-started/typed-linting/

letting vite take care of the linting via plugin is also not trivial, since they all need loca; eslint files too and its not sure-if any of the outdated vite-eslint-plugin replacement packages is reasonably tested.

an external or custom shared config could then be used across project and in the imported submodules https://typescript-eslint.io/users/configs/

enforce builders and bundlers to only build when linting is passing