Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PXP-7942 Feat/newer react #848

Merged
merged 57 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
1b7e259
update package
mfshao Dec 23, 2020
17b7b4a
update lock
mfshao Dec 23, 2020
f593fbe
p
mfshao Jan 4, 2021
f2a0591
Merge branch 'master' into feat/newer-react
mfshao Feb 4, 2021
287d522
update lock
mfshao Feb 5, 2021
18ccc8a
feat: newer react compatiable
mfshao Feb 6, 2021
4480086
update lock
mfshao Feb 6, 2021
a1b15a1
update package
mfshao Feb 6, 2021
e815df3
chore: clean up dep
mfshao Feb 7, 2021
e87fb16
replace slick with carousel
mfshao Feb 7, 2021
ed79fee
fix: tests using jest and enzyme
mfshao Feb 8, 2021
2c81205
chore: update base img
mfshao Feb 8, 2021
dbfee09
fix: remove debug msg
mfshao Feb 8, 2021
b70af2e
Merge branch 'master' into feat/newer-react
mfshao Feb 13, 2021
9ee5dac
update package
mfshao Feb 13, 2021
21c8cd3
Merge branch 'master' into feat/newer-react
mfshao Feb 23, 2021
8942911
update lock
mfshao Feb 23, 2021
9517e97
update relay
mfshao Feb 23, 2021
6384860
update babel
mfshao Feb 28, 2021
d22b22b
Merge branch 'master' into feat/newer-react
mfshao Mar 26, 2021
9b315c9
Merge branch 'master' into feat/newer-react
mfshao Mar 30, 2021
20a127f
update pkg
mfshao Mar 31, 2021
e3a9206
update
mfshao Mar 31, 2021
2845f75
update eslint
mfshao Mar 31, 2021
35b63ac
eslint
mfshao Mar 31, 2021
aa5db8d
eslint
mfshao Mar 31, 2021
9270cbf
eslint
mfshao Mar 31, 2021
7ea70b3
eslint
mfshao Apr 1, 2021
856c243
eslint
mfshao Apr 1, 2021
03e00cd
eslint
mfshao Apr 1, 2021
d7d8da0
update package
mfshao Apr 1, 2021
2c18d6e
eslint
mfshao Apr 2, 2021
409990a
Merge branch 'master' into feat/newer-react
mfshao Apr 20, 2021
4be73e3
update lock
mfshao Apr 20, 2021
f76bf9b
update
mfshao Apr 20, 2021
1373e0e
lint
mfshao Apr 20, 2021
16ff100
lint
mfshao Apr 20, 2021
ab8882a
lint
mfshao Apr 20, 2021
a19e7d4
Merge branch 'master' into feat/newer-react
mfshao Apr 20, 2021
c40f4b1
update lock
mfshao Apr 21, 2021
202cb32
Merge branch 'master' into feat/newer-react
mfshao May 7, 2021
24d3351
lint
mfshao May 7, 2021
de6acab
fix: no debug
mfshao May 10, 2021
293389f
Merge branch 'master' into feat/newer-react
mfshao Jun 16, 2021
0ff3e5c
wip
mfshao Jun 16, 2021
ee7f012
lint
mfshao Jun 17, 2021
b23fc96
lint
mfshao Jun 17, 2021
6724041
update rechart
mfshao Jun 18, 2021
2542e06
Merge branch 'master' into feat/newer-react
mfshao Jun 18, 2021
2b35131
Merge branch 'master' into feat/newer-react
mfshao Jun 21, 2021
1873c2f
update lock
mfshao Jun 21, 2021
75cef96
fix: travis
mfshao Jun 21, 2021
eba409a
fix travis
mfshao Jun 21, 2021
2b9bedb
update dep
mfshao Jun 22, 2021
bc4f727
update query page css
mfshao Jun 22, 2021
3f6fb4a
Merge branch 'master' into feat/newer-react
mfshao Jun 23, 2021
2f68e03
Merge branch 'master' into feat/newer-react
mfshao Jun 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
[
"@babel/preset-env",
{
"targets": "> 2%, not dead"
"targets": "> 2%, not dead",
"useBuiltIns": "usage",
"corejs": 3
}
],
"@babel/preset-react",
Expand All @@ -12,9 +14,26 @@
"plugins": [
"dev-expression",
"transform-class-properties",
["relay",
{"compat": true, "schema": "data/schema.json"}],
"@babel/plugin-transform-runtime",
["@babel/plugin-proposal-object-rest-spread", { "loose": true, "useBuiltIns": true }]
[
"relay",
{
"compat": true,
"schema": "data/schema.json"
}
],
[
"@babel/transform-runtime",
{
"corejs": 3
}
],
[
"@babel/plugin-proposal-object-rest-spread",
{
"loose": true,
"useBuiltIns": true
}
],
["@babel/plugin-transform-modules-commonjs"]
]
}
51 changes: 42 additions & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
module.exports = {
// "extends": "eslint:recommended",
extends: 'airbnb',
settings: {
react: {
pragma: 'React',
version: '16.14',
},
'import/resolver': {
typescript: {}, // this loads <rootdir>/tsconfig.json to eslint
},
},
root: true,
env: {
browser: true,
es6: true,
jest: true,
},
plugins: [
'react',
'jsx-a11y',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

'import',
],
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module',
Expand Down Expand Up @@ -38,22 +52,46 @@ module.exports = {
'error',
'always',
],
// fixed in newer version of jsx-a11y remove if we upgrade
'jsx-a11y/label-has-for': ['error', {
required: {
some: ['nesting', 'id'],
'max-classes-per-file': ['error', 2],
'max-len': [
'error',
{
code: 150,
ignoreComments: true,
ignoreTrailingComments: true,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
},
],
'prefer-destructuring': [
'error',
{ object: true, array: false },
],
'react/jsx-fragments': [
'error',
'element',
],
'jsx-a11y/label-has-associated-control': [2, {
labelAttributes: ['label'],
controlComponents: ['Switch'],
depth: 3,
}],
'jsx-a11y/anchor-is-valid': ['off'],
// see https://github.com/clayne11/eslint-import-resolver-meteor/issues/17
// - seems to affect Codacy :-(
'import/extensions': ['off', 'never'],
'import/no-cycle': 'off',
'prefer-promise-reject-errors': 'off',
'react/jsx-indent': 'off',
'react/forbid-prop-types': 'off',
'react/prefer-stateless-function': 'off',
'react/jsx-curly-brace-presence': ['off'],
'function-paren-newline': ['off'],
'react/no-array-index-key': ['off'],
'react/destructuring-assignment': ['off'],
'react/jsx-one-expression-per-line': ['off'],
'react/jsx-props-no-spreading': ['off'],
},
overrides: [
{
Expand Down Expand Up @@ -164,9 +202,4 @@ module.exports = {
},
},
],
settings: {
'import/resolver': {
typescript: {}, // this loads <rootdir>/tsconfig.json to eslint
},
},
};
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "package-lock.json|.*/dictionary.json|.*/schema.json",
"lines": ".*integrity.*"
},
"generated_at": "2020-07-20T19:23:44Z",
"generated_at": "2021-03-31T21:06:30Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -72,7 +72,7 @@
"hashed_secret": "fb64f7d5722e6a8c86893f3f3085226fc659b94c",
"is_secret": false,
"is_verified": false,
"line_number": 101,
"line_number": 105,
"type": "Base64 High Entropy String"
}
],
Expand Down
2 changes: 1 addition & 1 deletion .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const basename = process.env.BASENAME || '/';
const webpack = require('webpack');

