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

View file

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

View file

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

View file

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

View file

@ -13,16 +13,14 @@ function PreviewDownloadFileList({ fileList = [] }) {
if (fileList) { if (fileList) {
topFiles = fileList.filter(file => { topFiles = fileList.filter(file => {
if (topFileTypes.includes(file.type)) { return topFileTypes.includes(file.type)
return file
}
}) })
otherFiles = fileList.filter(file => { otherFiles = fileList.filter(file => {
if (!topFileTypes.includes(file.type)) { if (!topFileTypes.includes(file.type)) {
if (file.type === 'pdf' && file.main === true) return return !(file.type === 'pdf' && file.main === true)
return file
} }
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)) { if (!this.isCommentResolved(comment)) {
this.adapter.onCommentAdded(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) { if (selected_doc != null && affected_docs[selected_doc.id] != null) {
// Selected doc is already open // Selected doc is already open
} else { } 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] doc = affected_docs[doc_id]
selected_doc = doc selected_doc = doc
break
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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