Skip to content

Commit 834236b

Browse files
committed
Improve resilience of ESlint config. Move to do not use barrel imports.
1 parent a2bcd01 commit 834236b

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

.eslintrc.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,27 @@ module.exports = {
1111
extends: `${coreLocation}/packages/volto/.eslintrc`,
1212
rules: {
1313
'import/no-unresolved': 1,
14+
'import/named': 'error',
15+
'react/jsx-filename-extension': [1, { extensions: ['.tsx', '.jsx'] }],
16+
'no-restricted-imports': [
17+
'error',
18+
{
19+
name: '@plone/volto/components',
20+
message:
21+
'Importing from barrel files is not allowed. Please use direct imports of the modules instead.',
22+
},
23+
{
24+
name: '@plone/volto/helpers',
25+
message:
26+
'Importing from barrel files is not allowed. Please use direct imports of the modules instead.',
27+
},
28+
{
29+
name: '@plone/volto/actions',
30+
message:
31+
'Importing from barrel files is not allowed. Please use direct imports of the modules instead.',
32+
},
33+
],
34+
'react/jsx-key': [2, { checkFragmentShorthand: true }],
1435
},
1536
settings: {
1637
'import/resolver': {
@@ -24,7 +45,7 @@ module.exports = {
2445
['@plone/registry', `${coreLocation}/packages/registry/src`],
2546
[
2647
'@kitconcept/volto-separator-block',
27-
'./packages/volto-separator-block/src',
48+
`${projectRootPath}/packages/volto-separator-block/src`,
2849
],
2950
],
3051
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],

packages/volto-separator-block/src/components/Data.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { useIntl } from 'react-intl';
3-
import { BlockDataForm } from '@plone/volto/components';
3+
import { BlockDataForm } from '@plone/volto/components/manage/Form';
44
import { SeparatorSchema } from './schema';
55

66
const SeparatorData = (props) => {

packages/volto-separator-block/src/components/Edit.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { SidebarPortal } from '@plone/volto/components';
2+
import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
33
import Data from './Data';
44
import View from './View';
55

0 commit comments

Comments
 (0)