Skip to content

Commit

Permalink
fix(build): npm updates (#420)
Browse files Browse the repository at this point in the history
* linting config, chartArea, rhsmServices, jsdoc formating
* testing, router, platform component check test expanded
  • Loading branch information
cdcabrera committed Oct 26, 2020
1 parent 5241fcd commit fdb15a3
Show file tree
Hide file tree
Showing 10 changed files with 787 additions and 782 deletions.
17 changes: 16 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@
"prettier",
"react"
],
"settings": {
"jsdoc": {
"preferredTypes": {
"delete": "delete",
"get": "get",
"post": "post",
"put": "put",
"json": "json",
"text": "text",
"delayResponse": "DelayResponse",
"forceStatus": "ForceStatus",
"randomSuccess": "RandomSuccess"
}
}
},
"extends": [
"react-app",
"airbnb",
Expand Down Expand Up @@ -46,7 +61,7 @@
],
"import/no-named-as-default": 0,
"import/no-named-as-default-member": 0,
"jest/no-test-callback": 0,
"jest/no-done-callback": 0,
"jest/prefer-to-have-length": 0,
"jsdoc/check-tag-names": [
2,
Expand Down
54 changes: 27 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,31 +99,31 @@
"test:local": "react-scripts test --env=jsdom --roots=./src"
},
"dependencies": {
"@patternfly/patternfly": "4.23.3",
"@patternfly/react-charts": "6.6.0",
"@patternfly/react-core": "4.32.1",
"@patternfly/react-icons": "4.5.0",
"@patternfly/react-styles": "4.5.0",
"@patternfly/react-table": "4.12.1",
"@patternfly/react-tokens": "4.6.0",
"@redhat-cloud-services/frontend-components": "2.3.13",
"@redhat-cloud-services/frontend-components-notifications": "2.1.1",
"@redhat-cloud-services/frontend-components-utilities": "2.1.0",
"axios": "^0.19.2",
"c3": "^0.7.18",
"@patternfly/patternfly": "4.35.2",
"@patternfly/react-charts": "6.9.6",
"@patternfly/react-core": "4.47.0",
"@patternfly/react-icons": "4.7.4",
"@patternfly/react-styles": "4.7.3",
"@patternfly/react-table": "4.16.7",
"@patternfly/react-tokens": "4.9.6",
"@redhat-cloud-services/frontend-components": "2.4.5",
"@redhat-cloud-services/frontend-components-notifications": "2.2.1",
"@redhat-cloud-services/frontend-components-utilities": "2.2.1",
"axios": "^0.20.0",
"c3": "^0.7.20",
"classnames": "^2.2.6",
"i18next": "^19.6.2",
"i18next": "^19.7.0",
"i18next-xhr-backend": "^3.2.2",
"js-cookie": "^2.2.1",
"locale-code": "^2.0.2",
"lodash": "^4.17.19",
"lodash": "^4.17.20",
"moment": "^2.27.0",
"node-sass": "^4.14.1",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-i18next": "^11.7.0",
"react-redux": "^7.2.0",
"react-i18next": "^11.7.2",
"react-redux": "^7.2.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
Expand All @@ -132,32 +132,32 @@
"redux-promise-middleware": "^6.1.2",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"victory": "^35.0.5",
"victory-core": "^35.0.5",
"victory-legend": "^35.0.5"
"victory": "^35.0.9",
"victory-core": "^35.0.8",
"victory-legend": "^35.0.8"
},
"devDependencies": {
"apidoc-mock": "^3.0.2",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"enzyme-adapter-react-16": "^1.15.4",
"enzyme-to-json": "^3.5.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^23.18.0",
"eslint-plugin-jsdoc": "^29.2.0",
"eslint-plugin-json": "^2.1.1",
"eslint-plugin-jest": "^24.0.0",
"eslint-plugin-jsdoc": "^30.4.0",
"eslint-plugin-json": "^2.1.2",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^4.0.8",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.0",
"express": "^4.17.1",
"glob": "^7.1.6",
"moxios": "^0.4.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.5",
"prettier": "^2.1.1",
"redux-mock-store": "^1.5.4",
"standard-version": "^8.0.2",
"standard-version": "^9.0.0",
"swagger-ui-express": "^4.1.4",
"yamljs": "^0.3.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,12 @@ exports[`ChartArea Component should allow tick formatting: x tick format 1`] = `
</g>
<g>
<g
clip-path="url(#victory-clip-2)"
clip-path="url(#victory-clip-4)"
style="height:100%;width:100%;user-select:none"
>
<defs>
<clipPath
id="victory-clip-2"
id="victory-clip-4"
>
<rect
height="175"
Expand Down Expand Up @@ -665,12 +665,12 @@ exports[`ChartArea Component should allow tick formatting: y tick format 1`] = `
</g>
<g>
<g
clip-path="url(#victory-clip-1)"
clip-path="url(#victory-clip-2)"
style="height:100%;width:100%;user-select:none"
>
<defs>
<clipPath
id="victory-clip-1"
id="victory-clip-2"
>
<rect
height="175"
Expand Down
1 change: 0 additions & 1 deletion src/components/chartArea/chartArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { helpers } from '../../common';
* @fires onHide
* @fires onRevert
* @fires onToggle
* @param id
*/
class ChartArea extends React.Component {
state = { chartWidth: 0 };
Expand Down
106 changes: 82 additions & 24 deletions src/components/router/__tests__/__snapshots__/router.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Router Component should handle unique route settings: settings 1`] = `
<Suspense
fallback={
<Loader
skeletonProps={
Object {
"size": "sm",
}
}
tableProps={Object {}}
variant="title"
/>
<Router
routes={
Array [
Object {
"component": [Function],
"disabled": false,
"exact": false,
"redirect": false,
"render": false,
"title": "Lorem",
"to": "/lorem",
},
Object {
"activateOnError": true,
"component": [Function],
"disabled": false,
"exact": false,
"redirect": false,
"render": false,
"title": "Ipsum",
"to": "/ipsum",
},
]
}
>
<Switch>
Expand All @@ -28,7 +40,7 @@ exports[`Router Component should handle unique route settings: settings 1`] = `
path="/ipsum"
/>
</Switch>
</Suspense>
</Router>
`;

exports[`Router Component should pass customized props to routed components: routeDetail and location parsedSearch props 1`] = `
Expand Down Expand Up @@ -65,17 +77,63 @@ Object {
`;

exports[`Router Component should render a basic component: basic 1`] = `
<Suspense
fallback={
<Loader
skeletonProps={
Object {
"size": "sm",
}
}
tableProps={Object {}}
variant="title"
/>
<Router
routes={
Array [
Object {
"component": Object {
"$$typeof": Symbol(react.lazy),
"_ctor": [Function],
"_result": null,
"_status": -1,
},
"disabled": false,
"exact": true,
"redirect": true,
"render": true,
"to": "/rhel-sw/all",
},
Object {
"component": Object {
"$$typeof": Symbol(react.lazy),
"_ctor": [Function],
"_result": null,
"_status": -1,
},
"disabled": false,
"exact": true,
"id": "rhel-sw",
"render": true,
"to": "/rhel-sw/:variant",
},
Object {
"component": Object {
"$$typeof": Symbol(react.lazy),
"_ctor": [Function],
"_result": null,
"_status": -1,
},
"disabled": false,
"exact": true,
"id": "openshift-sw",
"render": true,
"to": "/openshift-sw",
},
Object {
"activateOnError": true,
"component": Object {
"$$typeof": Symbol(react.lazy),
"_ctor": [Function],
"_result": null,
"_status": -1,
},
"disabled": false,
"exact": true,
"id": "optin",
"render": true,
"to": "/optin",
},
]
}
>
<Switch>
Expand Down Expand Up @@ -107,5 +165,5 @@ exports[`Router Component should render a basic component: basic 1`] = `
to="/rhel-sw/all"
/>
</Switch>
</Suspense>
</Router>
`;
2 changes: 1 addition & 1 deletion src/redux/actions/platformActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
addNotification as RcsAddNotification,
removeNotification as RcsRemoveNotification,
clearNotifications as RcsClearNotifications
} from '@redhat-cloud-services/frontend-components-notifications';
} from '@redhat-cloud-services/frontend-components-notifications/cjs';
import { platformTypes } from '../types';
import { platformServices } from '../../services/platformServices';

