Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update NPM Dependencies #405

Merged
merged 5 commits into from Jul 2, 2019
Merged
Changes from 1 commit
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

apply new eslint rules and fix errors

  • Loading branch information
christophertino committed Jun 27, 2019
commit 2ee1a304d39ecb251c2f024e3456ec58e4168f68
@@ -12,3 +12,10 @@ app/content-scripts/vendor/

## Precompiled
app/templates/
build/
cliqz/
dist/
docs/

## Node Modules
node_modules/
@@ -40,40 +40,40 @@ module.exports = {
rules: {
'camelcase': [0],
'class-methods-use-this': [0],
'comma-dangle': ['error', {
'comma-dangle': [2, {
'arrays': 'only-multiline',
'objects': 'only-multiline',
'functions': 'ignore'
}],
'func-names': [0],
'function-paren-newline': [0],
'import/prefer-default-export': [0],
'indent': [1, 'tab', {
'SwitchCase': 1
}],
'linebreak-style': [0],
'lines-between-class-members': [1],
'max-len': [0],
'no-control-regex': [0],
'newline-per-chained-call': [0, { 'ignoreChainWithDepth': 2 }],
'no-mixed-operators': [0],
'no-nested-ternary': [0],
'no-param-reassign': [2, { 'props': false }],
'no-param-reassign': [0], // TODO: enable this check
'no-plusplus': [0],
'no-prototype-builtins': [0],
'no-restricted-syntax': [0],
'no-prototype-builtins': [0], // TODO: enable this check
'no-restricted-syntax': [0], // TODO: enable this check
'no-tabs': [0],
'no-underscore-dangle': [0],
'no-unused-vars': [1],
'no-useless-escape': [1],
'operator-linebreak': [0],
'space-before-function-paren': [2, 'never'],

// Plugin: Import
'import/no-cycle': [0],
'import/prefer-default-export': [0],

// Plugin: React
'react/destructuring-assignment': [0],
'react/jsx-indent': [1, 'tab'],
'react/jsx-indent-props': [1, 'tab'],
'react/no-access-state-in-setstate': [0], // TODO: enable this check
'react/no-danger': [0],
'react/prop-types': [0],

@@ -21,7 +21,7 @@ import {
} from '../AccountConstants';

// Fake the translation function to only return the translation key
global.t = function (str) {
global.t = function(str) {
return str;
};

@@ -24,7 +24,7 @@ const { sendMessage } = msg;
* Use to call init to initialize functionality
* @var {Object} initialized to an object with init method as its property
*/
const AccountPagesContentScript = (function (window) {
const AccountPagesContentScript = (function(window) {
/**
* Initialize functionality of this script.
* @memberOf AccountPagesContentScript
@@ -37,7 +37,7 @@ const AccountPagesContentScript = (function (window) {
'accountPage.getUserSubscriptionData',
'accountPage.logout',
];
const _initialize = function () {
const _initialize = function() {
_listeners.forEach(name => window.addEventListener(name, () => sendMessage(name)));
};

@@ -25,7 +25,7 @@ const { onMessage } = chrome.runtime;
* Use to call init function and initialize Click2PlayContentScript functionality.
* @var {Object} initialized with an object with exported init as its property
*/
const Click2PlayContentScript = (function (win, doc) {
const Click2PlayContentScript = (function(win, doc) {
const C2P_DATA = {};
/**
* Create element for the specified html tag
@@ -35,7 +35,7 @@ const Click2PlayContentScript = (function (win, doc) {
* @param {string} type html tag
* @return {Object} DOM element
*/
const createEl = function (type) {
const createEl = function(type) {
return doc.createElement(type);
};
/**
@@ -46,7 +46,7 @@ const Click2PlayContentScript = (function (win, doc) {
* @param {Object} parent parent DOM element
* @param {...Object} args children DOM element(s)
*/
const appendChild = function (parent, ...args) {
const appendChild = function(parent, ...args) {
for (let i = 0; i < args.length; i++) {
parent.appendChild(args[i]);
}
@@ -63,7 +63,7 @@ const Click2PlayContentScript = (function (win, doc) {
* @param {Object} c2pAppDef replacement data
* @param {string} html a fragment of html to be used in replacement.
*/
const buildC2P = function (c2pFrame, c2pAppDef, html) {
const buildC2P = function(c2pFrame, c2pAppDef, html) {
c2pFrame.addEventListener('load', () => {
const idoc = c2pFrame.contentDocument;

@@ -122,7 +122,7 @@ const Click2PlayContentScript = (function (win, doc) {
* @param {Object} c2p_app an array with replacement data
* @param {string} html a fragment of html to be used in replacement.
*/
const applyC2P = function (app_id, c2p_app, html) {
const applyC2P = function(app_id, c2p_app, html) {
c2p_app.forEach((c2pAppDef, idx) => {
const els = doc.querySelectorAll(c2pAppDef.ele);
for (let i = 0, num_els = els.length; i < num_els; i++) {
@@ -155,7 +155,7 @@ const Click2PlayContentScript = (function (win, doc) {
* @memberof Click2PlayContentScript
* @package
*/
const _initialize = function () {
const _initialize = function() {
onMessage.addListener((request, sender, sendResponse) => {
if (request.source === 'cliqz-content-script') {
return false;
@@ -37,14 +37,14 @@ const { onMessage } = chrome.runtime;
* Use this variable to call init and initialize functionality of this script.
* @var {Object} initialized with an object with init as its property
*/
const GhosteryDotComContentScript = (function (window) {
const GhosteryDotComContentScript = (function(window) {
/**
* Update https://www.ghostery.com/Products page to signify
* that Ghostery extension is installed.
* @memberOf GhosteryDotComContentScript
* @package
*/
const productsPage = function () {
const productsPage = function() {
const $installButton = $('#ghostery-extension-versions .install-button').not('.disabled');
$installButton.addClass('success').text('Installed ✓');
$installButton.removeAttr('onclick');
@@ -59,7 +59,7 @@ const GhosteryDotComContentScript = (function (window) {
* @memberOf GhosteryDotComContentScript
* @package
*/
const toggleBlocking = function (blocked, duration) {
const toggleBlocking = function(blocked, duration) {
if (!blocked) {
$('#app-global-blocking').animate({ 'background-position-x': '-17px' }, {
duration,
@@ -83,7 +83,7 @@ const GhosteryDotComContentScript = (function (window) {
* @memberOf GhosteryDotComContentScript
* @package
*/
const appsPages = function () {
const appsPages = function() {
const $appGlobalBlocking = $('#app-global-blocking');
const $blockingBox = $('#blockingbox');
const app_id = $blockingBox.data('id');
@@ -145,7 +145,7 @@ const GhosteryDotComContentScript = (function (window) {
* @memberOf GhosteryDotComContentScript
* @package
*/
const _initialize = function () {
const _initialize = function() {
// initialize products page
if ($('section.products-template').length) {
productsPage();
@@ -32,13 +32,13 @@ const IS_EDGE = (globals.BROWSER_INFO.name === 'edge');
* Use to call init to initialize functionality
* @var {Object} initialized to an object with init method as its property
*/
const NotificationsContentScript = (function (win, doc) {
const NotificationsContentScript = (function(win, doc) {
const ALERT_ID = 'ALERT_ID_6AEC0607-8CC8-4904-BDEB-00F947E5E3C2';
let NOTIFICATION_TRANSLATIONS = {};
let CMP_DATA = {};
let CSS_INJECTED = false;
let ALERT_SHOWN = false;
const createEl = function (type) {
const createEl = function(type) {
return doc.createElement(type);
};
/**
@@ -49,7 +49,7 @@ const NotificationsContentScript = (function (win, doc) {
* @param {Object} parent parent DOM element
* @param {...Object} args children DOM element(s)
*/
const appendChild = function (parent, ...args) {
const appendChild = function(parent, ...args) {
for (let i = 0; i < args.length; i++) {
parent.appendChild(args[i]);
}
@@ -59,7 +59,7 @@ const NotificationsContentScript = (function (win, doc) {
* @memberOf NotificationsContentScript
* @package
*/
const injectCSS = function () {
const injectCSS = function() {
const style = createEl('style');
const imp = ' !important;';
const reset = 'padding:0;margin:0;font:13px Arial,Helvetica;text-transform:none;font-size: 100%;vertical-align:baseline;line-height:normal;color:#fff;position:static;';
@@ -130,7 +130,7 @@ const NotificationsContentScript = (function (win, doc) {
* @memberOf NotificationsContentScript
* @package
*/
const removeAlert = function () {
const removeAlert = function() {
const el = doc.getElementById(ALERT_ID);
if (el) {
el.parentNode.removeChild(el);
@@ -145,7 +145,7 @@ const NotificationsContentScript = (function (win, doc) {
*
* @return {Object} styled div DOM element
*/
const createCloseButton = function () {
const createCloseButton = function() {
const closeButton = createEl('div');

// .button class
@@ -197,7 +197,7 @@ const NotificationsContentScript = (function (win, doc) {
*
* @return {Object} styled div DOM element
*/
const createNotificationHeader = function () {
const createNotificationHeader = function() {
const header = createEl('div');
header.style.backgroundColor = '#00aef0';
header.style.borderTopLeftRadius = '6px';
@@ -241,7 +241,7 @@ const NotificationsContentScript = (function (win, doc) {
*
* @return {Object} styled div DOM element
*/
const createNotificationContent = function (message, linkUrl, linkText, linkClickFunc) {
const createNotificationContent = function(message, linkUrl, linkText, linkClickFunc) {
const content = createEl('div');
content.style.borderRadius = '6px';
content.style.setProperty(
@@ -306,7 +306,7 @@ const NotificationsContentScript = (function (win, doc) {
*
* @return {Object} styled div DOM element
*/
const createUpgradeNotificationContent = function (
const createUpgradeNotificationContent = function(
imageData, title, message, linkUrl, linkText
) {
const content = createEl('div');
@@ -400,7 +400,7 @@ const NotificationsContentScript = (function (win, doc) {
`;

buttonSpan.addEventListener('click', () => {
const callback = function () {
const callback = function() {
removeAlert();
};
chrome.runtime.sendMessage({
@@ -423,7 +423,7 @@ const NotificationsContentScript = (function (win, doc) {
*
* @return {Object} styled div DOM element
*/
const createAlert = function () {
const createAlert = function() {
let alert_div = doc.getElementById(ALERT_ID);
if (alert_div) {
alert_div.parentNode.removeChild(alert_div);
@@ -458,7 +458,7 @@ const NotificationsContentScript = (function (win, doc) {
* @memberOf NotificationsContentScript
* @package
*/
const showBrowseWindow = function (translations) {
const showBrowseWindow = function(translations) {
if (ALERT_SHOWN) {
return;
}
@@ -587,7 +587,7 @@ const NotificationsContentScript = (function (win, doc) {
* @memberOf NotificationsContentScript
* @package
*/
const updateBrowseWindow = function (result = {}) {
const updateBrowseWindow = function(result = {}) {
const s = doc.getElementById('ghostery-browse-window-span');
while (s.firstChild) {
s.removeChild(s.firstChild);
@@ -610,7 +610,7 @@ const NotificationsContentScript = (function (win, doc) {
* @memberOf NotificationsContentScript
* @package
*/
const exportFile = function (content) {
const exportFile = function(content) {
const textFileAsBlob = new Blob([content], { type: 'text/plain' });
const d = new Date();
const fileNameToSaveAs = `Ghostery-Backup-${d.getMonth() + 1}-${d.getDate()}-${d.getFullYear()}.ghost`;
@@ -639,7 +639,7 @@ const NotificationsContentScript = (function (win, doc) {
*
* @return {boolean}
*/
const _isElementInViewport = function (el) {
const _isElementInViewport = function(el) {
const rect = el.getBoundingClientRect();

return (
@@ -660,7 +660,7 @@ const NotificationsContentScript = (function (win, doc) {
* @param {string} type the type of notification to show
* @param {object} options message data to pass to the notification
*/
const showAlert = function (type, options) {
const showAlert = function(type, options) {
if (ALERT_SHOWN) {
return;
}
@@ -727,7 +727,7 @@ const NotificationsContentScript = (function (win, doc) {
*
* @return {boolean}
*/
const _initialize = function () {
const _initialize = function() {
onMessage.addListener((request, sender, sendResponse) => {
if (request.source === 'cliqz-content-script') {
return false;
@@ -27,14 +27,14 @@ const { sendMessage } = msg;
* Use to call init to initialize functionality
* @var {Object} initialized to an object with init method as its property
*/
const PageInfo = (function (window, document) {
const PageInfo = (function(window, document) {
let state = document.readyState;
/**
* Calculate page domain and latency. Send pageInfo to background.js.
* @memberOf PagePerformanceContentScript
* @package
*/
const analyzePageInfo = function () {
const analyzePageInfo = function() {
const { host, pathname, protocol } = document.location;
const pTime = (performance.timing.domContentLoadedEventStart - performance.timing.requestStart);
const pageLatency = pTime || 0;
@@ -57,11 +57,11 @@ const PageInfo = (function (window, document) {
* @memberOf PagePerformanceContentScript
* @package
*/
const _initialize = function () {
const _initialize = function() {
// manually check to see if the onLoad event has fired, since this script runs at document_idle
// and does not guarantee that onLoad has triggered
if (state !== 'complete') {
document.onreadystatechange = function () {
document.onreadystatechange = function() {
state = document.readyState;
if (state === 'complete') {
analyzePageInfo();
ProTip! Use n and p to navigate between commits in a pull request.