Skip to main content

Development

Linting#

For linting and formatting Ruby and JavaScript, RuboCop and ESLint are used respectively. They can be used with the following commands from inside a Chemotion ELN installation directory. The flags -a or -x for rubocop and --fix for ESLint are for correcting and therefore changing the code. Without the flags errors or warnings are displayed without changes to the code.

rubocop [-a | -x] [paths]
yarn run eslint [--fix] [paths]

When ESLint detects linting errors, it finishes by default with exit code 1. This can be lead to scripts being terminated with error codes in some environments (e. g. GitHub Actions). To avoid this the eslint-plugin-only-warn can be added via yarn which returns warnings instead of errors. The plugin needs to be activated with a flag in the ESLint command:

yarn run eslint --plugin eslint-plugin-only-warn [--fix] [paths]

There are Linting extensions for Visual Studio Code available.

Tools recommended for development#

Visual Studio Code#

Vim#

Check https://github.com/dense-analysis/ale.

Webpack#

Debug#

The webpack configurations can be printed to the node console via:

RAILS_ENV=test node -e 'console.dir(require("config/webpack/test"), { depth: null })'
Last updated on by Jan C. Brammer