1
1
const fs = require ( 'fs' ) ;
2
2
const projectRootPath = __dirname ;
3
- const AddonConfigurationRegistry = require ( '@plone/registry/src /addon-registry' ) ;
3
+ const { AddonRegistry } = require ( '@plone/registry/addon-registry' ) ;
4
4
5
5
let coreLocation ;
6
6
if ( fs . existsSync ( `${ projectRootPath } /core` ) )
7
7
coreLocation = `${ projectRootPath } /core` ;
8
8
else if ( fs . existsSync ( `${ projectRootPath } /../../core` ) )
9
9
coreLocation = `${ projectRootPath } /../../core` ;
10
10
11
- const registry = new AddonConfigurationRegistry (
12
- `${ coreLocation } /packages/volto` ,
13
- ) ;
11
+ const { registry } = AddonRegistry . init ( `${ coreLocation } /packages/volto` ) ;
14
12
15
13
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
16
14
const addonAliases = Object . keys ( registry . packages ) . map ( ( o ) => [
@@ -22,6 +20,27 @@ module.exports = {
22
20
extends : `${ coreLocation } /packages/volto/.eslintrc` ,
23
21
rules : {
24
22
'import/no-unresolved' : 1 ,
23
+ 'import/named' : 'error' ,
24
+ 'react/jsx-filename-extension' : [ 1 , { extensions : [ '.tsx' , '.jsx' ] } ] ,
25
+ 'no-restricted-imports' : [
26
+ 'error' ,
27
+ {
28
+ name : '@plone/volto/components' ,
29
+ message :
30
+ 'Importing from barrel files is not allowed. Please use direct imports of the modules instead.' ,
31
+ } ,
32
+ {
33
+ name : '@plone/volto/helpers' ,
34
+ message :
35
+ 'Importing from barrel files is not allowed. Please use direct imports of the modules instead.' ,
36
+ } ,
37
+ {
38
+ name : '@plone/volto/actions' ,
39
+ message :
40
+ 'Importing from barrel files is not allowed. Please use direct imports of the modules instead.' ,
41
+ } ,
42
+ ] ,
43
+ 'react/jsx-key' : [ 2 , { checkFragmentShorthand : true } ] ,
25
44
} ,
26
45
settings : {
27
46
'import/resolver' : {
0 commit comments