diff --git a/.eslintrc.json b/.eslintrc.json index 84bff5b..8e44a80 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -6,19 +6,62 @@ "globals": { "browser": true }, - "extends": "eslint:recommended", + "plugins": ["no-unsanitized"], + "extends": ["eslint:recommended"], "parserOptions": { "ecmaVersion": "2017" }, "rules": { + "no-unsanitized/method": "error", + "no-unsanitized/property": "error", "indent": [ "error", - 2 + 2, + { + "CallExpression": + { "arguments": 1 }, + "FunctionDeclaration": + { "parameters": 1 } + } ], "linebreak-style": [ "error", "unix" ], + "object-property-newline": [ + "error" + ], + "no-multi-assign": [ + "error" + ], + "no-new-object": [ + "error" + ], + "func-call-spacing": [ + "error", + "never" + ], + "brace-style": [ + "error", + "1tbs" + ], + "object-curly-newline": [ + "error", + {"multiline": true} + ], + "no-implied-eval": [ + "error" + ], + "operator-linebreak": [ + "error", + "before" + ], + "no-lonely-if": [ + "error" + ], + "no-multi-str": [ + "error" + ], "prefer-const": [ "error" ], @@ -28,6 +71,17 @@ "require-await": [ "error" ], + "spaced-comment": [ + "error", + "always" + ], + "max-len": [ + "error", { + "code": 80, + "tabWidth": 2, + "ignoreUrls": true + } + ], "semi": [ "error", "always" diff --git a/js/capture.js b/js/capture.js index 9cf9014..e233a4a 100644 --- a/js/capture.js +++ b/js/capture.js @@ -5,8 +5,9 @@ const capture = { addListeners() { // listen for each HTTP response - browser.webRequest.onResponseStarted.addListener(this.sendThirdParty, {urls: ['']} - ); + browser.webRequest.onResponseStarted.addListener( + this.sendThirdParty, + {urls: ['']}); // listen for tab updates browser.tabs.onUpdated.addListener(this.sendFirstParty); }, @@ -35,12 +36,10 @@ const capture = { // ignore about:* pages and non-visible tabs if (tab.status === 'complete' && tabUrl.protocol !== 'about:' - && tabId !== browser.tabs.TAB_ID_NONE) - { - const firstPartyData = { - faviconUrl: tab.favIconUrl, - }; - console.log('storage.firstPartyRequest:', tabUrl.hostname, firstPartyData); + && tabId !== browser.tabs.TAB_ID_NONE) { + const firstPartyData = { faviconUrl: tab.favIconUrl }; + console.log('storage.firstPartyRequest:', + tabUrl.hostname, firstPartyData); } } }; \ No newline at end of file diff --git a/package.json b/package.json index dcbc186..a2e5a39 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ }, "homepage": "https://github.com/pauljt/lightbeam-we#readme", "devDependencies": { - "eslint": "^3.19.0" + "eslint": "^3.19.0", + "eslint-plugin-no-unsanitized": "^2.0.0" } }