11. Linters – Effective Volto – Development tools

11. Linters#

Volto provides working configuration for the following linters:

11.1. ESlint#

eslint is used for JavaScript code checking. A working .eslintrc.js file is shipped with every Volto project. In your addons, you can customize the ESLint configuration by including a eslint.extend.js file. For example this file adds a new path to eslint's resolve alias map:

const path = require('path');

module.exports = {
  modify(defaultConfig) {
    const aliasMap = defaultConfig.settings['import/resolver'].alias.map;
    const addonPath = aliasMap.find(
      ([name]) => name === '@eeacms/volto-searchlib',

    const searchlibPath = path.resolve(`${addonPath}/../searchlib`);
    aliasMap.push(['@eeacms/search', searchlibPath]);

    return defaultConfig;

11.2. Prettier#

Volto integrates prettier for code formatting, in the form of an eslint plugin.

11.3. Stylelint#

Volto integrates stylelint for CSS/Less/SCSS code linting.