Fix eslint rules

This commit is contained in:
Pavel Dohnal
2019-01-23 14:19:23 +01:00
parent 91c974e08f
commit 20ae36cf0b
6 changed files with 9 additions and 15 deletions

View File

@@ -20,16 +20,11 @@
"no-script-url": 0,
"import/extensions": 0, // we wouldn't be able to import jQuery without this line
"react/destructuring-assignment": 0, // that would be too many changes to fix this one
"prefer-destructuring": 0, // that would be too many changes to fix this one
"jsx-a11y/label-has-for": [2, {
"required": {"some": ["nesting", "id"]} // some of our labels are hidden and we cannot nest those
}],
"jsx-a11y/anchor-is-valid": 0, // cannot fix this one, it would break wprdpress themes
"no-restricted-globals": 0, // todo
"prefer-destructuring": 0, // todo
"react/default-props-match-prop-types": 0 // todo
"jsx-a11y/anchor-is-valid": 0 // cannot fix this one, it would break wprdpress themes
}
}

View File

@@ -20,7 +20,7 @@ export const fromDom = element => html2canvas(element, {
*/
export const fromUrl = url => new Promise((resolve, reject) => {
const iframe = document.createElement('iframe');
const protocol = location.href.startsWith('https://') ? 'https:' : 'http:';
const protocol = document.location.href.startsWith('https://') ? 'https:' : 'http:';
iframe.src = protocol + url.replace(/^https?:/, '');
iframe.style.opacity = 0;
iframe.scrolling = 'no';

View File

@@ -158,8 +158,7 @@ class FormFieldDate extends React.Component {
let property = null;
if (matches !== null && matches.length === 3) {
field = matches[1];
property = matches[2];
[, field, property] = matches;
const value = Number(e.target.value);

View File

@@ -28,7 +28,7 @@ function Intro() {
}
// don't show on small screens
if (innerWidth <= 960) {
if (window.innerWidth <= 960) {
return;
}
@@ -61,8 +61,8 @@ function Intro() {
if (getComputedStyle(targetElement).getPropertyValue('position') === 'fixed') {
const helperLayer = document.querySelector('.introjs-helperLayer');
const referenceLayer = document.querySelector('.introjs-tooltipReferenceLayer');
referenceLayer.style.top = `${parseInt(referenceLayer.style.top, 10) - pageYOffset}px`;
helperLayer.style.top = `${parseInt(helperLayer.style.top, 10) - pageYOffset}px`;
referenceLayer.style.top = `${parseInt(referenceLayer.style.top, 10) - window.pageYOffset}px`;
helperLayer.style.top = `${parseInt(helperLayer.style.top, 10) - window.pageYOffset}px`;
}
});

View File

@@ -19,7 +19,7 @@ const renderBreadcrumb = (newsletterType) => {
const initializeEditor = (config) => {
const editorContainer = document.getElementById('mailpoet_editor');
const getUrlParam = param => (location.search.split(`${param}=`)[1] || '').split('&')[0];
const getUrlParam = param => (document.location.search.split(`${param}=`)[1] || '').split('&')[0];
if (!editorContainer || !window.EditorApplication) return;

View File

@@ -131,7 +131,7 @@ const QueueMixin = {
let progressBarWidth = 0;
if (isNaN(percentage)) {
if (percentage) {
percentage = MailPoet.I18n.t('noSubscribers');
} else {
progressBarWidth = percentage;