bpmn-visualization-js icon indicating copy to clipboard operation
bpmn-visualization-js copied to clipboard

[INFRA] Share the eslint configuration

Open tbouffard opened this issue 1 year ago • 0 comments

bpmn-visualization uses it own dedicated eslint configuration but we have the we have the same need in several repositories. For demos, we recently experiment xo that also allows shared configuration but we didn't setup it. Some other repositories that need a linter configuration

  • https://github.com/process-analytics/icpm-demo-2022/issues/20
  • https://github.com/process-analytics/bv-experimental-add-ons/issues/11 / https://github.com/process-analytics/bv-experimental-add-ons/issues/27

The website has its own eslint configuration which initially duplicated from the configuration of this repository.

So, it's time to consider to create one or several shared configurations

  • https://eslint.org/docs/latest/extend/shareable-configs
  • https://eslint.org/docs/latest/use/configure/configuration-files-new
  • https://eslint.org/docs/latest/use/configure/configuration-files

We could start by extracting the configuration and create a first shared configuration for TypeScript browser project.

Prerequisites

IMPORTANT: requires to implement #2078 and #2742 first

Prettier configuration

  • it is currently stored in a dedicated configuration file. Investigate if it can be embedded in the eslint configuration. It seems possible, be aware of side effects: see https://github.com/prettier/eslint-plugin-prettier/tree/v5.0.0#options
  • see if https://github.com/prettier/eslint-config-prettier can help
  • https://prettier.io/docs/en/integrating-with-linters.html for inconvenient of such a solution but
    • we are already using https://github.com/prettier/eslint-plugin-prettier
    • this seems to be the only way to share a single configuration

Editor configuration

Notice plugin (license header)

  • it is currently stored in a dedicated configuration file. Investigate if it can be integrated in a shared eslint configuration

Editor configuration

  • a .editorconfig file exists in the repo to provide some styling config for JS/TS and documentation (markdown, adoc, ...)
  • See if it can be shared or removed in favor of prettier/eslint or other configuration -Find alternatives for (see below)

Review the configuration of the demo repositories (xo) and evaluate adding new rules

  • https://github.com/process-analytics/bpmn-visualization-demo-template/
  • https://github.com/process-analytics/bonita-day-demo-2023

Alternatives for .editorconfig

We may need to introduce linter for markdown and AsciiDoc

  • https://github.com/eslint/eslint-plugin-markdown (support linting JS/TS code present in markdown)
  • https://www.npmjs.com/package/eslint-plugin-markdownlint 
  • https://github.com/DavidAnson/markdownlint: for a direct execution outside
  • https://github.com/remarkjs/remark-lint#what-is-this

Share the configuration

Create a dedicated repository to host the shared configuration

tbouffard avatar Jul 19 '23 05:07 tbouffard