Skip to content

Commit 9ae85b2

Browse files
committedDec 20, 2022
eslintrc
1 parent 427c518 commit 9ae85b2

File tree

2 files changed

+65
-7
lines changed

2 files changed

+65
-7
lines changed
 

‎.eslintrc

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"extends": ["react-app", "prettier", "plugin:jsx-a11y/recommended"],
3+
"plugins": ["prettier", "react-hooks", "jsx-a11y"],
4+
"env": {
5+
"es6": true,
6+
"browser": true,
7+
"node": true,
8+
"mocha": true,
9+
"jasmine": true
10+
},
11+
"parser": "babel-eslint",
12+
"parserOptions": {
13+
"ecmaVersion": 6,
14+
"sourceType": "module",
15+
"ecmaFeatures": {
16+
"legacyDecorators": true
17+
}
18+
},
19+
"rules": {
20+
"import/no-unresolved": 1,
21+
"no-alert": 1,
22+
"no-console": 1,
23+
"no-debugger": 1,
24+
"prettier/prettier": [
25+
"error",
26+
{ "trailingComma": "all", "singleQuote": true }
27+
],
28+
"react-hooks/rules-of-hooks": "error",
29+
"react-hooks/exhaustive-deps": "warn"
30+
},
31+
"settings": {
32+
"import/resolver": {
33+
"alias": {
34+
"map": [["@plone/volto", "./src"]],
35+
"extensions": [".js", ".jsx", ".json"]
36+
},
37+
"babel-plugin-root-import": {
38+
"rootPathSuffix": "src"
39+
}
40+
},
41+
"import/core-modules": [ "load-volto-addons" ]
42+
},
43+
"globals": {
44+
"root": true,
45+
"__DEVELOPMENT__": true,
46+
"__CLIENT__": true,
47+
"__SERVER__": true,
48+
"__DISABLE_SSR__": true,
49+
"__DEVTOOLS__": true,
50+
"__DEBUG__": true,
51+
"__SSR__": true,
52+
"__SENTRY__": true,
53+
"cy": true,
54+
"Cypress": true,
55+
"jest": true,
56+
"socket": true,
57+
"webpackIsomorphicTools": true
58+
}
59+
}

‎.project.eslintrc.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
const fs = require('fs');
22
const path = require('path');
33

4-
const projectRootPath = fs.realpathSync('./project'); // __dirname
5-
const packageJson = require(path.join(projectRootPath, 'package.json'));
6-
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;
4+
const projectRootPath = fs.realpathSync('./project'); // __dirname
5+
// const packageJson = require(path.join(projectRootPath, 'package.json'));
6+
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json'))
7+
.compilerOptions;
78

89
const pathsConfig = jsConfig.paths;
910

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

12-
Object.keys(pathsConfig).forEach(pkg => {
13+
Object.keys(pathsConfig).forEach((pkg) => {
1314
if (pkg === '@plone/volto') {
1415
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`;
1516
}
@@ -18,12 +19,11 @@ const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
1819
const reg = new AddonConfigurationRegistry(projectRootPath);
1920

2021
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
21-
const addonAliases = Object.keys(reg.packages).map(o => [
22+
const addonAliases = Object.keys(reg.packages).map((o) => [
2223
o,
2324
reg.packages[o].modulePath,
2425
]);
2526

26-
2727
module.exports = {
2828
extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
2929
settings: {
@@ -43,4 +43,3 @@ module.exports = {
4343
},
4444
},
4545
};
46-

0 commit comments

Comments
 (0)
Please sign in to comment.