Expand Down
14 changes: 7 additions & 7 deletions src/services/rhsmServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ const getApiVersion = () =>
*
* Reference [RHSM for report params and commands](https://github.com/RedHatInsights/rhsm-subscriptions/blob/master/api/rhsm-subscriptions-api-spec.yaml)
*
* @apiParam {Enum} product_id The ID for the product we wish to query.
* @apiParam {string} product_id The ID for the product we wish to query.
* - RHEL
*
* @apiParam (Query string) {Enum} granularity The level of granularity to return.
* @apiParam (Query string) {string} granularity The level of granularity to return.
* - DAILY
* - WEEKLY
* - MONTHLY
Expand All @@ -68,17 +68,17 @@ const getApiVersion = () =>
* @apiParam (Query string) {Number} [offset] The number of items to skip before starting to collect the result set.
*
* @apiSuccess {Array} data
* @apiSuccess {Object} links
* @apiSuccess {Object} meta
* @apiSuccess {Enum} meta.granularity
* @apiSuccess {object} links
* @apiSuccess {object} meta
* @apiSuccess {string} meta.granularity
* - DAILY
* - WEEKLY
* - MONTHLY
* - QUARTERLY
* - YEARLY
* @apiSuccess {Enum} meta.product
* @apiSuccess {string} meta.product
* - RHEL
* @apiSuccess {Number} meta.resultSetSize
* @apiSuccess {number} meta.resultSetSize
*
* @apiSuccessExample {json} DAILY, Success-Response:
* HTTP/1.1 200 OK
Expand Down
14 changes: 13 additions & 1 deletion tests/__snapshots__/platform.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,16 @@ Array [
]
`;
exports[`Platform Configuration, Build should use direct imports for platform components, with exceptions: direct import exceptions 1`] = `Array []`;
exports[`Platform Configuration, Build should use direct imports for platform components, with exceptions: direct import exceptions, components 1`] = `Array []`;
exports[`Platform Configuration, Build should use direct imports for platform components, with exceptions: import exceptions, notifications 1`] = `
Array [
"index.js:9:import '@redhat-cloud-services/frontend-components-notifications/index.css';",
]
`;
exports[`Platform Configuration, Build should use direct imports for platform components, with exceptions: import exceptions, utilities 1`] = `
Array [
"styles/index.scss:2:@import '~@redhat-cloud-services/frontend-components-utilities/files/Utilities/_all';",
]
`;
30 changes: 27 additions & 3 deletions tests/platform.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,40 @@ describe('Platform Configuration, Build', () => {

it('should use direct imports for platform components, with exceptions', () => {
const srcDir = 'src';
const output = execSync(
const componentsOutput = execSync(
`echo "$(cd ./${srcDir} && git grep -n -E "(@redhat-cloud-services/frontend-components/components/)")"`
);

expect(
output
componentsOutput
.toString()
.trim()
.split(/[\n\r]/g)
.filter(str => !/\/(cjs|esm)\//.test(str))
).toMatchSnapshot('direct import exceptions');
).toMatchSnapshot('direct import exceptions, components');

const notificationsOutput = execSync(
`echo "$(cd ./${srcDir} && git grep -n -E "(@redhat-cloud-services/frontend-components-notifications)")"`
);

expect(
notificationsOutput
.toString()
.trim()
.split(/[\n\r]/g)
.filter(str => !/\/(cjs|esm)/.test(str))
).toMatchSnapshot('import exceptions, notifications');

const utilitiesOutput = execSync(
`echo "$(cd ./${srcDir} && git grep -n -E "(@redhat-cloud-services/frontend-components-utilities)")"`
);

expect(
utilitiesOutput
.toString()
.trim()
.split(/[\n\r]/g)
.filter(str => !/\/(cjs|esm)/.test(str))
).toMatchSnapshot('import exceptions, utilities');
});
});
Loading

0 comments on commit fdb15a3

Please sign in to comment.