Skip to content

Commit

Permalink
Disallow use of console, alert, and debugger, part 2. (bldrs-ai#688)
Browse files Browse the repository at this point in the history
* Disallow use of console logging, alerts, and debugging

* Calling unimplemented methods should raise an exception

* Allow console logging for logic that only occurs in development and testing

* Allow console logging for CLI/build tooling

* Remove unnecessary console logging

* Convert console logging to debug statements

* Fix path for utils import

* File access dialog (bldrs-ai#640)

* add drop downs to the open dialog

* pulled selector into a separate component

* clean up

* add the tests

* style the open dialog

* add test for files

* address comments

* clean up

* updatee tests

* clean up logs

* subtract ...

* test

* and at symbol to the orgname

* add at symbol

* populate js doc description

* simplify selection logic

* revert the change

* change properties to include name

* fix the navigate path

* clean up

* simplify the navigate path

* Clean github functions (bldrs-ai#672)

* clean github functions

* add unit tests

* revert whitespace, check missed params in api handlers

* revert whitespaces of content in api handler

* few style chnages

---------

Co-authored-by: Ron <rondoor124@gmail.com>

* Update severity levels for particular debug calls

* Replace storybook with react-cosmos (bldrs-ai#609)

* Replace storybook with react-cosmos.  Mostly working.

* Replace storybook with react-cosmos.  Mostly working.

* yarn build: both serve and cosmos.  Remove broken stories.

* yarn build-cosmos: clean build before build.  Obey NODE_ENV production or development settings.

* cosmos.webpack.js: use root serving path for standalone local dev but under /sb for prod.

* cosmos.webpack.js: more testing to put output under /sb in prod.

* Remove debug logging

* Remove HtmlPlugin from React Cosmos webpack config per random advice on internet.

* Testing cosmos build locations.

* Testing cosmos build locations 2.

* align rectangular button and change the order of notes (bldrs-ai#683)

* VYZN: (feature) hide/unhide and temporary isolate IFC elements (bldrs-ai#617)

* feat: custom viewer api

* subset list to dict

* remove log statement

* fix missing __getIFCViewerAPIMockSingleton

* pickByID new implementation

* fix: remove resetSelection guard to fix key down callback function lost state

* fix: reset selection guard back to fix failing tests and call the from the call back func changed

* subsets revisited

* unhide all hidden elements

* feature: ifc isolator component, incapsulates hide and isolate operations

* fix: ids loaded from meshes to insure having visual props

* fix: remove unused ifc classes imports

* fix: get express ids from model mesh  attributes for better performance

* fix: reset reveal upon unhide

* fix: turn off reveal on unhide all

* feat: hide/unhide icons in nav tree for spatial structures and root aggregators

* fix: failing unit tests

* linter fixes

* fix: reveal hidden elements material's depthTest

* re-evaluate reveal subset if on when hiding again

* fix: ifc viewer highlighter

* remove unused imports

* fix: disable hide icons on temp isolation mode

* reflect isoaltor status to selected elements store

* unit test for hide element by the tree icons

* toggle hide icon e2e test

* fix post processor

* fix failing cadview tests

* fix: placemarks broke the other post processing effects

* fix: remove singleton post-processor

* fix: space typo

* fix: disable lint error

* fix: maintain hidden elements when viewer changes

* fix: align hide icons to right

---------

Signed-off-by: Pablo Mayrgundter <pablo.mayrgundter@gmail.com>
Co-authored-by: Ibrahim Saad <ibrahim.saad@xbim.net>
Co-authored-by: OlegMoshkovich <oleg.mosh@gmail.com>
Co-authored-by: Pablo Mayrgundter <pablo.mayrgundter@gmail.com>

* Upgrade packages.  Fixup mui styling change to Dialog button.  Add fixtures for Dialog, About and fix ControlButton. (bldrs-ai#682)

Signed-off-by: Pablo Mayrgundter <pablo.mayrgundter@gmail.com>

* Suppress eslint violation per Pablo (bldrs-ai#688)

* Remove no-op ESLint rule control

---------

Signed-off-by: Pablo Mayrgundter <pablo.mayrgundter@gmail.com>
Co-authored-by: OlegMoshkovich <oleg.mosh@gmail.com>
Co-authored-by: Ron <rondoor124@gmail.com>
Co-authored-by: Pablo Mayrgundter <pablo.mayrgundter@gmail.com>
Co-authored-by: Ibrahim Saad <ibrahim.saad@xbim.net>
  • Loading branch information
5 people committed Mar 31, 2023
1 parent 1350156 commit 7f49930
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Expand Up @@ -100,6 +100,9 @@ module.exports = {
'jsdoc/require-param-type': 'off',
'require-await': 'error',
'linebreak-style': ['error', 'unix'],
'no-console': 'error',
'no-alert': 'error',
'no-debugger': 'error'
},
settings: {
react: {
Expand Down
2 changes: 0 additions & 2 deletions src/BaseRoutes.jsx
Expand Up @@ -63,8 +63,6 @@ export default function BaseRoutes({testElt = null}) {
if (err.error !== 'login_required') {
throw err
}

console.log(err.error)
})
}
}, [basePath, installPrefix, location, navigation, getAccessTokenSilently, isAuthenticated, isLoading, setAccessToken])
Expand Down
1 change: 0 additions & 1 deletion src/Components/SearchBar.jsx
Expand Up @@ -66,7 +66,6 @@ export default function SearchBar({fileOpen}) {
window.removeEventListener('beforeunload', handleBeforeUnload)
navigate(modelPath, {replace: true})
} catch (e) {
console.error(e)
setError(`Please enter a valid url. Click on the LINK icon to learn more.`)
}
return
Expand Down
1 change: 1 addition & 0 deletions src/Components/TooltipIconButton.fixture.jsx
Expand Up @@ -4,5 +4,6 @@ import ShareIcon from '../assets/icons/Share.svg'


export default (
// eslint-disable-next-line no-console
<TooltipIconButton title={'Hello World'} icon={<ShareIcon/>} onClick={() => console.log('clicked')}/>
)
2 changes: 1 addition & 1 deletion src/Containers/CadView.jsx
Expand Up @@ -285,7 +285,7 @@ export default function CadView({
}
},
(error) => {
console.warn('CadView#loadIfc$onError', error)
debug().log('CadView#loadIfc$onError: ', error)
// TODO(pablo): error modal.
setIsLoading(false)
setAlertMessage(`Could not load file: ${filepath}`)
Expand Down
3 changes: 2 additions & 1 deletion src/Infrastructure/IfcViewerAPIExtended.js
Expand Up @@ -4,6 +4,7 @@ import IfcIsolator from './IfcIsolator'
import IfcViewsManager from './IfcElementsStyleManager'
import IfcCustomViewSettings from './IfcCustomViewSettings'
import CustomPostProcessor from './CustomPostProcessor'
import debug from '../utils/debug'


const viewParameter = (new URLSearchParams(window.location.search)).get('view')?.toLowerCase() ?? 'default'
Expand Down Expand Up @@ -86,7 +87,7 @@ export class IfcViewerAPIExtended extends IfcViewerAPI {
await this.IFC.selector.pickIfcItemsByID(modelID, toBeSelected, false, true)
this.highlighter.setHighlighted(this.IFC.selector.selection.meshes)
} catch (e) {
console.error(e)
debug().error('IfcViewerAPIExtended#setSelection$onError: ', e)
}
} else {
this.highlighter.setHighlighted(null)
Expand Down
2 changes: 1 addition & 1 deletion src/Share.jsx
Expand Up @@ -63,7 +63,7 @@ export default function Share({installPrefix, appPrefix, pathPrefix}) {
debug().log('Setting default repo pablo-mayrgundter/Share')
setRepository('pablo-mayrgundter', 'Share')
} else {
console.warn('No repository set for project!', pathPrefix)
debug().warn('No repository set for project!, ', pathPrefix)
}
}, [appPrefix, installPrefix, modelPath, pathPrefix, setRepository, urlParams, setModelPath])

Expand Down
8 changes: 4 additions & 4 deletions src/WidgetApi/ApiConnection.js
Expand Up @@ -16,14 +16,14 @@ class AbstractApiConnection {
* starts the api.
*/
start() {
console.warn('start() is not implemented')
throw new Error('start() is not implemented')
}

/**
* stops the api.
*/
stop() {
console.warn('stop() is not implemented')
throw new Error('stop() is not implemented')
}

/**
Expand All @@ -33,7 +33,7 @@ class AbstractApiConnection {
* @param {object} data
*/
send(eventName, data) {
console.warn('send() is not implemented')
throw new Error('send() is not implemented')
}

/**
Expand All @@ -42,7 +42,7 @@ class AbstractApiConnection {
* @param {string[]} capabilities
*/
requestCapabilities(capabilities) {
console.warn('requestCapabilities() is not implemented')
throw new Error('requestCapabilities() is not implemented')
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/index.jsx
Expand Up @@ -39,6 +39,7 @@ if (process.env.DISABLE_MOCK_SERVICE_WORKER !== 'true') {
worker.start({
onUnhandledRequest(req) {
if (req.url.host === 'api.github.com') {
// eslint-disable-next-line no-console
console.error(`Found an unhandled ${req.method} request to ${req.url}`)
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/utils/version.mjs
Expand Up @@ -23,4 +23,4 @@ pkgJson.version = `${version}-r${__versionString__}`
const pkgJsonStr = JSON.stringify(pkgJson, null, ' ')

// Outputs to console for capture by file redirect in the calling script.
console.log(pkgJsonStr)
console.log(pkgJsonStr) // eslint-disable-line no-console

0 comments on commit 7f49930

Please sign in to comment.