From 5d97c1710f297cc45ab3079c95ac96f61ebdf8d9 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Fri, 23 Oct 2020 09:58:55 +0100 Subject: [PATCH] Update dependency eslint-plugin-ghost to v2.0.0 no issue - bumps eslint and eslint-plugin-ember versions - octane rules are enabled by default - disabled them in our eslintrc.json so we can switch to warn/error whilst migrating to octane - fixed a couple of linting errors from new/updated rules --- ghost/admin/.eslintrc.js | 13 ++++-- .../app/components/gh-markdown-editor.js | 3 ++ .../app/components/modal-import-members.js | 1 + ghost/admin/app/controllers/member.js | 9 +++- ghost/admin/app/controllers/staff/index.js | 6 +-- ghost/admin/package.json | 2 +- ghost/admin/yarn.lock | 44 +++++++++++-------- 7 files changed, 49 insertions(+), 29 deletions(-) diff --git a/ghost/admin/.eslintrc.js b/ghost/admin/.eslintrc.js index 1dc4cfe352..3fc9fee3df 100644 --- a/ghost/admin/.eslintrc.js +++ b/ghost/admin/.eslintrc.js @@ -18,9 +18,16 @@ module.exports = { rules: { 'no-shadow': ['error'], - // octane 🏎 - 'ghost/ember/classic-decorator-hooks': 'error', - 'ghost/ember/classic-decorator-no-classic-methods': 'error', + // TODO: migrate away from accessing controller in routes + 'ghost/ember/no-controller-access-in-routes': 'off', + + // TODO: enable once we're fully on octane 🏎 + 'ghost/ember/no-assignment-of-untracked-properties-used-in-tracking-contexts': 'off', + 'ghost/ember/no-actions-hash': 'off', + 'ghost/ember/no-classic-classes': 'off', + 'ghost/ember/no-classic-components': 'off', + 'ghost/ember/require-tagless-components': 'off', + 'ghost/ember/no-component-lifecycle-hooks': 'off', // disable linting of `this.get` until there's a reliable autofix 'ghost/ember/use-ember-get-and-set': 'off', diff --git a/ghost/admin/app/components/gh-markdown-editor.js b/ghost/admin/app/components/gh-markdown-editor.js index 63effd5aab..d86eb3f187 100644 --- a/ghost/admin/app/components/gh-markdown-editor.js +++ b/ghost/admin/app/components/gh-markdown-editor.js @@ -9,6 +9,9 @@ import {isEmpty, typeOf} from '@ember/utils'; import {run} from '@ember/runloop'; import {inject as service} from '@ember/service'; +/* eslint-disable ghost/ember/no-side-effects */ +// bug in eslint-plugin-ember? + export default Component.extend(ShortcutsMixin, { config: service(), diff --git a/ghost/admin/app/components/modal-import-members.js b/ghost/admin/app/components/modal-import-members.js index 45f10afa73..7f341d9c7e 100644 --- a/ghost/admin/app/components/modal-import-members.js +++ b/ghost/admin/app/components/modal-import-members.js @@ -7,6 +7,7 @@ import { isUnsupportedMediaTypeError, isVersionMismatchError } from 'ghost-admin/services/ajax'; +// eslint-disable-next-line ghost/ember/no-computed-properties-in-native-classes import {computed} from '@ember/object'; import {htmlSafe} from '@ember/string'; import {isBlank} from '@ember/utils'; diff --git a/ghost/admin/app/controllers/member.js b/ghost/admin/app/controllers/member.js index 9dd692023b..318dacfdb5 100644 --- a/ghost/admin/app/controllers/member.js +++ b/ghost/admin/app/controllers/member.js @@ -2,7 +2,6 @@ import Controller, {inject as controller} from '@ember/controller'; import EmberObject, {action, defineProperty} from '@ember/object'; import boundOneWay from 'ghost-admin/utils/bound-one-way'; import moment from 'moment'; -import {alias} from '@ember/object/computed'; import {inject as service} from '@ember/service'; import {task} from 'ember-concurrency-decorators'; import {tracked} from '@glimmer/tracking'; @@ -27,7 +26,13 @@ export default class MemberController extends Controller { // Computed properties ----------------------------------------------------- - @alias('model') member; + get member() { + return this.model; + } + + set member(member) { + this.model = member; + } get scratchMember() { let scratchMember = EmberObject.create({member: this.member}); diff --git a/ghost/admin/app/controllers/staff/index.js b/ghost/admin/app/controllers/staff/index.js index ffa14b8eb9..2b35efd29c 100644 --- a/ghost/admin/app/controllers/staff/index.js +++ b/ghost/admin/app/controllers/staff/index.js @@ -27,14 +27,12 @@ export default Controller.extend({ sortedActiveUsers: sort('activeUsers', 'userOrder'), sortedSuspendedUsers: sort('suspendedUsers', 'userOrder'), + filteredInvites: computed.filterBy('invites', 'isNew', false), + invites: computed(function () { return this.store.peekAll('invite'); }), - filteredInvites: computed('invites.@each.isNew', function () { - return this.invites.filterBy('isNew', false); - }), - allUsers: computed(function () { return this.store.peekAll('user'); }), diff --git a/ghost/admin/package.json b/ghost/admin/package.json index c4afc36e57..325580be10 100644 --- a/ghost/admin/package.json +++ b/ghost/admin/package.json @@ -103,7 +103,7 @@ "ember-useragent": "0.10.0", "emberx-file-input": "1.2.1", "eslint": "7.11.0", - "eslint-plugin-ghost": "1.5.0", + "eslint-plugin-ghost": "2.0.0", "faker": "5.1.0", "fs-extra": "9.0.1", "glob": "7.1.6", diff --git a/ghost/admin/yarn.lock b/ghost/admin/yarn.lock index 0590ac9bf4..ed3d26dbc0 100644 --- a/ghost/admin/yarn.lock +++ b/ghost/admin/yarn.lock @@ -6468,7 +6468,7 @@ ember-resolver@8.0.2: ember-cli-version-checker "^5.1.1" resolve "^1.17.0" -ember-rfc176-data@^0.3.1, ember-rfc176-data@^0.3.12, ember-rfc176-data@^0.3.13, ember-rfc176-data@^0.3.16: +ember-rfc176-data@^0.3.1, ember-rfc176-data@^0.3.13, ember-rfc176-data@^0.3.15, ember-rfc176-data@^0.3.16: version "0.3.16" resolved "https://registry.yarnpkg.com/ember-rfc176-data/-/ember-rfc176-data-0.3.16.tgz#2ace0ac9cf9016d493a74a1d931643a308679803" integrity sha512-IYAzffS90r2ybAcx8c2qprYfkxa70G+/UPkxMN1hw55DU5S2aLOX6v3umKDZItoRhrvZMCnzwsdfKSrKdC9Wbg== @@ -6845,13 +6845,14 @@ eslint-module-utils@^2.6.0: debug "^2.6.9" pkg-dir "^2.0.0" -eslint-plugin-ember@8.5.1: - version "8.5.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-ember/-/eslint-plugin-ember-8.5.1.tgz#acaeb430e150115350fb184450cd17eaf6bb5d7e" - integrity sha512-92tU1ktJBfwcWIdAzVVuo6gLIGWrf2AtnNyHnw7vBmSVcP00P5hM7fDXL0CaLWblAVIrfik4NrOWCe9sSkh6ww== +eslint-plugin-ember@9.3.0: + version "9.3.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-ember/-/eslint-plugin-ember-9.3.0.tgz#77ec28a0c586ea55bbd30d140c784afcdf59e97b" + integrity sha512-qrzptSwC58HD8211vF8rGu+TRT8XzIsZVm6j4PleuSZqJ6k3VG8FKofQkb4ZBVU9jOJ0lnZCbYqBfjs4Iy/HHw== dependencies: "@ember-data/rfc395-data" "^0.0.4" - ember-rfc176-data "^0.3.12" + ember-rfc176-data "^0.3.15" + lodash.kebabcase "^4.1.1" snake-case "^3.0.3" eslint-plugin-es@^3.0.0: @@ -6862,13 +6863,13 @@ eslint-plugin-es@^3.0.0: eslint-utils "^2.0.0" regexpp "^3.0.0" -eslint-plugin-ghost@1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-ghost/-/eslint-plugin-ghost-1.5.0.tgz#93c8ecbfe3b039b4f89c1383249dbc58d90121e3" - integrity sha512-W+woYN6HIVfMjVCfIsF3EncqJP8rwXIilqciHs22YuhHNOA0IULfb3sO2Fy/Yq2NG0nqco+8FxZIOD3Gu0dp4w== +eslint-plugin-ghost@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-ghost/-/eslint-plugin-ghost-2.0.0.tgz#14e67180188850abf978df772e02bb74b1832374" + integrity sha512-BlygF0CZr/38ena3qztpyCuo7z1KsbbjEz0FO3zjfg+V6Id5wcZsKTaOdFHFZwyDl4kBm5jujFAsWILh/DtNiQ== dependencies: - eslint-plugin-ember "8.5.1" - eslint-plugin-mocha "6.3.0" + eslint-plugin-ember "9.3.0" + eslint-plugin-mocha "8.0.0" eslint-plugin-sort-imports-es6-autofix "0.5.0" eslint-plugin-import@^2.20.1: @@ -6890,13 +6891,13 @@ eslint-plugin-import@^2.20.1: resolve "^1.17.0" tsconfig-paths "^3.9.0" -eslint-plugin-mocha@6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-mocha/-/eslint-plugin-mocha-6.3.0.tgz#72bfd06a5c4323e17e30ef41cd726030e8cdb8fd" - integrity sha512-Cd2roo8caAyG21oKaaNTj7cqeYRWW1I2B5SfpKRp0Ip1gkfwoR1Ow0IGlPWnNjzywdF4n+kHL8/9vM6zCJUxdg== +eslint-plugin-mocha@8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-mocha/-/eslint-plugin-mocha-8.0.0.tgz#7ec5d228bcb3735301701dfbc3376320a1ca3791" + integrity sha512-n67etbWDz6NQM+HnTwZHyBwz/bLlYPOxUbw7bPuCyFujv7ZpaT/Vn6KTAbT02gf7nRljtYIjWcTxK/n8a57rQQ== dependencies: - eslint-utils "^2.0.0" - ramda "^0.27.0" + eslint-utils "^2.1.0" + ramda "^0.27.1" eslint-plugin-node@^11.0.0: version "11.1.0" @@ -9780,6 +9781,11 @@ lodash.isplainobject@^4.0.6: resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" integrity sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs= +lodash.kebabcase@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36" + integrity sha1-hImxyw0p/4gZXM7KRI/21swpXDY= + lodash.keys@^3.0.0: version "3.1.2" resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" @@ -11893,7 +11899,7 @@ raf-pool@~0.1.4: resolved "https://registry.yarnpkg.com/raf-pool/-/raf-pool-0.1.4.tgz#6b9f75ea1903c16e162ffe8c76688f5a625bc2cd" integrity sha512-BBPamTVuSprPq7CUmgxc+ycbsYUtUYnQtJYEfMHXMaostPaNpQzipLfSa/rwjmlgjBPiD7G+I+8W340sLOPu6g== -ramda@^0.27.0: +ramda@^0.27.1: version "0.27.1" resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.27.1.tgz#66fc2df3ef873874ffc2da6aa8984658abacf5c9" integrity sha512-PgIdVpn5y5Yns8vqb8FzBUEYn98V3xcPgawAkkgj0YJ0qDsnHCiNmZYfOGMgOvoB0eWFLpYbhxUR3mxfDIMvpw==