diff --git a/.eslintrc.js b/.eslintrc.js index b98ec308..1c38ae40 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -24,6 +24,12 @@ module.exports = { 'vue/attribute-hyphenation': 0, 'vue/require-prop-types': 0, 'vue/require-default-prop': 0, - 'vue/multiline-html-element-content-newline': 0 + 'vue/multiline-html-element-content-newline': 0, + // use fork to allow MemberExpressions + // https://github.com/jfmengels/eslint-plugin-fp/pull/54 + "fp/no-mutating-methods": [2, { + "allowedObjects": ["$router"] + }] + } } diff --git a/package-lock.json b/package-lock.json index 283d7241..eeb84dba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9139,9 +9139,8 @@ } }, "eslint-plugin-fp": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-fp/-/eslint-plugin-fp-2.3.0.tgz", - "integrity": "sha1-N20qEIcQ6YGYC9w4deO5kg2gSJw=", + "version": "git+https://github.com/raineorshine/eslint-plugin-fp.git#32bbf5951628b42f0c846f050abe2d107e3cac6b", + "from": "git+https://github.com/raineorshine/eslint-plugin-fp.git#allowedObjects", "dev": true, "requires": { "create-eslint-index": "^1.0.0", diff --git a/package.json b/package.json index f2122584..eb79361f 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "eslint": "^7.15.0", "eslint-config-raine": "^0.1.2", "eslint-config-standard": "^16.0.2", - "eslint-plugin-fp": "^2.3.0", + "eslint-plugin-fp": "git+https://github.com/raineorshine/eslint-plugin-fp.git#allowedObjects", "eslint-plugin-import": "^2.22.1", "eslint-plugin-jest-dom": "^3.6.4", "eslint-plugin-jsdoc": "^30.7.8", diff --git a/src/App.vue b/src/App.vue index 12f59e21..d7f0ded4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -38,7 +38,6 @@ export default ({ if (!prev && next && this.$store.state.noAccessPath.length) { const nap = this.$store.state.noAccessPath + '' this.$store.commit('setNAP', '') - // eslint-disable-next-line fp/no-mutating-methods this.$router.push(nap) } } diff --git a/src/components/BookmarkButton.vue b/src/components/BookmarkButton.vue index 1167b903..3aade71f 100644 --- a/src/components/BookmarkButton.vue +++ b/src/components/BookmarkButton.vue @@ -14,7 +14,6 @@ export default { methods: { toggleBookmark() { if (!this.$iam('authorized')) { - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'LogIn' }) } else { diff --git a/src/components/BooksFilter.vue b/src/components/BooksFilter.vue index a9907d59..94d8aca7 100644 --- a/src/components/BooksFilter.vue +++ b/src/components/BooksFilter.vue @@ -8,7 +8,6 @@ export default { methods: { toggleFilter(fid) { this.$store.commit('books/toggleFilter', fid) - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'Home' }) }, resetFilters() { diff --git a/src/components/MainMenu.vue b/src/components/MainMenu.vue index a7ca1c76..d28a99ef 100644 --- a/src/components/MainMenu.vue +++ b/src/components/MainMenu.vue @@ -11,8 +11,6 @@ export default { methods: { logout() { firebase.auth().signOut() - - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'LogIn' }) } }, diff --git a/src/components/MobileFooter.vue b/src/components/MobileFooter.vue index bfa25682..91697a99 100644 --- a/src/components/MobileFooter.vue +++ b/src/components/MobileFooter.vue @@ -45,7 +45,6 @@ export default { }, toggleBookmarks() { if (!this.$iam('authorized')) { - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'LogIn' }) return } diff --git a/src/components/RightBar.vue b/src/components/RightBar.vue index c6e0bb8f..2d0b624a 100644 --- a/src/components/RightBar.vue +++ b/src/components/RightBar.vue @@ -31,7 +31,6 @@ export default { }, toggleBookmarks() { if (!this.$iam('authorized')) { - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'LogIn' }) return } diff --git a/src/pages/AuthorDetail.vue b/src/pages/AuthorDetail.vue index 8cc1e81d..f8eae62d 100644 --- a/src/pages/AuthorDetail.vue +++ b/src/pages/AuthorDetail.vue @@ -40,7 +40,6 @@ export default { // author not found! drop to 404 // timeout to make router finish any his current work, if doing any setTimeout(() => { - // eslint-disable-next-line fp/no-mutating-methods this.$router.push('/404') }, 0) } diff --git a/src/pages/BookManagerForm.vue b/src/pages/BookManagerForm.vue index 35e5a46c..23bc540e 100644 --- a/src/pages/BookManagerForm.vue +++ b/src/pages/BookManagerForm.vue @@ -86,12 +86,9 @@ export default { }) }, save() { - /**/ this.$store.dispatch('saveBook', { book: this.book, roles: this.authorsRoles }).then(() => { - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'BooksManager' }) }) - /**/ }, reloadCover() { this.searching = true diff --git a/src/pages/BookSubmissionForm.vue b/src/pages/BookSubmissionForm.vue index bedf4635..066addfd 100644 --- a/src/pages/BookSubmissionForm.vue +++ b/src/pages/BookSubmissionForm.vue @@ -87,7 +87,6 @@ export default { this.$store.commit('ui/setBusy', true) await this.$store.dispatch('bookSubmissions/submit', this.submissions) this.$store.commit('ui/setBusy', false) - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'SubmissionThankYou', params: { type: 'book' } }) }, async saveDraft() { diff --git a/src/pages/BundleManagerForm.vue b/src/pages/BundleManagerForm.vue index 554182c8..e02c2a03 100644 --- a/src/pages/BundleManagerForm.vue +++ b/src/pages/BundleManagerForm.vue @@ -45,7 +45,6 @@ export default { methods: { save() { this.$store.dispatch('saveBundle', this.bundle).then(() => { - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'BundlesManager' }) }) }, diff --git a/src/pages/BundleSubmissionForm.vue b/src/pages/BundleSubmissionForm.vue index e442b4ac..912f5262 100644 --- a/src/pages/BundleSubmissionForm.vue +++ b/src/pages/BundleSubmissionForm.vue @@ -45,7 +45,6 @@ export default { } this.$store.dispatch('saveBundleSubmissionsDraft', data) .then(() => { - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'Dashboard' }) }) }, @@ -57,7 +56,6 @@ export default { } this.$store.dispatch('submitBundleSubmission', data) .then(() => { - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'Dashboard' }) }) }, diff --git a/src/pages/LogIn.vue b/src/pages/LogIn.vue index 4539068c..b8655180 100644 --- a/src/pages/LogIn.vue +++ b/src/pages/LogIn.vue @@ -71,11 +71,9 @@ export default { '$store.state.user.user'(next, prev) { if (!prev && !!next) { if (this.$can('viewDashboard')) { - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'Dashboard' }) } else { - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'Home' }) } } @@ -163,7 +161,6 @@ export default { password: this.password }) .then(() => { - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'Dashboard' }) }) ) @@ -181,7 +178,6 @@ export default { ...this.signupData, }) .then(() => { - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'Dashboard' }) }) ) @@ -235,7 +231,6 @@ export default { this.active = active this.error = null - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: active === 'signup' ? 'Signup' : active === 'login' ? 'LogIn' diff --git a/src/pages/PasswordReset.vue b/src/pages/PasswordReset.vue index 82904b5d..4852abdc 100644 --- a/src/pages/PasswordReset.vue +++ b/src/pages/PasswordReset.vue @@ -10,7 +10,6 @@ export default { watch: { '$store.state.user.user'(next, prev) { if (!prev && !!next) { - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'Dashboard' }) } } diff --git a/src/pages/PeopleSubmissionForm.vue b/src/pages/PeopleSubmissionForm.vue index f4234bc9..523191e6 100644 --- a/src/pages/PeopleSubmissionForm.vue +++ b/src/pages/PeopleSubmissionForm.vue @@ -87,7 +87,6 @@ export default { this.$store.commit('ui/setBusy', true) await this.$store.dispatch('bookSubmissions/submit', this.submissions) this.$store.commit('ui/setBusy', false) - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'SubmissionThankYou', params: { type: 'people' } }) }, async saveDraft() { diff --git a/src/pages/PersonManagerForm.vue b/src/pages/PersonManagerForm.vue index b4e31f32..d38b486a 100644 --- a/src/pages/PersonManagerForm.vue +++ b/src/pages/PersonManagerForm.vue @@ -78,7 +78,6 @@ export default { }, save() { this.$store.dispatch('savePerson', this.person).then(() => { - // eslint-disable-next-line fp/no-mutating-methods this.$router.push({ name: 'PeopleManager' }) }) }