Skip to content

Commit

Permalink
fix: Lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Crash-- committed Oct 1, 2020
1 parent 6dae942 commit aa10617
Show file tree
Hide file tree
Showing 32 changed files with 71 additions and 71 deletions.
2 changes: 1 addition & 1 deletion packages/browserslist-config-cozy/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/***
/** *
* We need to target Android 5 and at least iOS 10 for our mobile apps.
* We have to target Android 4.4 since Android 5 doesn't exist because Webview and OS
* version are different since Android 5.
Expand Down
10 changes: 5 additions & 5 deletions packages/cozy-authentication/src/MobileRouter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,10 @@ export class MobileRouter extends Component {
}

await credentials.saveFromClient(this.props.client)
//We need to set the state after all the previous actions
//since we can have async task in `onAuthenticated`. Setting
//isLoggingIn to true before result in displaying `appRoutes`
//too soon in this case
// We need to set the state after all the previous actions
// since we can have async task in `onAuthenticated`. Setting
// isLoggingIn to true before result in displaying `appRoutes`
// too soon in this case
this.setState({ isLoggingIn: false })
}

Expand All @@ -315,7 +315,7 @@ export class MobileRouter extends Component {

MobileRouter.defaultProps = {
onException: e => {
console.error('Exception', e) //eslint-disable-line no-console
console.error('Exception', e) // eslint-disable-line no-console
},

logoutPath: '/',
Expand Down
2 changes: 1 addition & 1 deletion packages/cozy-authentication/src/steps/SelectServer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class SelectServer extends Component {
}

componentDidMount() {
//if the cordova plugin is here, then shrink the view on iOS
// if the cordova plugin is here, then shrink the view on iOS
if (window.Keyboard && window.Keyboard.shrinkView) {
window.Keyboard.shrinkView(true)
} else {
Expand Down
4 changes: 2 additions & 2 deletions packages/cozy-device-helper/src/deeplink.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const openUriWithTimeoutHack = (uri, failCb) => {
target.removeEventListener('blur', onBlur)
}, 500)

//handle page running in an iframe (blur must be registered with top level window)
// handle page running in an iframe (blur must be registered with top level window)
let target = window
while (target != target.parent) {
target = target.parent
Expand Down Expand Up @@ -94,7 +94,7 @@ const checkBrowser = () => {
*/
export const openDeeplinkOrRedirect = (deeplink, failCb) => {
if (navigator.msLaunchUri) {
//for IE and Edge in Win 8 and Win 10
// for IE and Edge in Win 8 and Win 10
openUriWithMsLaunchUri(deeplink, failCb)
} else {
const browser = checkBrowser()
Expand Down
6 changes: 3 additions & 3 deletions packages/cozy-device-helper/src/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ export const isAndroidApp = () => isPlatform(ANDROID_PLATFORM)
export const isWebApp = () => isPlatform(WEB_PLATFORM)
export const isMobileApp = () => isCordova()

//return if is on an Android Device (native or browser)
// return if is on an Android Device (native or browser)
export const isAndroid = () =>
window.navigator.userAgent &&
window.navigator.userAgent.indexOf('Android') >= 0
//return if is on an iOS Device (native or browser)
// return if is on an iOS Device (native or browser)
export const isIOS = () =>
window.navigator.userAgent &&
/iPad|iPhone|iPod/.test(window.navigator.userAgent)

//isMobile checks if the user is on a smartphone : native app or browser
// isMobile checks if the user is on a smartphone : native app or browser
export const isMobile = () => isAndroid() || isIOS()
8 changes: 4 additions & 4 deletions packages/cozy-doctypes/src/File.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ class CozyFile extends Document {
* @return {String} A filename with the right suffix
*/
static generateNewFileNameOnConflict(filenameWithoutExtension) {
//Check if the string ends by _1
// Check if the string ends by _1
const regex = new RegExp('(_)([0-9]+)$')
const matches = filenameWithoutExtension.match(regex)
if (matches) {
let versionNumber = parseInt(matches[2])
//increment versionNumber
// increment versionNumber
versionNumber++
const newFilenameWithoutExtension = filenameWithoutExtension.replace(
new RegExp('(_)([0-9]+)$'),
Expand Down Expand Up @@ -190,7 +190,7 @@ class CozyFile extends Document {
const existingFile = await filesCollection.statByPath(path)
const { id: fileId } = existingFile.data
if (conflictStrategy === 'erase') {
//!TODO Bug Fix. Seems we have to pass a name attribute ?!
// !TODO Bug Fix. Seems we have to pass a name attribute ?!
const resp = await filesCollection.updateFile(file, {
dirId,
fileId,
Expand All @@ -206,7 +206,7 @@ class CozyFile extends Document {
})
const newFileName =
CozyFile.generateNewFileNameOnConflict(filename) + extension
//recall itself with the newFilename.
// recall itself with the newFilename.
return CozyFile.uploadFileWithConflictStrategy(
newFileName,
file,
Expand Down
8 changes: 4 additions & 4 deletions packages/cozy-doctypes/src/File.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ describe('File model', () => {

it('should rename the file if there is a conflict', async () => {
const dirId = 'toto'
//first call we return an existing file => conflict
//second call, we reject as not found
// first call we return an existing file => conflict
// second call, we reject as not found
statByPathSpy
.mockReturnValueOnce({
data: {
Expand All @@ -364,8 +364,8 @@ describe('File model', () => {

it('should erase the file if there is a conflict', async () => {
const dirId = 'toto'
//first call we return an existing file => conflict
//second call, we reject as not found
// first call we return an existing file => conflict
// second call, we reject as not found
statByPathSpy.mockReturnValueOnce({
data: {
id: 'file_id'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ class AdministrativeProcedure extends Document {
type: 'file',
...rules
}
//Create an index in order to query and sort
// Create an index in order to query and sort
await this.cozyClient
.collection('io.cozy.files')
.createIndex(['metadata.datetime', 'metadata.classification'])
//Use the index
// Use the index
const files = await this.cozyClient
.collection('io.cozy.files')
.find(cozyRules, {
Expand Down Expand Up @@ -95,7 +95,7 @@ class AdministrativeProcedure extends Document {
const { documentsData, personalData, procedureData } = data
const files = Object.keys(documentsData).map(identifier => {
return documentsData[identifier].files.map(file => {
//TODO Remove this check. it has to be done before
// TODO Remove this check. it has to be done before
if (file)
return {
_id: file.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const KonnectorAccountTabs = ({
onAccountDeleted,
initialActiveTab,

//TODO rename to onAddAccount
// TODO rename to onAddAccount
addAccount,
showNewAccountButton
}) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cozy-harvest-lib/src/components/OAuthWindow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
terminateOAuth,
OAUTH_REALTIME_CHANNEL
} from '../helpers/oauth'
//TODO use PopUp from cozy-ui
// TODO use PopUp from cozy-ui
import Popup from './Popup'

const OAUTH_POPUP_HEIGHT = 800
Expand Down
2 changes: 1 addition & 1 deletion packages/cozy-harvest-lib/src/helpers/konnectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export const buildFolderPath = (konnector, account, folders = {}) => {
)
// Trim `/` and avoid multiple `/` characters with regexp
let sanitizedPath = trim(fullPath.replace(/(\/+)/g, '/'), '/')
//If the konnector doesn't have any of our base dir, we set it to $administrative
// If the konnector doesn't have any of our base dir, we set it to $administrative
if (!hasBaseDir(sanitizedPath)) {
sanitizedPath = '$administrative/' + sanitizedPath
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cozy-interapp/src/listener.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint no-console: ["error", { allow: ["warn", "error"] }] */
/* eslint no-console: ["error", { allow: ["warn", "error"] }] */

const intentTypeRx = /intent-(.*):(.*)/

Expand Down
4 changes: 2 additions & 2 deletions packages/cozy-procedures/src/Procedure.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Procedure extends React.Component {
initializationSuccess,
fetchBankAccountsStats
} = this.props
//We init our Document model here to be able to use CozyFile or AdministrativeProcedure models where we want
// We init our Document model here to be able to use CozyFile or AdministrativeProcedure models where we want
if (!Document.cozyClient) {
Document.registerClient(client)
}
Expand All @@ -26,7 +26,7 @@ class Procedure extends React.Component {
)

initDocuments(get(creditApplicationTemplate, 'documents'))
//Since init is done, we tell the app we can start to render thing
// Since init is done, we tell the app we can start to render thing
initializationSuccess()
fetchMyself(client)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class DocumentHolder extends Component {
DocumentHolder.propTypes = {
unlinkDocument: PropTypes.func.isRequired,
categoryId: PropTypes.string.isRequired,
//io.cozy.files
// io.cozy.files
document: PropTypes.object.isRequired,
t: PropTypes.func.isRequired,
index: PropTypes.number.isRequired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint no-unused-vars: off*/
/* eslint no-unused-vars: off*/
const getInputProps = (
{
readonly,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class Overview extends React.Component {
Object.keys(documentsData).forEach(categoryName => {
const documentCategory = documentsData[categoryName]
documentCategory.files.forEach(f => {
//!TODO Remove this check. We need to clean datas structure before
// !TODO Remove this check. We need to clean datas structure before
if (f) {
const identifier = `documents/${f.name}`
files[identifier] = f.id
Expand Down
4 changes: 2 additions & 2 deletions packages/cozy-procedures/src/redux/documentsDataSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const documentsSlice = createSlice({
return {
completedFromDrive: 0,
data: Object.keys(action.payload).reduce((acc, fieldId) => {
//init files with undefined value
// init files with undefined value
acc[fieldId] = {
files: Array.from(Array(action.payload[fieldId].count))
}
Expand Down Expand Up @@ -167,7 +167,7 @@ export function fetchDocumentsByCategory(documentTemplate) {
}
} catch (error) {
const docWithRules = creditApplicationTemplate.documents[documentTemplate]
//If we had a global error for a category, let's set the error everywhere
// If we had a global error for a category, let's set the error everywhere
for (let i = 0; i < docWithRules.count; i++) {
dispatch(
fetchDocumentError({
Expand Down
2 changes: 1 addition & 1 deletion packages/cozy-realtime/src/CozyRealtime.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function createSocketServer({

const sleep = time => new Promise(resolve => setTimeout(resolve, time))

/*** TEST ***/
/** * TEST ***/

describe('CozyRealtime', () => {
afterEach(async () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/cozy-scanner/src/DocumentCategory.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ describe('DocumentCategory', () => {
</MuiCozyTheme>
)
expect(asFragment()).toMatchSnapshot()
//Click on the item
// Click on the item
fireEvent.click(getByText('Scan.items.test'))
expect(asFragment()).toMatchSnapshot()
//Check if the second item is displayed in the ActionMenu
// Check if the second item is displayed in the ActionMenu
expect(() => getByText('Scan.items.Label2')).not.toThrow()
await wait(() => getByText('Scan.items.Label2'))

fireEvent.click(getByText('Scan.items.Label2'))
//Menu should not be there anymore
// Menu should not be there anymore
expect(queryByText('Scan.items.Label2')).toBeNull()
fireEvent.click(getByText('Scan.items.test'))
await wait(() => getByText('Scan.items.Label2'))
Expand Down
6 changes: 3 additions & 3 deletions packages/cozy-scanner/src/DocumentQualification.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ export class DocumentQualification extends Component {
placeholder={t('Scan.filename')}
value={filename}
onChange={event => {
//console.log('event', event)
//If the user write something once, we don't want to rename the file automatically anymore
// console.log('event', event)
// If the user write something once, we don't want to rename the file automatically anymore
if (!hasUserWrittenFileName) {
this.setState({ hasUserWrittenFileName: true })
}
//If we left an empty value, then we reset the behavior
// If we left an empty value, then we reset the behavior
if (event.target.value === '') {
this.setState({ hasUserWrittenFileName: false })
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cozy-scanner/src/DocumentQualification.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('DocumentQualification', () => {
onDescribed={onDescribed}
onFileNameChanged={onFileNameChanged}
title={'Edit'}
//initialSelected={{ itemId: 1, categoryLabel: 'Label1' }}
// initialSelected={{ itemId: 1, categoryLabel: 'Label1' }}
t={text => text}
/>
</MuiCozyTheme>
Expand Down
2 changes: 1 addition & 1 deletion packages/cozy-scanner/src/ModalScannerQualification.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Alerter from 'cozy-ui/transpiled/react/Alerter'

import DocumentQualification from './DocumentQualification'

//import ExperimentalModal from 'cozy-ui/transpiled/react/Labs/ExperimentalModal'
// import ExperimentalModal from 'cozy-ui/transpiled/react/Labs/ExperimentalModal'
import DialogContent from '@material-ui/core/DialogContent'

import ExperimentalDialog, {
Expand Down
4 changes: 2 additions & 2 deletions packages/cozy-scanner/src/Scanner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Scanner extends React.Component {
*/
onFail = message => {
this.setState({ loadingScreen: false })
console.log('failed', message) //eslint-disable-line no-console
console.log('failed', message) // eslint-disable-line no-console
}

onUpload = async (imageURI, qualification, filename = '') => {
Expand Down Expand Up @@ -100,7 +100,7 @@ class Scanner extends React.Component {
...this.props.pluginConfig
})
} catch (e) {
console.error('You have to install cordova camera plugin', e) //eslint-disable-line no-console
console.error('You have to install cordova camera plugin', e) // eslint-disable-line no-console
}
}

Expand Down
8 changes: 4 additions & 4 deletions packages/cozy-scanner/src/ScannerUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const doUpload = async (
async file => {
const reader = new FileReader()
reader.onloadend = async () => {
//we get the result of the readAsBuffer in the `result` attr
// we get the result of the readAsBuffer in the `result` attr
try {
const newFile = await CozyFile.uploadFileWithConflictStrategy(
name,
Expand All @@ -38,16 +38,16 @@ export const doUpload = async (
)
resolve(newFile)
} catch (error) {
console.log('error', error) //eslint-disable-line no-console
console.log('error', error) // eslint-disable-line no-console
reject(error)
}
}
// Read the file as an ArrayBuffer
reader.readAsArrayBuffer(file)
},
err => {
//Since this module is pretty recent, let's have this info in sentry if needed
console.error('error getting fileentry file!' + err) //eslint-disable-line no-console
// Since this module is pretty recent, let's have this info in sentry if needed
console.error('error getting fileentry file!' + err) // eslint-disable-line no-console
reject(err)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('ShareAutosuggest', () => {
const inputNode = getByPlaceholderText('myPlaceHolder')
inputNode.focus()
expect(onFocus).toHaveBeenCalled()
//It should not call onPick if the value is not an email
// It should not call onPick if the value is not an email
fireEvent.change(inputNode, { target: { value: 'quentin@qq' } })
fireEvent.keyPress(inputNode, { key: 'Enter', keyCode: 13, charCode: 13 })
expect(onPick).not.toHaveBeenCalled()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const useFetchDocumentPath = (client, document) => {
try {
const path = await fetchFilesPaths(client, document._type, [document])
setDocumentPath(path[0])
//eslint-disable-next-line
// eslint-disable-next-line
} catch {}
})()
}, [client, document])
Expand Down
4 changes: 2 additions & 2 deletions packages/cozy-sharing/src/helpers/contacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export const getOrCreateFromArray = async (client, contacts, createContact) => {
)

if (matchedContact.data.length > 0) {
//We take the shortcut that if we have sevaral contacts
//with the same address, we take the first one for now
// We take the shortcut that if we have sevaral contacts
// with the same address, we take the first one for now
return matchedContact.data[0]
} else {
const resp = await createContact({
Expand Down
2 changes: 1 addition & 1 deletion packages/cozy-sharing/src/helpers/sharings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const createSharingInStore = (
docsId,
sharing
) => {
//TODO Check if we can getByIds to avoid query in map
// TODO Check if we can getByIds to avoid query in map
docsId.map(async id => {
const file = await client.query(client.get('io.cozy.files', id))
dispatch(
Expand Down

0 comments on commit aa10617

Please sign in to comment.