Code guide

To assure that the source code remains consistent regardless of the amount of contributors, a set of code principles has been established.

The current set of main code principles within JS, CSS, Typography and testing are located in the UI Library - Best practices. Below is more related to further developing the Eufemia repository.

Recommended Tools

Other helpful tools:

Linting

JavaScript and Style linting is mandatory for merging commits in Eufemia. During a commit (locally), your commit content (code) will be tested with both static and integration tests. You may run yarn test or yarn test:update before you try to commit. You may also write new tests for your code before committing.

The Code Base is based on several Static Tests to help the code to be uniform:

  • Prettier
  • ESLint
  • StyleLint

You may consider to install plugins for your editor of choice - to visualize and run the code formatters and linters based on the given config files. This way you can immediately see how the code will and have to consist.

Either include the plugins in your code editor, or run the following command after you made changes:

# In workspace dnb-design-system-portal or dnb-eufemia
yarn lint:js && yarn lint:styles

Fix the resulted warnings and error before you commit and merge.