Merge pull request #3947 from overleaf/msm-reenable-eslint-rules

Reenable `eslint` rules

GitOrigin-RevId: a0aa5f941ba1bc49ff758b5256f91d696f442c6d
This commit is contained in:
Miguel Serrano 2021-05-13 12:21:35 +02:00 committed by Copybot
parent 1d4c7f71d5
commit bb88af80cf
13 changed files with 23 additions and 23 deletions

View file

@ -41,11 +41,7 @@
// Disable some rules after upgrading ESLint
// TODO: re-enable and fix
"no-prototype-builtins": "off",
"no-var": "off",
"array-callback-return": "off",
"no-unreachable-loop": "off",
"no-loss-of-precision": "off",
// do not allow importing of implicit dependencies.
"import/no-extraneous-dependencies": "error",
@ -55,11 +51,7 @@
"node/handle-callback-err": "off",
"node/no-path-concat": "off",
"react/display-name": "off",
"react/no-unescaped-entities": "off",
"react/no-unused-prop-types": "off",
"react/jsx-no-target-blank": "off",
"react/jsx-handler-names": "off"
},
"overrides": [
// NOTE: changing paths may require updating them in the Makefile too.

View file

@ -48,7 +48,12 @@ module.exports = LinkedFilesController = {
),
_getAgent(provider) {
if (!LinkedFilesController.Agents.hasOwnProperty(provider)) {
if (
!Object.prototype.hasOwnProperty.call(
LinkedFilesController.Agents,
provider
)
) {
return null
}
if (!Array.from(Settings.enabledLinkedFileTypes).includes(provider)) {

View file

@ -112,6 +112,8 @@ const DropDownToggleButton = React.forwardRef((props, ref) => {
)
})
DropDownToggleButton.displayName = 'DropDownToggleButton'
DropDownToggleButton.propTypes = {
onlineUserCount: PropTypes.number.isRequired,
onClick: PropTypes.func,

View file

@ -50,4 +50,6 @@ const FakeDropDownToggle = React.forwardRef((props, ref) => {
return null
})
FakeDropDownToggle.displayName = 'FakeDropDownToggle'
export default FileTreeContextMenu

View file

@ -13,16 +13,14 @@ function PreviewDownloadFileList({ fileList = [] }) {
if (fileList) {
topFiles = fileList.filter(file => {
if (topFileTypes.includes(file.type)) {
return file
}
return topFileTypes.includes(file.type)
})
otherFiles = fileList.filter(file => {
if (!topFileTypes.includes(file.type)) {
if (file.type === 'pdf' && file.main === true) return
return file
return !(file.type === 'pdf' && file.main === true)
}
return false
})
}

View file

@ -168,7 +168,7 @@ class TrackChangesManager {
}
}
Array.from(this.rangesTracker.comments).map(comment => {
Array.from(this.rangesTracker.comments).forEach(comment => {
if (!this.isCommentResolved(comment)) {
this.adapter.onCommentAdded(comment)
}

View file

@ -364,10 +364,11 @@ export default HistoryManager = (function () {
if (selected_doc != null && affected_docs[selected_doc.id] != null) {
// Selected doc is already open
} else {
for (doc_id in affected_docs) {
const doc_ids = Object.keys(affected_docs)
if (doc_ids.length > 0) {
const doc_id = doc_ids[0]
doc = affected_docs[doc_id]
selected_doc = doc
break
}
}

View file

@ -224,6 +224,7 @@ App.controller(
let ref
return ([topPageIdx, topPage] = Array.from((ref = [i, page]))), ref
}
return false
})
if (visible && topPage.element != null) {
// console.log 'found it', topPageIdx

View file

@ -309,9 +309,7 @@ export default App.controller(
})
$scope.linkedInstitutionIds = emails
.filter(email => {
if (email.samlProviderId) {
return email.samlProviderId
}
return !!email.samlProviderId
})
.map(email => email.samlProviderId)
})

View file

@ -40,6 +40,7 @@ const defaultContextProps = {
export const createFileModalDecorator = (
contextProps = {},
createMode = 'doc'
// eslint-disable-next-line react/display-name
) => Story => {
fetchMock
.restore()
@ -127,7 +128,6 @@ function OpenCreateFileModal({ children, createMode }) {
}
OpenCreateFileModal.propTypes = {
createMode: PropTypes.string,
finishCreating: PropTypes.bool,
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,

View file

@ -443,6 +443,7 @@ describe('ChatContext', function () {
function renderChatContextHook(props) {
return renderHook(() => useChatContext(), {
// Wrap with ChatContext.Provider (and the other editor context providers)
// eslint-disable-next-line react/display-name
wrapper: ({ children }) => (
<ChatProviders {...props}>{children}</ChatProviders>
),

View file

@ -50,7 +50,7 @@ describe('<PreviewDownloadFileList />', function () {
expect(topFileTypes.length).to.be.above(0)
const outputTopFileTypes = outputFiles
.filter(file => {
if (topFileTypes.includes(file.type)) return file.type
return topFileTypes.includes(file.type)
})
.map(file => file.type)
const topMenuItems = menuItems.slice(0, outputTopFileTypes.length)

View file

@ -456,7 +456,7 @@ describe('ArchiveManager', function () {
isTooLarge.should.equal(true)
return done()
})
this.zipfile.emit('entry', { uncompressedSize: 1090000000000000042 })
this.zipfile.emit('entry', { uncompressedSize: 109e16 })
return this.zipfile.emit('end')
})