mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
Resolved "already declared in upper scope" linting warnings
no issue - fixed all `no-shadow` linter warnings - changed `no-shadow` eslint rule from `warn` to `error` so we don't re-introduce shadowed variables in the future
This commit is contained in:
parent
c51990c3ae
commit
44b9b0fc94
@ -16,6 +16,8 @@ module.exports = {
|
||||
'plugin:ghost/ember'
|
||||
],
|
||||
rules: {
|
||||
'no-shadow': ['error'],
|
||||
|
||||
// octane 🏎
|
||||
'ghost/ember/classic-decorator-hooks': 'error',
|
||||
'ghost/ember/classic-decorator-no-classic-methods': 'error',
|
||||
|
@ -274,7 +274,7 @@ export default Component.extend({
|
||||
mutations.forEach(addImageLoadListeners);
|
||||
}
|
||||
|
||||
function createMutationObserver(target) {
|
||||
function createMutationObserver(mutationTarget) {
|
||||
let config = {
|
||||
attributes: true,
|
||||
attributeOldValue: false,
|
||||
@ -285,7 +285,7 @@ export default Component.extend({
|
||||
};
|
||||
|
||||
let observer = new MutationObserver(mutationObserved);
|
||||
observer.observe(target, config); // eslint-disable-line ghost/ember/no-observers
|
||||
observer.observe(mutationTarget, config); // eslint-disable-line ghost/ember/no-observers
|
||||
return observer;
|
||||
}
|
||||
|
||||
|
@ -372,14 +372,14 @@ export default Component.extend({
|
||||
mutations.forEach(addInputFocusListeners);
|
||||
}
|
||||
|
||||
function createMutationObserver(target) {
|
||||
function createMutationObserver(mutationTarget) {
|
||||
let config = {
|
||||
childList: true,
|
||||
subtree: true
|
||||
};
|
||||
|
||||
let observer = new MutationObserver(mutationObserved);
|
||||
observer.observe(target, config); // eslint-disable-line ghost/ember/no-observers
|
||||
observer.observe(mutationTarget, config); // eslint-disable-line ghost/ember/no-observers
|
||||
return observer;
|
||||
}
|
||||
|
||||
|
@ -515,14 +515,14 @@ export default Component.extend({
|
||||
return;
|
||||
}
|
||||
|
||||
let operation = function (postEditor) {
|
||||
let operation = function (operationPostEditor) {
|
||||
// strip all formatting aside from links
|
||||
postEditor.removeMarkupFromRange(
|
||||
operationPostEditor.removeMarkupFromRange(
|
||||
editor.activeSection.toRange(),
|
||||
m => m.tagName !== 'a'
|
||||
);
|
||||
|
||||
postEditor.toggleSection(headingTagName);
|
||||
operationPostEditor.toggleSection(headingTagName);
|
||||
};
|
||||
|
||||
this._performEdit(operation, postEditor);
|
||||
@ -670,7 +670,7 @@ export default Component.extend({
|
||||
|
||||
if (typeof shouldDelete === 'string') {
|
||||
let payloadKey = shouldDelete;
|
||||
shouldDelete = card => isBlank(get(card, payloadKey));
|
||||
shouldDelete = cardToDelete => isBlank(get(cardToDelete, payloadKey));
|
||||
}
|
||||
|
||||
if (shouldDelete(card)) {
|
||||
@ -1212,8 +1212,8 @@ export default Component.extend({
|
||||
if (postEditor) {
|
||||
editOperation(postEditor);
|
||||
} else {
|
||||
this.editor.run((postEditor) => {
|
||||
editOperation(postEditor);
|
||||
this.editor.run((operationPostEditor) => {
|
||||
editOperation(operationPostEditor);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -294,7 +294,7 @@ export default Component.extend({
|
||||
}
|
||||
|
||||
for (let section of sections) {
|
||||
let item = section.items.find(item => item.selected);
|
||||
let item = section.items.find(sectionItem => sectionItem.selected);
|
||||
if (item) {
|
||||
return item;
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ export default function cleanTextReplacementHtml(html = '', _options = {}) {
|
||||
throw new Error('cleanTextReplacementHtml() must be passed a `createDocument` function as an option when used in a non-browser environment');
|
||||
}
|
||||
|
||||
options.createDocument = function (html) {
|
||||
options.createDocument = function (documentHtml) {
|
||||
const parser = new Parser();
|
||||
return parser.parseFromString(html, 'text/html');
|
||||
return parser.parseFromString(documentHtml, 'text/html');
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ export const DEFAULT_KEY_COMMANDS = [{
|
||||
let hasReversed = false;
|
||||
specialMarkupTagNames.forEach((tagName) => {
|
||||
// only continue if we're about to delete a special markup
|
||||
let markup = marker.markups.find(markup => markup.tagName.toUpperCase() === tagName);
|
||||
let markup = marker.markups.find(markerMarkup => markerMarkup.tagName.toUpperCase() === tagName);
|
||||
if (markup) {
|
||||
let nextMarker = head.markerIn(1);
|
||||
// ensure we're at the end of the markup not inside it
|
||||
@ -197,7 +197,7 @@ export const DEFAULT_KEY_COMMANDS = [{
|
||||
markdown = markdown.char;
|
||||
}
|
||||
|
||||
let range = editor.range.expandByMarker(marker => !!marker.markups.includes(markup));
|
||||
let range = editor.range.expandByMarker(markerToExpand => !!markerToExpand.markups.includes(markup));
|
||||
|
||||
// replaced markdown (default) will have chars removed when formatted
|
||||
// and added back when the format is removed by backspace
|
||||
|
@ -230,8 +230,7 @@ export default Service.extend({
|
||||
this.set('isDragging', true);
|
||||
utils.applyUserSelect(document.body, 'none');
|
||||
|
||||
let container = this.sourceContainer;
|
||||
let draggableInfo = container.getDraggableInfo(this.grabbedElement);
|
||||
let draggableInfo = this.sourceContainer.getDraggableInfo(this.grabbedElement);
|
||||
|
||||
if (!draggableInfo) {
|
||||
this._resetDrag();
|
||||
@ -261,7 +260,7 @@ export default Service.extend({
|
||||
|
||||
// create the ghost element and cache it's position so avoid costly
|
||||
// getBoundingClientRect calls in the mousemove handler
|
||||
let ghostElement = container.createGhostElement(this.draggableInfo);
|
||||
let ghostElement = this.sourceContainer.createGhostElement(this.draggableInfo);
|
||||
if (ghostElement && ghostElement instanceof HTMLElement) {
|
||||
this._ghostContainerElement.appendChild(ghostElement);
|
||||
let ghostElementRect = ghostElement.getBoundingClientRect();
|
||||
|
@ -78,11 +78,11 @@ export default function mockPages(server) {
|
||||
|
||||
let statusFilter = extractFilterParam('status', filter);
|
||||
|
||||
let collection = pages.all().filter((page) => {
|
||||
let collection = pages.all().filter((pageModel) => {
|
||||
let matchesStatus = true;
|
||||
|
||||
if (!isEmpty(statusFilter)) {
|
||||
matchesStatus = statusFilter.includes(page.status);
|
||||
matchesStatus = statusFilter.includes(pageModel.status);
|
||||
}
|
||||
|
||||
return matchesStatus;
|
||||
|
Loading…
Reference in New Issue
Block a user