Linters – Effective Volto – Development tools

Linters

Linters#

Volto provides working configuration for the following linters:

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',
    )[1];

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

    return defaultConfig;
  },
};

Prettier#

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

Stylelint#

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