From be1213101190d9e4817e4a53fba6be0be0ad827b Mon Sep 17 00:00:00 2001 From: Victor Fernandez de Alba Date: Wed, 24 Apr 2024 12:39:35 +0200 Subject: [PATCH] Fix linting, better handling of the blockModel flag --- .eslintrc.js | 13 ++++++++++++- packages/volto-button-block/src/components/View.jsx | 3 +-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index b36ca12..9d60299 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,5 +1,16 @@ +const fs = require('fs'); +const projectRootPath = __dirname; + +const eslintPath = 'core/packages/volto/.eslintrc'; + +let eslintCoreVoltoConfigFile; +if (fs.existsSync(`${projectRootPath}/${eslintPath}`)) + eslintCoreVoltoConfigFile = `${projectRootPath}/${eslintPath}`; +else if (fs.existsSync(`${projectRootPath}/../../${eslintPath}`)) + eslintCoreVoltoConfigFile = `${projectRootPath}/../../${eslintPath}`; + module.exports = { - extends: './core/packages/volto/.eslintrc', + extends: eslintCoreVoltoConfigFile, rules: { 'import/no-unresolved': 1, }, diff --git a/packages/volto-button-block/src/components/View.jsx b/packages/volto-button-block/src/components/View.jsx index 62a6ba4..11dcc02 100644 --- a/packages/volto-button-block/src/components/View.jsx +++ b/packages/volto-button-block/src/components/View.jsx @@ -3,7 +3,6 @@ import { Button } from 'semantic-ui-react'; import cx from 'classnames'; import { ConditionalLink, MaybeWrap } from '@plone/volto/components'; import { defineMessages, useIntl } from 'react-intl'; -import config from '@plone/volto/registry'; const messages = defineMessages({ ButtonText: { @@ -21,7 +20,7 @@ const LegacyWrapper = (props) => ( const View = ({ data, isEditMode, className, blocksConfig }) => { const [hasLink, setHasLink] = React.useState(false); const intl = useIntl(); - const isBlockModelv3 = blocksConfig?.__button?.v3; + const isBlockModelv3 = blocksConfig?.__button?.blockModel === 3; React.useEffect(() => { if (data.href) {