diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 9cc6ea404..000000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -app/javascript/mda_viewer/components/riek \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 45f680f0f..000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "env": { - "browser": true, - "es6": true - }, - "extends": [ - "eslint:recommended", - "airbnb" - ], - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parserOptions": { - "ecmaFeatures": { - "jsx": true - }, - "ecmaVersion": 2018, - "sourceType": "module" - }, - "plugins": [ - "react" - ], - "rules": { - "no-underscore-dangle": "off", - "no-console": "off", - "global-require": "off", - "react/forbid-prop-types": "off", - "no-restricted-syntax": "off", - "linebreak-style": "off", - "max-classes-per-file": "off", - "import/no-unresolved": "off", - "camelcase": "off", - "import/extensions": [ - "warn", - "never" - ] - } -} \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..f0ed2aad9 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,14 @@ +node_modules +.yarn +public/packs +public/packs-test +public/assets +vendor +tmp +log +storage +upload +*_out +reports +db/*.sqlite3 +app/javascript/mda_viewer/components/riek diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 000000000..5d82119b0 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "singleQuote": true, + "trailingComma": "es5", + "printWidth": 100, + "semi": true +} diff --git a/app/javascript/api_doc_viewer/index.jsx b/app/javascript/api_doc_viewer/index.jsx index 9141c7ece..d096f3751 100644 --- a/app/javascript/api_doc_viewer/index.jsx +++ b/app/javascript/api_doc_viewer/index.jsx @@ -5,13 +5,7 @@ import 'swagger-ui-react/swagger-ui.css'; function MySwaggerUI(props) { const { url, preAuthorize } = props; - return ( - - ); + return ; } MySwaggerUI.propTypes = { @@ -26,12 +20,7 @@ function SwaggerApiDoc({ api }) { } } - return ( - preAuthorize(sui)} - /> - ); + return preAuthorize(sui)} />; } SwaggerApiDoc.propTypes = { diff --git a/app/javascript/application_views/analyses_index.js b/app/javascript/application_views/analyses_index.js index 86a27e30e..c11945857 100644 --- a/app/javascript/application_views/analyses_index.js +++ b/app/javascript/application_views/analyses_index.js @@ -37,7 +37,9 @@ class AnalysesIndex { }, success() { $.getScript(this.href, () => { - if (timeout) { clearTimeout(timeout); } + if (timeout) { + clearTimeout(timeout); + } $('.spinner').hide(); // UX test: code below reset the search string @@ -68,16 +70,13 @@ class AnalysesIndex { $('input[data-analyses-query]').on('click', setAnalysesListSettings); $('input[data-analyses-order]').on('click', setAnalysesListSettings); - $('#analyses-filter').on( - 'keypress', - (event) => { - if (event.key === 'Enter') { - setAnalysesListSettings(); - // Cancel the default action, if needed - event.preventDefault(); - } - }, - ); + $('#analyses-filter').on('keypress', (event) => { + if (event.key === 'Enter') { + setAnalysesListSettings(); + // Cancel the default action, if needed + event.preventDefault(); + } + }); $('#btn_user_settings_analyses_filter').on('click', setAnalysesListSettings); let current_design_project_id = '<%= current_user.analyses_scope_design_project_id %>'; @@ -99,7 +98,9 @@ class AnalysesIndex { }, success() { $.getScript(this.href, () => { - if (timeout) { clearTimeout(timeout); } + if (timeout) { + clearTimeout(timeout); + } $('.spinner').hide(); }); }, diff --git a/app/javascript/application_views/operations_index.js b/app/javascript/application_views/operations_index.js index f1f80bf42..c3432be60 100644 --- a/app/javascript/application_views/operations_index.js +++ b/app/javascript/application_views/operations_index.js @@ -20,33 +20,30 @@ class OperationsIndex { $input.on('focus'); }); - $('button[data-save="true"]').on( - 'click', - () => { - const newName = $input.val(); - $.ajax({ - type: 'PATCH', - xhrFields: { withCredentials: true }, - headers: { Authorization: `Token ${opeEdit.apiKey}` }, - url: `${relativeUrlRoot}/api/v1/operations/${opeEdit.id}`, - data: { operation: { name: newName } }, - success() { - $(`a[id=${opeEdit.id}]`).text(newName); - opeEdit.invoker.data('ope-name', newName); - $modal.modal('hide'); - }, - error(xhr) { - console.log(xhr.responseJSON.message); - $('#errorPlaceHolder').html( - ``, - ); - $modal.modal('hide'); - }, - }); - }, - ); + $('button[data-save="true"]').on('click', () => { + const newName = $input.val(); + $.ajax({ + type: 'PATCH', + xhrFields: { withCredentials: true }, + headers: { Authorization: `Token ${opeEdit.apiKey}` }, + url: `${relativeUrlRoot}/api/v1/operations/${opeEdit.id}`, + data: { operation: { name: newName } }, + success() { + $(`a[id=${opeEdit.id}]`).text(newName); + opeEdit.invoker.data('ope-name', newName); + $modal.modal('hide'); + }, + error(xhr) { + console.log(xhr.responseJSON.message); + $('#errorPlaceHolder').html( + `` + ); + $modal.modal('hide'); + }, + }); + }); } } diff --git a/app/javascript/mda_viewer/components/AnalysisBreadCrumbs.jsx b/app/javascript/mda_viewer/components/AnalysisBreadCrumbs.jsx index 005b1f441..0660253bb 100644 --- a/app/javascript/mda_viewer/components/AnalysisBreadCrumbs.jsx +++ b/app/javascript/mda_viewer/components/AnalysisBreadCrumbs.jsx @@ -12,14 +12,16 @@ class AnalysisBreadCrumbs extends React.PureComponent { klass += ' active'; name = anc.name; } - return (
  • {name}
  • ); + return ( +
  • + {name} +
  • + ); }); return ( ); } @@ -27,10 +29,12 @@ class AnalysisBreadCrumbs extends React.PureComponent { AnalysisBreadCrumbs.propTypes = { api: PropTypes.object.isRequired, - path: PropTypes.arrayOf(PropTypes.shape({ - name: PropTypes.string, - id: PropTypes.number, - })).isRequired, + path: PropTypes.arrayOf( + PropTypes.shape({ + name: PropTypes.string, + id: PropTypes.number, + }) + ).isRequired, }; export default AnalysisBreadCrumbs; diff --git a/app/javascript/mda_viewer/components/AnalysisEditor.jsx b/app/javascript/mda_viewer/components/AnalysisEditor.jsx index ebe184e9d..9ed9da6c3 100644 --- a/app/javascript/mda_viewer/components/AnalysisEditor.jsx +++ b/app/javascript/mda_viewer/components/AnalysisEditor.jsx @@ -7,21 +7,26 @@ import AnalysisNoteEditor from './AnalysisNoteEditor'; class UserList extends React.PureComponent { render() { - const { - users, userRole, onUserDelete, editEnabled, - } = this.props; + const { users, userRole, onUserDelete, editEnabled } = this.props; const logins = users.map((user) => user.login); const userItems = logins.map((login, i) => ( - - + )); - return ({userItems}); + return {userItems}; } } @@ -34,9 +39,7 @@ UserList.propTypes = { class TeamSelector extends React.PureComponent { render() { - const { - users, userRole, onUserSearch, onUserSelected, onUserDelete, editEnabled, - } = this.props; + const { users, userRole, onUserSearch, onUserSelected, onUserDelete, editEnabled } = this.props; let title = 'Users'; if (userRole === 'member') { title = 'Members'; @@ -59,10 +62,8 @@ class TeamSelector extends React.PureComponent {
    - { title } - - {users.length} - + {title} + {users.length}
    {userSelector}
    @@ -93,11 +94,23 @@ class AnalysisEditor extends React.PureComponent { render() { let teamMembers = null; const { - analysisPublic, analysisMembers, analysisCoOwners, - analysisPermissionsEditable, onAnalysisUserSearch, onAnalysisUserSelected, - onAnalysisUserDelete, onAnalysisUpdate, newAnalysisName, - onAnalysisNameChange, onAnalysisNoteChange, onAnalysisPublicChange, - mdaId, note, onProjectSearch, onProjectSelected, mdaProject, + analysisPublic, + analysisMembers, + analysisCoOwners, + analysisPermissionsEditable, + onAnalysisUserSearch, + onAnalysisUserSelected, + onAnalysisUserDelete, + onAnalysisUpdate, + newAnalysisName, + onAnalysisNameChange, + onAnalysisNoteChange, + onAnalysisPublicChange, + mdaId, + note, + onProjectSearch, + onProjectSelected, + mdaProject, } = this.props; if (!analysisPublic) { teamMembers = ( @@ -127,15 +140,12 @@ class AnalysisEditor extends React.PureComponent {
    - - {' '} - General Information + General + Information
    -
    - Name -
    +
    Name
    -
    - Design Project -
    +
    Design Project
    -
    - Notes -
    +
    Notes
    - +

    - - {' '} - Collaboration - {' '} + Collaboration{' '} (allow edit access to the users listed below)
    @@ -183,10 +188,7 @@ class AnalysisEditor extends React.PureComponent {
    - - {' '} - Privacy - {' '} + Privacy{' '} (when restricted, allow read only access to the users listed below)
    diff --git a/app/javascript/mda_viewer/components/AnalysisNoteEditor.jsx b/app/javascript/mda_viewer/components/AnalysisNoteEditor.jsx index ffc3d8391..763f85e82 100644 --- a/app/javascript/mda_viewer/components/AnalysisNoteEditor.jsx +++ b/app/javascript/mda_viewer/components/AnalysisNoteEditor.jsx @@ -35,7 +35,12 @@ class AnalysisNoteEditor extends React.Component {
    {/*