Skip to content

Commit

Permalink
Fix deps and some lint for packages folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien LE MOUILLOUR committed Nov 10, 2023
1 parent 46724c1 commit a170767
Show file tree
Hide file tree
Showing 48 changed files with 189 additions and 81 deletions.
13 changes: 11 additions & 2 deletions packages/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,21 @@
},
"dependencies": {
"@talend/utils": "^2.7.0",
"keycode": "^2.2.1",
"lodash": "^4.17.21"
"keycode": "^2.2.1"
},
"devDependencies": {
"@talend/eslint-config": "^12.2.0",
"@talend/eslint-plugin": "^1.0.1",
"@talend/scripts-core": "^16.1.0",
"@talend/scripts-config-typescript": "^11.1.0",
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^13.5.0",
"@types/date-fns": "^0.0.2",
"@types/jest": "^29.5.5",
"@types/react": "^18.2.37",
"@types/react-dom": "^17.0.20",
"date-fns": "^1.30.1",
"jest-in-case": "^1.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/a11y/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"allowJs": false,
"declaration": true,
"target": "ES5",
"module": "CommonJs"
"module": "CommonJs",
"types": ["jest", "@testing-library/jest-dom"]
}
}
6 changes: 6 additions & 0 deletions packages/assets-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@
},
"dependencies": {},
"devDependencies": {
"@talend/babel-plugin-import-from-index": "^1.5.1",
"@talend/eslint-config": "^12.2.0",
"@talend/eslint-plugin": "^1.0.1",
"@talend/scripts-core": "^16.1.0",
"@talend/scripts-config-react-webpack": "^16.2.0",
"@talend/scripts-config-typescript": "^11.1.0",
"@types/node": "^6.14.13",
"@types/jest": "^29.5.5",
"read-pkg-up": "^7.0.1"
},
"publishConfig": {
Expand Down
20 changes: 9 additions & 11 deletions packages/assets-api/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import readPackageUp from 'read-pkg-up';
import assetsApi, { Asset } from '.';

const iconsInfo = readPackageUp.sync({ cwd: require.resolve('@talend/icons') });
const currentInfo = readPackageUp.sync({ cwd: __dirname });
const bundlePath = '/dist/svg-bundles/all.svg';

Expand All @@ -12,28 +11,27 @@ describe('assets-api', () => {
});

it('should return unpkg url', () => {
const url = assetsApi.getURL(bundlePath, '@talend/icons', iconsInfo?.packageJson.version);
expect(url).toBe(
`https://unpkg.com/@talend/icons@${iconsInfo?.packageJson.version}${bundlePath}`,
);
const url = assetsApi.getURL(bundlePath, '@talend/icons', '6.60.1');
expect(url).toBe(`https://unpkg.com/@talend/[email protected]${bundlePath}`);
});

it('should return /cdn url', () => {
const original = window.Talend.CDN_URL;
window.Talend.CDN_URL = '/cdn';
const url = assetsApi.getURL(bundlePath, '@talend/icons', iconsInfo?.packageJson.version);
expect(url).toBe(`/cdn/@talend/icons/${iconsInfo?.packageJson.version}${bundlePath}`);
const url = assetsApi.getURL(bundlePath, '@talend/icons', '6.60.1');
expect(url).toBe(`/cdn/@talend/icons/6.60.1${bundlePath}`);
window.Talend.CDN_URL = original;
});

it('should prevent // as start url', () => {
const original = window.Talend.CDN_URL;
window.Talend.CDN_URL = '/cdn';
const mockedBaseElement = { getAttribute: jest.fn().mockReturnValueOnce('/') };
// @ts-ignore
const mockedBaseElement = {
getAttribute: jest.fn().mockReturnValueOnce('/'),
} as unknown as Element;
jest.spyOn(document, 'querySelector').mockImplementation(() => mockedBaseElement);
const url = assetsApi.getURL(bundlePath, '@talend/icons', iconsInfo?.packageJson.version);
expect(url).toBe(`/cdn/@talend/icons/${iconsInfo?.packageJson.version}${bundlePath}`);
const url = assetsApi.getURL(bundlePath, '@talend/icons', '6.60.1');
expect(url).toBe(`/cdn/@talend/icons/6.60.1${bundlePath}`);
window.Talend.CDN_URL = original;
});

Expand Down
2 changes: 1 addition & 1 deletion packages/cmf/src/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function getActionObject(context, action, event, data) {
*/
function getOnProps(props) {
return Object.keys(props).filter(
name => ({}.hasOwnProperty.call(props, name) && /^on.+/.test(name)),
name => ({}).hasOwnProperty.call(props, name) && /^on.+/.test(name),
);
}

Expand Down
5 changes: 4 additions & 1 deletion packages/cmf/src/reduxstorage/reduxLocalStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import createEngine from 'redux-storage-engine-localstorage';
import filter from 'redux-storage-decorator-filter';
import immutablejs from './redux-storage-decorator-immutablejs';

const CMF_IMMUTABLE_PATHS = [['cmf', 'components'], ['cmf', 'collections']];
const CMF_IMMUTABLE_PATHS = [
['cmf', 'components'],
['cmf', 'collections'],
];

const CMF_MIDDLEWARE_BLACK_LIST = ['@@INIT', '@@router/LOCATION_CHANGE'];

Expand Down
4 changes: 4 additions & 0 deletions packages/containers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@
"@storybook/addon-actions": "^7.5.3",
"@talend/bootstrap-theme": "^8.2.1",
"@talend/icons": "^7.1.0",
"@talend/locales-tui-components": "^11.4.5",
"@talend/locales-tui-containers": "^9.1.3",
"@talend/locales-tui-forms": "^10.2.4",
"@talend/locales-design-system": "^7.15.1",
"@talend/react-storybook-cmf": "^8.1.0",
"@talend/eslint-config": "^12.2.0",
"@talend/eslint-plugin": "^1.0.1",
Expand All @@ -65,6 +68,7 @@
"@testing-library/user-event": "^13.5.0",
"i18next": "^23.6.0",
"jest-in-case": "^1.0.2",
"msw": "^1.3.2",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
31 changes: 15 additions & 16 deletions packages/containers/src/ConfirmDialog/ConfirmDialog.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,21 @@ import { showConfirmDialog, hideConfirmDialog } from './showHideConfirmDialog';
jest.mock(
'@talend/react-components/lib/ConfirmDialog',
() =>
({ cancelAction, validateAction, show, ...props }) =>
(
<div
data-testid="ConfirmDialog"
className="tc-confirm-dialog"
{...props}
aria-hidden={(!show).toString()}
>
<button data-testid="cancelAction" onClick={cancelAction.onClick}>
cancelAction.label
</button>
<button data-testid="validateAction" onClick={validateAction.onClick}>
validateAction.label
</button>
</div>
),
({ cancelAction, validateAction, show, ...props }) => (
<div
data-testid="ConfirmDialog"
className="tc-confirm-dialog"
{...props}
aria-hidden={(!show).toString()}
>
<button data-testid="cancelAction" onClick={cancelAction.onClick}>
cancelAction.label
</button>
<button data-testid="validateAction" onClick={validateAction.onClick}>
validateAction.label
</button>
</div>
),
);
jest.unmock('@talend/design-system');

Expand Down
29 changes: 16 additions & 13 deletions packages/containers/src/cmfModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@ import { cmfConnect } from '@talend/react-cmf';
import * as allComponents from '@talend/react-components';
import * as containers from './containers';

const components = Object.keys(allComponents).reduce((acc, key) => {
if (!acc[key] && typeof allComponents[key] === 'function') {
const options = {};
if (['ActionList', 'AppSwitcher', 'Layout', 'RichLayout', 'Dialog'].includes(key)) {
options.withComponentRegistry = true;
const components = Object.keys(allComponents).reduce(
(acc, key) => {
if (!acc[key] && typeof allComponents[key] === 'function') {
const options = {};
if (['ActionList', 'AppSwitcher', 'Layout', 'RichLayout', 'Dialog'].includes(key)) {
options.withComponentRegistry = true;
}
if (!allComponents[key].displayName) {
allComponents[key].displayName = key;
}
// eslint-disable-next-line no-param-reassign
acc[key] = cmfConnect(options)(allComponents[key]);
}
if (!allComponents[key].displayName) {
allComponents[key].displayName = key;
}
// eslint-disable-next-line no-param-reassign
acc[key] = cmfConnect(options)(allComponents[key]);
}
return acc;
}, omit(containers, ['actionAPI']));
return acc;
},
omit(containers, ['actionAPI']),
);

export default {
id: 'containers',
Expand Down
1 change: 1 addition & 0 deletions packages/dataviz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"@testing-library/user-event": "^13.5.0",
"@types/classnames": "^2.3.1",
"@types/d3": "^7.4.3",
"@types/cypress": "^1.1.3",
"@types/geojson": "^7946.0.13",
"@types/lodash": "^4.14.201",
"@types/node": "^6.14.13",
Expand Down
2 changes: 1 addition & 1 deletion packages/design-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"@storybook/addons": "^7.5.3",
"@storybook/core-events": "^7.5.3",
"@storybook/preset-scss": "^1.0.3",
"@storybook/react-webpack5": "^7.5.3",
"@storybook/testing-library": "^0.2.2",
"@storybook/testing-react": "^2.0.1",
"@storybook/theming": "^7.5.3",
Expand All @@ -59,6 +58,7 @@
"@talend/locales-tui-forms": "^10.2.4",
"@talend/scripts-core": "^16.1.0",
"@talend/scripts-config-babel": "^13.1.0",
"@talend/scripts-config-react-webpack": "^16.2.0",
"@talend/scripts-config-storybook-lib": "^5.1.0",
"@talend/scripts-config-typescript": "^11.1.0",
"@types/react": "^18.2.37",
Expand Down
1 change: 1 addition & 0 deletions packages/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@storybook/theming": "^7.5.3",
"@svgr/webpack": "^5.5.0",
"@talend/bootstrap-theme": "^8.2.1",
"@talend/design-system": "*",
"@talend/eslint-config": "^12.2.0",
"@talend/eslint-plugin": "^1.0.1",
"@talend/icons": "^7.1.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Canvas, Meta, Story } from '@storybook/addon-docs';

import { FigmaImage, Use } from '@talend/storybook-docs';
import { Form, ToggleSwitch } from '@talend/design-system';

import { Form, ToggleSwitch } from '../../../';

import * as Stories from './ToggleSwitch.stories';

Expand Down
4 changes: 4 additions & 0 deletions packages/design-tokens/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
testEnvironment: 'jest-environment-jsdom',
testRegex: '(/__tests__/.*|src/|scripts/).*\\.test.(js|ts|tsx)$',
};
10 changes: 9 additions & 1 deletion packages/design-tokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,17 @@
"access": "public"
},
"devDependencies": {
"@talend/eslint-config": "^12.2.0",
"@talend/eslint-plugin": "^1.0.1",
"@talend/scripts-core": "^16.1.0",
"@talend/scripts-config-react-webpack": "^16.2.0",
"typeface-source-sans-pro": "^1.1.13"
"@talend/scripts-config-typescript": "^11.1.0",
"@talend/babel-plugin-import-from-index": "^1.5.1",
"@talend/babel-plugin-assets-api": "^1.1.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"typeface-source-sans-pro": "^1.1.13",
"webpack": "^5.88.2"
},
"dependencies": {}
}
13 changes: 11 additions & 2 deletions packages/flow-designer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,25 @@
"author": "Talend <[email protected]>",
"license": "Apache-2.0",
"devDependencies": {
"@talend/babel-plugin-import-from-index": "^1.5.1",
"@talend/babel-plugin-assets-api": "^1.1.0",
"@talend/eslint-config": "^12.2.0",
"@talend/eslint-plugin": "^1.0.1",
"@talend/scripts-config-jest": "^13.0.0",
"@talend/scripts-core": "^16.1.0",
"@talend/scripts-config-typescript": "^11.1.0",
"@talend/scripts-config-react-webpack": "^16.2.0",
"@testing-library/react": "^12.1.5",
"@testing-library/jest-dom": "^5.17.0",
"@types/d3": "^7.4.3",
"@types/enzyme": "^3.10.16",
"@types/invariant": "^2.2.37",
"@types/jest": "^29.5.5",
"@types/lodash": "^4.14.201",
"@types/node": "^6.14.13",
"@types/prop-types": "^15.7.5",
"@types/react": "^18.2.37",
"@types/react-redux": "^7.1.30",
"@types/react-test-renderer": "^18.0.6",
"@types/react": "^18.2.37",
"@types/redux-mock-store": "^1.0.6",
"@types/redux-thunk": "^2.1.0",
"i18next": "^23.6.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@testing-library/jest-dom';
import { fireEvent, render, screen } from '@testing-library/react';

import {
Expand Down
4 changes: 2 additions & 2 deletions packages/flow-designer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"extends": "../../node_modules/@talend/scripts-config-typescript/tsconfig.json",
"extends": "@talend/scripts-config-typescript/tsconfig.json",
"include": ["src/**/*"],
"compilerOptions": {
"declaration": true,
"allowJs": false,
"incremental": true,
"module": "CommonJs",
"typeRoots": ["src/customTypings/index.d", "../../node_modules/@types"]
"typeRoots": ["src/customTypings/index.d", "node_modules/@types"]
}
}
1 change: 1 addition & 0 deletions packages/forms/src/UIForm/Widget/Widget.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import shouldRender from '../utils/condition';
import theme from './Widget.component.module.scss';
import { useWidget } from '../context';

// eslint-disable-next-line @typescript-eslint/default-param-last
function isUpdating(updatingKeys = [], key) {
if (updatingKeys.length === 0 || !key) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
}

// override bootstrap style. This for is needed to write a bigger weight selector
/* stylelint-disable-next-line selector-no-qualifying-type */
form div:not(.has-success):not(.has-warning):not(.has-error).checkbox label {
color: inherit;
font-size: inherit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ class Datalist extends Component {
{...this.state}
dataFeature={this.props.schema.dataFeature}
className="form-control-container"
// eslint-disable-next-line jsx-a11y/no-autofocus
autoFocus={this.props.schema.autoFocus}
disabled={this.props.schema.disabled || this.props.valueIsUpdating}
multiSection={get(this.props, 'schema.options.isMultiSection', false)}
Expand Down
1 change: 1 addition & 0 deletions packages/forms/src/UIForm/fields/Date/Date.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function DateWidget(props) {
valueIsUpdating={valueIsUpdating}
>
<InputDatePicker
// eslint-disable-next-line jsx-a11y/no-autofocus
autoFocus={schema.autoFocus}
dateFormat={options.dateFormat}
disabled={schema.disabled || valueIsUpdating}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default function DateTimeWidget(props) {
>
<InputDateTimePicker
id={id}
// eslint-disable-next-line jsx-a11y/no-autofocus
autoFocus={schema.autoFocus}
disabled={schema.disabled || valueIsUpdating}
readOnly={schema.readOnly}
Expand Down
1 change: 1 addition & 0 deletions packages/forms/src/UIForm/fields/Date/Time.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function TimeWidget({
>
<InputTimePicker
id={id}
// eslint-disable-next-line jsx-a11y/no-autofocus
autoFocus={schema.autoFocus}
disabled={schema.disabled || valueIsUpdating}
readOnly={schema.readOnly}
Expand Down
Loading

0 comments on commit a170767

Please sign in to comment.