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

Disallow use of console, alert, and debugger, part 2. #688

Merged
merged 17 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion src/Containers/CadView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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