diff --git a/.circleci/config.yml b/.circleci/config.yml index f92fd6a..cbc0251 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,6 +28,9 @@ jobs: - run: name: flow command: npm run flow + - run: + name: eslint + command: npm run eslint # - store_artifacts: # path: test-results.xml # prefix: tests diff --git a/.eslintrc.js b/.eslintrc.js index d9d4228..42f2c35 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,7 +1,12 @@ module.exports = { + "parser": "babel-eslint", + "plugins": [ + "flowtype" + ], 'extends': [ // "google", "eslint:recommended", + "plugin:flowtype/recommended", ], 'env': { 'browser': true, diff --git a/package.json b/package.json index 6c5d439..ef2181c 100644 --- a/package.json +++ b/package.json @@ -13,11 +13,13 @@ "@babel/core": "^7.2.2", "@babel/preset-env": "^7.2.3", "@babel/preset-flow": "^7.0.0", + "babel-eslint": "^10.0.1", "clean-webpack-plugin": "^1.0.0", "copy-webpack-plugin": "^4.2.0", "css-loader": "^2.1.0", "eslint": "^5.12.0", "eslint-config-google": "^0.11.0", + "eslint-plugin-flowtype": "^3.2.0", "file-loader": "^3.0.1", "flow-bin": "^0.89.0", "flow-interfaces-chrome": "^0.5.3", diff --git a/src/js/background.js b/src/js/background.js index d32884f..7c2b0c4 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -88,7 +88,7 @@ chrome.commands.onCommand.addListener(command => { } }); -chrome.runtime.onMessage.addListener((message: any, sender: chrome$MessageSender, sendResponse) => { +chrome.runtime.onMessage.addListener((message: any, sender: chrome$MessageSender, sendResponse) => { // eslint-disable-line no-unused-vars if (message.method === METHOD_CAPTURE_WITH_EXTRAS) { const comment = message.comment; const tag_str = message.tag_str; diff --git a/src/js/common.js b/src/js/common.js index 501fcfa..af22273 100644 --- a/src/js/common.js +++ b/src/js/common.js @@ -8,7 +8,7 @@ export function showNotification(text: string, priority: number=0) { Notification.requestPermission(); } else { // TODO ugh. is there no way to show in-browser only notification?? - const notification = new Notification( + new Notification( 'grasp-notification', // $FlowFixMe { diff --git a/src/js/popup.js b/src/js/popup.js index d15361f..0b5e600 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -8,12 +8,12 @@ const COMMENT_ID = 'comment_id'; const TAGS_ID = 'tags_id'; function getComment(): HTMLInputElement { - const comment = ((document.getElementById(COMMENT_ID) : any): HTMLInputElement); + const comment = ((document.getElementById(COMMENT_ID): any): HTMLInputElement); return comment; } function getTags(): HTMLInputElement { - const tags = ((document.getElementById(TAGS_ID) : any): HTMLInputElement); + const tags = ((document.getElementById(TAGS_ID): any): HTMLInputElement); return tags; } @@ -30,7 +30,7 @@ function submitComment () { 'method': METHOD_CAPTURE_WITH_EXTRAS, 'comment': comment_text, 'tag_str': tag_str, - }, resp => { + }, () => { console.log("[popup] captured!"); }); window.close();