Skip to content

Commit

Permalink
Update eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
sneridagh committed Apr 30, 2024
1 parent b830ccf commit e02df51
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (configFile) {
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
}

const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
const AddonConfigurationRegistry = require('@plone/registry/src/addon-registry');
const reg = new AddonConfigurationRegistry(__dirname);

// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
Expand All @@ -27,23 +27,31 @@ const addonAliases = Object.keys(reg.packages).map((o) => [
reg.packages[o].modulePath,
]);

module.exports = {
const addonExtenders = reg.getEslintExtenders().map((m) => require(m));

const defaultConfig = {
extends: `${voltoPath}/.eslintrc`,
settings: {
'import/resolver': {
alias: {
map: [
['@plone/volto', '@plone/volto/src'],
...addonAliases,
['@package', `${__dirname}/src`],
['@root', `${__dirname}/src`],
['~', `${__dirname}/src`],
],
extensions: ['.js', '.jsx', '.json'],
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
},
'babel-plugin-root-import': {
rootPathSuffix: 'src',
},
},
},
};

const config = addonExtenders.reduce(
(acc, extender) => extender.modify(acc),
defaultConfig,
);

module.exports = config;

0 comments on commit e02df51

Please sign in to comment.