mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
Upgraded eslint-plugin-ghost
and fixed new linter errors
no issue - update imports for `@ember-data` package (https://github.com/emberjs/rfcs/blob/master/text/0395-ember-data-packages.md) - use `computed.reads` where applicable (https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/require-computed-macros.md) - fix usage of `scheduleOnce` so that functions are only scheduled once (https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/no-incorrect-calls-with-inline-anonymous-functions.md)
This commit is contained in:
parent
2231dd84c2
commit
ba4c53134f
@ -17,6 +17,9 @@ module.exports = {
|
||||
],
|
||||
rules: {
|
||||
// disable linting of `this.get` until there's a reliable autofix
|
||||
'ghost/ember/use-ember-get-and-set': 'off'
|
||||
'ghost/ember/use-ember-get-and-set': 'off',
|
||||
|
||||
// disable linting of mixins until we migrate away
|
||||
'ghost/ember/no-new-mixins': 'off'
|
||||
}
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
import AjaxServiceSupport from 'ember-ajax/mixins/ajax-support';
|
||||
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
|
||||
import RESTAdapter from 'ember-data/adapters/rest';
|
||||
import RESTAdapter from '@ember-data/adapter/rest';
|
||||
import ghostPaths from 'ghost-admin/utils/ghost-paths';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
|
@ -212,11 +212,8 @@ export default Component.extend(ShortcutsMixin, {
|
||||
if (!isEmpty(uploadedImageUrls) && uploadedImageUrls !== this._uploadedImageUrls) {
|
||||
this._uploadedImageUrls = uploadedImageUrls;
|
||||
|
||||
// must be done afterRender to avoid double modify of mobiledoc in
|
||||
// a single render
|
||||
run.scheduleOnce('afterRender', this, () => {
|
||||
this._insertImages(uploadedImageUrls);
|
||||
});
|
||||
// must be done afterRender to avoid double modify of mobiledoc in a single render
|
||||
run.scheduleOnce('afterRender', this, this._insertImages, uploadedImageUrls);
|
||||
}
|
||||
|
||||
// focus the editor when the markdown value changes, this is necessary
|
||||
|
@ -1,5 +1,6 @@
|
||||
import Component from '@ember/component';
|
||||
import {computed} from '@ember/object';
|
||||
import {reads} from '@ember/object/computed';
|
||||
import {inject as service} from '@ember/service';
|
||||
import {set} from '@ember/object';
|
||||
|
||||
@ -11,6 +12,8 @@ export default Component.extend({
|
||||
config: service(),
|
||||
mediaQueries: service(),
|
||||
|
||||
defaultContentVisibility: reads('settings.defaultContentVisibility'),
|
||||
|
||||
mailgunRegion: computed('settings.bulkEmailSettings.baseUrl', function () {
|
||||
if (!this.settings.get('bulkEmailSettings.baseUrl')) {
|
||||
return US;
|
||||
@ -58,10 +61,6 @@ export default Component.extend({
|
||||
return !!bulkEmailSettings.isConfig;
|
||||
}),
|
||||
|
||||
defaultContentVisibility: computed('settings.defaultContentVisibility', function () {
|
||||
return this.get('settings.defaultContentVisibility');
|
||||
}),
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.set('mailgunRegions', [US, EU]);
|
||||
|
@ -52,9 +52,7 @@ export default Component.extend(ValidationState, {
|
||||
// enter key
|
||||
if (event.keyCode === 13 && this.get('navItem.isNew')) {
|
||||
event.preventDefault();
|
||||
run.scheduleOnce('actions', this, function () {
|
||||
this.send('addItem', this.get('navItem'));
|
||||
});
|
||||
run.scheduleOnce('actions', this, this.send, 'addItem', this.navItem);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1,9 +1,9 @@
|
||||
import $ from 'jquery';
|
||||
import ModalComponent from 'ghost-admin/components/modal-base';
|
||||
import ValidationEngine from 'ghost-admin/mixins/validation-engine';
|
||||
import {computed} from '@ember/object';
|
||||
import {htmlSafe} from '@ember/string';
|
||||
import {isVersionMismatchError} from 'ghost-admin/services/ajax';
|
||||
import {reads} from '@ember/object/computed';
|
||||
import {inject as service} from '@ember/service';
|
||||
import {task} from 'ember-concurrency';
|
||||
|
||||
@ -16,9 +16,7 @@ export default ModalComponent.extend(ValidationEngine, {
|
||||
|
||||
authenticationError: null,
|
||||
|
||||
identification: computed('session.user.email', function () {
|
||||
return this.get('session.user.email');
|
||||
}),
|
||||
identification: reads('session.user.email'),
|
||||
|
||||
actions: {
|
||||
confirm() {
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* eslint-disable ghost/ember/alias-model-in-controller */
|
||||
import Controller, {inject as controller} from '@ember/controller';
|
||||
// TODO: remove usage of Ember Data's private `Errors` class when refactoring validations
|
||||
// eslint-disable-next-line
|
||||
import DS from 'ember-data';
|
||||
import Ember from 'ember';
|
||||
import RSVP from 'rsvp';
|
||||
|
@ -1,9 +1,11 @@
|
||||
// TODO: remove usage of Ember Data's private `Errors` class when refactoring validations
|
||||
// eslint-disable-next-line
|
||||
import DS from 'ember-data';
|
||||
import IntegrationValidator from 'ghost-admin/validators/integration';
|
||||
import InviteUserValidator from 'ghost-admin/validators/invite-user';
|
||||
import MemberValidator from 'ghost-admin/validators/member';
|
||||
import Mixin from '@ember/object/mixin';
|
||||
import Model from 'ember-data/model';
|
||||
import Model from '@ember-data/model';
|
||||
import NavItemValidator from 'ghost-admin/validators/nav-item';
|
||||
import PostValidator from 'ghost-admin/validators/post';
|
||||
import RSVP from 'rsvp';
|
||||
|
@ -1,5 +1,4 @@
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import Model, {attr} from '@ember-data/model';
|
||||
|
||||
export default Model.extend({
|
||||
resourceId: attr('string'),
|
||||
|
@ -1,6 +1,4 @@
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import {belongsTo} from 'ember-data/relationships';
|
||||
import Model, {attr, belongsTo} from '@ember-data/model';
|
||||
|
||||
export default Model.extend({
|
||||
type: attr('string'),
|
||||
|
@ -1,6 +1,4 @@
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import {belongsTo} from 'ember-data/relationships';
|
||||
import Model, {attr, belongsTo} from '@ember-data/model';
|
||||
import {equal} from '@ember/object/computed';
|
||||
|
||||
export default Model.extend({
|
||||
|
@ -1,8 +1,6 @@
|
||||
import Model from 'ember-data/model';
|
||||
import Model, {attr, hasMany} from '@ember-data/model';
|
||||
import ValidationEngine from 'ghost-admin/mixins/validation-engine';
|
||||
import attr from 'ember-data/attr';
|
||||
import {computed} from '@ember/object';
|
||||
import {hasMany} from 'ember-data/relationships';
|
||||
|
||||
export default Model.extend(ValidationEngine, {
|
||||
validationType: 'integration',
|
||||
|
@ -1,6 +1,4 @@
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import {belongsTo} from 'ember-data/relationships';
|
||||
import Model, {attr, belongsTo} from '@ember-data/model';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default Model.extend({
|
||||
|
@ -1,6 +1,5 @@
|
||||
import Model from 'ember-data/model';
|
||||
import Model, {attr} from '@ember-data/model';
|
||||
import ValidationEngine from 'ghost-admin/mixins/validation-engine';
|
||||
import attr from 'ember-data/attr';
|
||||
|
||||
export default Model.extend(ValidationEngine, {
|
||||
validationType: 'member',
|
||||
|
@ -1,5 +1,4 @@
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import Model, {attr} from '@ember-data/model';
|
||||
|
||||
export default Model.extend({
|
||||
custom: attr('boolean'),
|
||||
|
@ -1,13 +1,11 @@
|
||||
import Ember from 'ember';
|
||||
import Model from 'ember-data/model';
|
||||
import Model, {attr, belongsTo, hasMany} from '@ember-data/model';
|
||||
import ValidationEngine from 'ghost-admin/mixins/validation-engine';
|
||||
import attr from 'ember-data/attr';
|
||||
import boundOneWay from 'ghost-admin/utils/bound-one-way';
|
||||
import moment from 'moment';
|
||||
import {belongsTo, hasMany} from 'ember-data/relationships';
|
||||
import {compare} from '@ember/utils';
|
||||
import {computed, observer} from '@ember/object';
|
||||
import {equal, filterBy} from '@ember/object/computed';
|
||||
import {equal, filterBy, reads} from '@ember/object/computed';
|
||||
import {isBlank} from '@ember/utils';
|
||||
import {on} from '@ember/object/evented';
|
||||
import {inject as service} from '@ember/service';
|
||||
@ -115,9 +113,7 @@ export default Model.extend(Comparable, ValidationEngine, {
|
||||
publishedBy: belongsTo('user', {async: true}),
|
||||
tags: hasMany('tag', {embedded: 'always', async: false}),
|
||||
|
||||
primaryAuthor: computed('authors.[]', function () {
|
||||
return this.get('authors.firstObject');
|
||||
}),
|
||||
primaryAuthor: reads('authors.firstObject'),
|
||||
|
||||
scratch: null,
|
||||
titleScratch: null,
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* eslint-disable camelcase */
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import Model, {attr} from '@ember-data/model';
|
||||
import {computed} from '@ember/object';
|
||||
|
||||
export default Model.extend({
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* eslint-disable camelcase */
|
||||
import Model from 'ember-data/model';
|
||||
import Model, {attr} from '@ember-data/model';
|
||||
import ValidationEngine from 'ghost-admin/mixins/validation-engine';
|
||||
import attr from 'ember-data/attr';
|
||||
|
||||
export default Model.extend(ValidationEngine, {
|
||||
validationType: 'setting',
|
||||
|
@ -1,6 +1,5 @@
|
||||
import Model from 'ember-data/model';
|
||||
import Model, {attr} from '@ember-data/model';
|
||||
import ValidationEngine from 'ghost-admin/mixins/validation-engine';
|
||||
import attr from 'ember-data/attr';
|
||||
import {equal} from '@ember/object/computed';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import Model, {attr} from '@ember-data/model';
|
||||
import {computed} from '@ember/object';
|
||||
import {isBlank} from '@ember/utils';
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
/* eslint-disable camelcase */
|
||||
import Model from 'ember-data/model';
|
||||
import Model, {attr, hasMany} from '@ember-data/model';
|
||||
import ValidationEngine from 'ghost-admin/mixins/validation-engine';
|
||||
import attr from 'ember-data/attr';
|
||||
import {computed} from '@ember/object';
|
||||
import {equal, or} from '@ember/object/computed';
|
||||
import {hasMany} from 'ember-data/relationships';
|
||||
import {inject as service} from '@ember/service';
|
||||
import {task} from 'ember-concurrency';
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
import Model from 'ember-data/model';
|
||||
import Model, {attr, belongsTo} from '@ember-data/model';
|
||||
import ValidationEngine from 'ghost-admin/mixins/validation-engine';
|
||||
import attr from 'ember-data/attr';
|
||||
import {belongsTo} from 'ember-data/relationships';
|
||||
|
||||
export default Model.extend(ValidationEngine, {
|
||||
validationType: 'webhook',
|
||||
|
@ -207,9 +207,7 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, {
|
||||
if (transition) {
|
||||
transition.send('authorizationFailed');
|
||||
} else {
|
||||
run.scheduleOnce('routerTransitions', this, function () {
|
||||
this.send('authorizationFailed');
|
||||
});
|
||||
run.scheduleOnce('routerTransitions', this, 'send', 'authorizationFailed');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1,3 +1,5 @@
|
||||
// TODO: remove usage of Ember Data's private `Errors` class when refactoring validations
|
||||
// eslint-disable-next-line
|
||||
import DS from 'ember-data';
|
||||
import EmberObject from '@ember/object';
|
||||
import Route from '@ember/routing/route';
|
||||
|
@ -1,3 +1,5 @@
|
||||
// TODO: remove usage of Ember Data's private `Errors` class when refactoring validations
|
||||
// eslint-disable-next-line
|
||||
import DS from 'ember-data';
|
||||
import EmberObject from '@ember/object';
|
||||
import RSVP from 'rsvp';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import RESTSerializer from 'ember-data/serializers/rest';
|
||||
import RESTSerializer from '@ember-data/serializer/rest';
|
||||
import {camelize, decamelize, underscore} from '@ember/string';
|
||||
import {pluralize} from 'ember-inflector';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import ApplicationSerializer from './application';
|
||||
import EmbeddedRecordsMixin from 'ember-data/serializers/embedded-records-mixin';
|
||||
import {EmbeddedRecordsMixin} from '@ember-data/serializer/rest';
|
||||
|
||||
export default ApplicationSerializer.extend(EmbeddedRecordsMixin, {
|
||||
attrs: {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* eslint-disable camelcase */
|
||||
import ApplicationSerializer from 'ghost-admin/serializers/application';
|
||||
import EmbeddedRecordsMixin from 'ember-data/serializers/embedded-records-mixin';
|
||||
import {EmbeddedRecordsMixin} from '@ember-data/serializer/rest';
|
||||
import {pluralize} from 'ember-inflector';
|
||||
|
||||
export default ApplicationSerializer.extend(EmbeddedRecordsMixin, {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import ApplicationSerializer from 'ghost-admin/serializers/application';
|
||||
import EmbeddedRecordsMixin from 'ember-data/serializers/embedded-records-mixin';
|
||||
import {EmbeddedRecordsMixin} from '@ember-data/serializer/rest';
|
||||
import {pluralize} from 'ember-inflector';
|
||||
|
||||
export default ApplicationSerializer.extend(EmbeddedRecordsMixin, {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Transform from 'ember-data/transform';
|
||||
import Transform from '@ember-data/serializer/transform';
|
||||
|
||||
export default Transform.extend({
|
||||
deserialize(serialized) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Transform from 'ember-data/transform';
|
||||
import Transform from '@ember-data/serializer/transform';
|
||||
|
||||
export default Transform.extend({
|
||||
deserialize(serialized) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import MemberSubscription from 'ghost-admin/models/member-subscription';
|
||||
import Transform from 'ember-data/transform';
|
||||
import Transform from '@ember-data/serializer/transform';
|
||||
import {A as emberA, isArray as isEmberArray} from '@ember/array';
|
||||
|
||||
export default Transform.extend({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Transform from 'ember-data/transform';
|
||||
import Transform from '@ember-data/serializer/transform';
|
||||
import moment from 'moment';
|
||||
|
||||
export default Transform.extend({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Transform from 'ember-data/transform';
|
||||
import Transform from '@ember-data/serializer/transform';
|
||||
import moment from 'moment';
|
||||
|
||||
export default Transform.extend({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import NavigationItem from 'ghost-admin/models/navigation-item';
|
||||
import Transform from 'ember-data/transform';
|
||||
import Transform from '@ember-data/serializer/transform';
|
||||
import {A as emberA, isArray as isEmberArray} from '@ember/array';
|
||||
|
||||
export default Transform.extend({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Transform from 'ember-data/transform';
|
||||
import Transform from '@ember-data/serializer/transform';
|
||||
|
||||
export default Transform.extend({
|
||||
deserialize(serialized) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* eslint-disable camelcase */
|
||||
import SlackObject from 'ghost-admin/models/slack-integration';
|
||||
import Transform from 'ember-data/transform';
|
||||
import Transform from '@ember-data/serializer/transform';
|
||||
import {isArray as isEmberArray} from '@ember/array';
|
||||
import {isEmpty} from '@ember/utils';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Transform from 'ember-data/transform';
|
||||
import Transform from '@ember-data/serializer/transform';
|
||||
|
||||
export default Transform.extend({
|
||||
deserialize(serialized) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* eslint-disable camelcase */
|
||||
import Transform from 'ember-data/transform';
|
||||
import Transform from '@ember-data/serializer/transform';
|
||||
import UnsplashObject from 'ghost-admin/models/unsplash-integration';
|
||||
|
||||
const DEFAULT_SETTINGS = {
|
||||
|
@ -117,9 +117,7 @@ export default Component.extend({
|
||||
if (isBlank(this.payload.code)) {
|
||||
// afterRender is required to avoid double modification of `isSelected`
|
||||
// TODO: see if there's a way to avoid afterRender
|
||||
run.scheduleOnce('afterRender', this, function () {
|
||||
this.deleteCard();
|
||||
});
|
||||
run.scheduleOnce('afterRender', this, this.deleteCard);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -72,9 +72,7 @@ export default Component.extend({
|
||||
if (isBlank(this.payload.html)) {
|
||||
// afterRender is required to avoid double modification of `isSelected`
|
||||
// TODO: see if there's a way to avoid afterRender
|
||||
run.scheduleOnce('afterRender', this, function () {
|
||||
this.deleteCard();
|
||||
});
|
||||
run.scheduleOnce('afterRender', this, this.deleteCard);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -89,9 +89,7 @@ export default Component.extend({
|
||||
if (isBlank(this.payload.markdown)) {
|
||||
// afterRender is required to avoid double modification of `isSelected`
|
||||
// TODO: see if there's a way to avoid afterRender
|
||||
run.scheduleOnce('afterRender', this, function () {
|
||||
this.deleteCard();
|
||||
});
|
||||
run.scheduleOnce('afterRender', this, this.deleteCard);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -99,7 +99,7 @@
|
||||
"ember-useragent": "0.9.1",
|
||||
"emberx-file-input": "1.2.1",
|
||||
"eslint": "6.8.0",
|
||||
"eslint-plugin-ghost": "0.6.0",
|
||||
"eslint-plugin-ghost": "1.0.0",
|
||||
"faker": "4.1.0",
|
||||
"fs-extra": "8.1.0",
|
||||
"glob": "7.1.6",
|
||||
|
@ -1,3 +1,5 @@
|
||||
// TODO: remove usage of Ember Data's private `Errors` class when refactoring validations
|
||||
// eslint-disable-next-line
|
||||
import DS from 'ember-data';
|
||||
import EmberObject from '@ember/object';
|
||||
import Service from '@ember/service';
|
||||
|
@ -1,3 +1,5 @@
|
||||
// TODO: remove usage of Ember Data's private `Errors` class when refactoring validations
|
||||
// eslint-disable-next-line
|
||||
import DS from 'ember-data';
|
||||
import EmberObject from '@ember/object';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user