View source | Discuss this page | Page history | Printable version   
Toolbox
Main Page
Upload file
What links here
Recent changes
Help

PDF Books
Add page
Show collection (0 pages)
Collections help

Search

How To Setup ESLint And Prettier In Your IDE

Contents

Introduction

Starting from PR19Q3, Openbravo uses Prettier as their Javascript formatter and ESLint as their linting tool. Among its advantages, both are supported by mosts of modern IDEs, so they can be configured to check linting as you code and properly format files when saving.

Eclipse

There is no known plugins to add support for ESLint or Prettier. However, built in Openbravo scripts can still be used.

Visual Studio Code

Visual Studio Code supports both ESLint and Prettier via extensions:

VSCodeExtensions.png

To setup ESLint, it is required to define the location of the node_modules folder used by Openbravo. In settings.json:

{
...
  "eslint.nodePath": "<path_to_openbravo>/modules/org.openbravo.client.kernel/",
...
}

For Prettier, in order to use our config file to format, the following option should be enabled: "Prettier: Require Config", or in settings.json:

{
...
  "prettier.requireConfig": true,
...
}

IntelliJ

IntelliJ Ultimate has built-in support of ESLint and supports Prettier via Plugin.

IntelliJESLintConfig.png

IntelliJPrettierConfig.png

Sublime Text

ESLint just works by installing SublimeLinter and then SublimeLinter-eslint packages using PackageControl.

Prettier can be used by installing the package JsPrettier in PackageControl. By default, this plugin will search for the Prettier CLI in the following order:

If none applies, it is required to introduce the path of the Prettier CLI in JsPrettier settings (Preferences|Package Settings|JsPrettier):

{
...
  "prettier_cli_path": "<path_to_openbravo>/modules/org.openbravo.client.kernel/node_modules/.bin/prettier",
...
}

Atom

Atom supports both ESLint and Prettier via packages.

Retrieved from "http://wiki.openbravo.com/wiki/How_To_Setup_ESLint_And_Prettier_In_Your_IDE"

This page has been accessed 111 times. This page was last modified on 12 June 2019, at 07:22. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.