module.exports = {
entry: ['babel-polyfill', '../src/index.jsx'],
entry: '../src/index.jsx',
output: {
path: __dirname,
filename: 'bundle.js',
Expand Down
23 changes: 11 additions & 12 deletions data/dictionaryHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
* @return {experimentType, fileTypeList} gqlSetup object used by data/gqlSetup.js
*/
function dictToGQLSetup(dict) {
const fileTypeList = Object.keys(dict).filter(key =>
typeof dict[key] === 'object' &&
dict[key].category &&
dict[key].category.endsWith('_file'),
const fileTypeList = Object.keys(dict).filter((key) => typeof dict[key] === 'object'
&& dict[key].category
&& dict[key].category.endsWith('_file'),
);
// admin types that link to the 'project' level and are not project or program
const adminTypeList = Object.keys(dict).filter(
Expand All @@ -22,13 +21,13 @@ function dictToGQLSetup(dict) {
return {
typeName: key,
entry,
projectLink: entry.links.find(link => link.target_type === 'project' && link.required),
projectLink: entry.links.find((link) => link.target_type === 'project' && link.required),
};
},
);

const experimentType = ['experiment', 'study', 'trio'].find(
name => Object.prototype.hasOwnProperty.call(dict, name),
(name) => Object.prototype.hasOwnProperty.call(dict, name),
);

return {
Expand All @@ -48,9 +47,9 @@ function paramByApp(params, key) {
}

function getGraphQL(graphQLParams) {
const boardCounts = graphQLParams.boardCounts;
const chartCounts = graphQLParams.chartCounts;
let projectDetails = graphQLParams.projectDetails;
const { boardCounts } = graphQLParams;
const { chartCounts } = graphQLParams;
let { projectDetails } = graphQLParams;
if (typeof projectDetails === 'string') {
projectDetails = graphQLParams[projectDetails];
}
Expand All @@ -66,9 +65,9 @@ const { params } = require('./parameters');
function paramSetup() {
const countsAndDetails = getGraphQL(paramByApp(params, 'graphql'));
return {
boardCounts: countsAndDetails.boardCounts.map(item => item.graphql),
chartCounts: countsAndDetails.chartCounts.map(item => item.graphql),
projectDetails: countsAndDetails.projectDetails.map(item => item.graphql),
boardCounts: countsAndDetails.boardCounts.map((item) => item.graphql),
chartCounts: countsAndDetails.chartCounts.map((item) => item.graphql),
projectDetails: countsAndDetails.projectDetails.map((item) => item.graphql),
};
}

Expand Down
6 changes: 3 additions & 3 deletions data/getSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const { gdcSubPath } = (function () {

Use: node getSchema.js [gdcSubmissionApiPath]
- where gdcSubmissionApiPath defaults to: process.env.GDC_SUBPATH || 'http://localhost:5000/v0/submission/'
- example - if gdcSubmissionApiPath = https://dev.bionimbus.org/api/vo/submission/,
- example - if gdcSubmissionApiPath = https://dev.bionimbus.org/api/vo/submission/,
then the script loads:
* https://dev.bionimbus.org/api/v0/submission/_dictionary/_all
* https://dev.bionimbus.org/api/v0/submission/getschema
Expand Down Expand Up @@ -103,12 +103,12 @@ async function fetchJsonRetry(urlStr, opts) {
(res) => {
if (res.status === 200) {
return res.json().catch(
err => doRetry(`failed json parse - ${err}`),
(err) => doRetry(`failed json parse - ${err}`),
);
}
return doRetry(`non-200 from server: ${res.status}`);
},
err => doRetry(err),
(err) => doRetry(err),
);
};

Expand Down
14 changes: 7 additions & 7 deletions data/getTexts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ const componentTexts = paramByApp(params, 'components');

function getChartText() {
const graphQL = getGraphQL(paramByApp(params, 'graphql'));
const boardPluralNames = graphQL.boardCounts.map(item => item.plural);
const boardPluralNames = graphQL.boardCounts.map((item) => item.plural);
if (boardPluralNames.length < 4) { boardPluralNames.push('Files'); }
const detailPluralNames = graphQL.projectDetails.map(item => item.plural);
const detailPluralNames = graphQL.projectDetails.map((item) => item.plural);
if (detailPluralNames.length < 4) { detailPluralNames.push('Files'); }
const indexChartNames = graphQL.boardCounts.map(item => item.plural);
const indexChartNames = graphQL.boardCounts.map((item) => item.plural);
if (indexChartNames.length < 4) { indexChartNames.push('Files'); }
return {
boardPluralNames,
chartNames: graphQL.chartCounts.map(item => item.name),
chartNames: graphQL.chartCounts.map((item) => item.name),
indexChartNames,
detailPluralNames,
};
Expand Down Expand Up @@ -64,7 +64,7 @@ function doStringify(value, variables, indent = 0, spaces = 0) {
const ending = (spaces === 0) ? '' : '\n';
if (Array.isArray(value)) {
const objs = value.map(
item => `${insertSpace(indent + spaces)}${doStringify(item, variables, indent + spaces, spaces)}`,
(item) => `${insertSpace(indent + spaces)}${doStringify(item, variables, indent + spaces, spaces)}`,
).join(`,${ending}`);
return doWrapping(objs, '[', ']', indent, spaces);
}
Expand All @@ -82,7 +82,7 @@ function doStringify(value, variables, indent = 0, spaces = 0) {
// but without quotes around the keys.
const props = Object
.keys(value)
.map(key => `${insertSpace(indent + spaces)}${key}:${doStringify(value[key], variables, indent + spaces, spaces)}`)
.map((key) => `${insertSpace(indent + spaces)}${key}:${doStringify(value[key], variables, indent + spaces, spaces)}`)
.join(`,${ending}`);
return doWrapping(props, '{', '}', indent, spaces);
}
Expand Down Expand Up @@ -124,5 +124,5 @@ console.log(`const gaTracking = '${defaultGA}';`);
console.log('const hostname = typeof window !== \'undefined\' ? `${window.location.protocol}//${window.location.hostname}/` : \'http://localhost/\';');
console.log(`const components = ${stringify(fillDefaultValues(componentTexts, defaultTexts), ['hostname'], 2)};`);
console.log(`const config = ${JSON.stringify(config, null, ' ')};`);
console.log(`const requiredCerts = [${defaultRequiredCerts.map(item => `'${item}'`)}];`);
console.log(`const requiredCerts = [${defaultRequiredCerts.map((item) => `'${item}'`)}];`);
console.log('module.exports = { components, config, gaTracking, requiredCerts };');
1 change: 0 additions & 1 deletion data/gqlSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const dataFolder = __dirname;
const dictPath = `${dataFolder}/dictionary.json`;
const templateName = 'gqlHelper.js.njk';


if (!fs.existsSync(`${dataFolder}/${templateName}`)) {
console.error(`ERR: ${dataFolder}/${templateName} does not exist - bailing out`);
process.exit(1);
Expand Down
3 changes: 1 addition & 2 deletions data/parameters.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
const fs = require('fs');


/**
* Little helper script just accumulates the .json
* files in a given directory into an object keyed
* on the file basename with .json stripped.
*/
function scanJsonDir(dirPath) {
return fs.readdirSync(dirPath)
.filter(name => name.endsWith('.json'))
.filter((name) => name.endsWith('.json'))
.map(
(jsonName) => {
const key = jsonName.substring(0, jsonName.length - 5); // strip .json
Expand Down
Loading