Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
add missing eslintrc.js
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiggr committed Dec 15, 2022
1 parent 0e19006 commit f4b2e25
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
44 changes: 44 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const fs = require('fs');
const path = require('path');

const projectRootPath = fs.realpathSync('./project'); // __dirname
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json'))
.compilerOptions;

const pathsConfig = jsConfig.paths;

let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');

Object.keys(pathsConfig).forEach((pkg) => {
if (pkg === '@plone/volto') {
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`;
}
});
const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
const reg = new AddonConfigurationRegistry(projectRootPath);

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

module.exports = {
extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
settings: {
'import/resolver': {
alias: {
map: [
['@plone/volto', '@plone/volto/src'],
...addonAliases,
['@package', `${__dirname}/src`],
['~', `${__dirname}/src`],
],
extensions: ['.js', '.jsx', '.json'],
},
'babel-plugin-root-import': {
rootPathSuffix: 'src',
},
},
},
};
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.vscode/
.history
.eslintrc.js
nyc_output
project
coverage
Expand Down
1 change: 0 additions & 1 deletion .project.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const fs = require('fs');
const path = require('path');

const projectRootPath = fs.realpathSync('./project'); // __dirname
const packageJson = require(path.join(projectRootPath, 'package.json'));
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;

const pathsConfig = jsConfig.paths;
Expand Down
3 changes: 0 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,18 @@ pipeline {

"ES lint": {
node(label: 'docker') {
sh '''docker pull plone/volto-addon-ci:alpha'''
sh '''docker run -i --rm --name="$BUILD_TAG-eslint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha eslint'''
}
},

"Style lint": {
node(label: 'docker') {
sh '''docker pull plone/volto-addon-ci:alpha'''
sh '''docker run -i --rm --name="$BUILD_TAG-stylelint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha stylelint'''
}
},

"Prettier": {
node(label: 'docker') {
sh '''docker pull plone/volto-addon-ci:alpha'''
sh '''docker run -i --rm --name="$BUILD_TAG-prettier" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha prettier'''
}
}
Expand Down

0 comments on commit f4b2e25

Please sign in to comment.