From f9f5f0affaddc70bba24f739033e443003d16f11 Mon Sep 17 00:00:00 2001 From: SirStendec Date: Fri, 30 Mar 2018 17:58:56 -0400 Subject: [PATCH] The Big Linting Commit. * Add linting for Vue files. * Fix a bunch of linting problems in Vue files. * Update README with notes about configuring editors. --- .eslintrc.js | 25 +- README.md | 37 +- package-lock.json | 23 ++ package.json | 2 + .../main_menu/components/badge-visibility.vue | 130 ++++--- .../main_menu/components/changelog.vue | 24 +- .../main_menu/components/feedback-page.vue | 37 +- .../main_menu/components/filter-editor.vue | 92 ++--- .../main_menu/components/home-page.vue | 132 ++++---- .../main_menu/components/main-menu.vue | 181 +++++----- .../main_menu/components/menu-container.vue | 30 +- .../main_menu/components/menu-page.vue | 88 +++-- .../main_menu/components/menu-tree.vue | 93 +++-- .../main_menu/components/profile-editor.vue | 161 +++++---- .../main_menu/components/profile-manager.vue | 177 +++++----- .../main_menu/components/profile-selector.vue | 127 +++---- .../components/setting-check-box.vue | 71 ++-- .../main_menu/components/setting-hotkey.vue | 46 +-- .../components/setting-radio-buttons.vue | 37 +- .../components/setting-select-box.vue | 81 ++--- .../main_menu/components/setting-text-box.vue | 71 ++-- .../twitch-twilight/modules/host-options.vue | 317 ++++++++++-------- src/std-components/tab-container.vue | 103 +++--- 23 files changed, 1114 insertions(+), 971 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 672132ef..722fe5a8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,9 +3,13 @@ module.exports = { "browser": true, "es6": true }, - "extends": "eslint:recommended", - "parser": "babel-eslint", + "extends": [ + "eslint:recommended", + "plugin:vue/recommended" + ], + "plugins": ["vue"], "parserOptions": { + "parser": "babel-eslint", "ecmaVersion": 8, "sourceType": "module" }, @@ -62,6 +66,7 @@ module.exports = { "no-useless-constructor": ["error"], "no-useless-rename": ["error"], "no-var": ["error"], + "no-cond-assign": ["warn"], "object-shorthand": ["warn"], "prefer-arrow-callback": ["warn", {"allowUnboundThis": true}], "prefer-const": ["warn", {"ignoreReadBeforeAssign": true}], @@ -72,7 +77,7 @@ module.exports = { "yield-star-spacing": ["warn"], "indent": [ - "error", + "warn", "tab", { "SwitchCase": 1 @@ -89,6 +94,20 @@ module.exports = { "avoidEscape": true, "allowTemplateLiterals": true } + ], + "vue/html-indent": [ + "warn", + "tab" + ], + "vue/max-attributes-per-line": "off", + "vue/require-prop-types": "off", + "vue/require-default-prop": "off", + "vue/html-closing-bracket-newline": [ + "error", + { + "singleline": "never", + "multiline": "always" + } ] } }; \ No newline at end of file diff --git a/README.md b/README.md index 4a92dcdb..270f4973 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ FrankerFaceZ ============ -Copyright (c) 2017 Dan Salvato LLC +Copyright (c) 2018 Dan Salvato LLC Licensed under the Apache License, Version 2.0. See LICENSE. @@ -13,17 +13,40 @@ FrankerFaceZ uses node.js to manage development dependencies and to run an HTTP server for development. To get everything you need: 1. Install node.js and npm -2. Run ```npm install``` within the FrankerFaceZ directory. +2. Run `npm install` within the FrankerFaceZ directory. -From there, you can use npm to build the extension from source simply by -running ```npm run build```. For development, you can instruct gulp to watch -the source files for changes and re-build automatically with ```npm start``` +From there, you can use npm to build FrankerFaceZ from source simply by +running `npm run build`. For development, you can instruct gulp to watch +the source files for changes and re-build automatically with `npm start` FrankerFaceZ comes with a local development server that listens on port 8000 and it serves up local development copies of files, falling back to the CDN when a local copy of a file isn't present. To make FrankerFaceZ load from your local development server, you must set -the local storage variable ```ffzDebugMode``` to true. Just run the following -in your console on Twitch: ```localStorage.ffzDebugMode = true;``` +the local storage variable `ffzDebugMode` to true. Just run the following +in your console on Twitch: `localStorage.ffzDebugMode = true;` + +It should be noted that this project is not a browser extension that you +would load in your browser's extensions system. You still need the FrankerFaceZ +extension or user-script for your browser. + + +Editor Settings +=============== + +Please make sure that your editor is configured to use tabs rather than spaces +for indentation and that lines are ended with `\n`. It's recommended that you +configure linting support for your editor as well. + +If you're using Visual Studio Code, make sure to install the ESLint extension +and add the following to your workspace settings: + +```json +{ + "eslint.validate": [ + "javascript", + "vue" + ] +}``` \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d159ca59..a97c842c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3037,6 +3037,15 @@ } } }, + "eslint-plugin-vue": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-4.4.0.tgz", + "integrity": "sha512-UHeE0aTEv9A/9xe8J6X7rDLMbwV6GuQFKAscMyLEv49Y4wK4KwQiifr2X0MsNsVlmccrDUyjI9KO4DuFTkPP9A==", + "dev": true, + "requires": { + "vue-eslint-parser": "2.0.3" + } + }, "eslint-scope": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", @@ -9358,6 +9367,20 @@ "loose-envify": "1.3.1" } }, + "vue-eslint-parser": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-2.0.3.tgz", + "integrity": "sha512-ZezcU71Owm84xVF6gfurBQUGg8WQ+WZGxgDEQu1IHFBZNx7BFZg3L1yHxrCBNNwbwFtE1GuvfJKMtb6Xuwc/Bw==", + "dev": true, + "requires": { + "debug": "3.1.0", + "eslint-scope": "3.7.1", + "eslint-visitor-keys": "1.0.0", + "espree": "3.5.4", + "esquery": "1.0.0", + "lodash": "4.17.4" + } + }, "vue-hot-reload-api": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.0.tgz", diff --git a/package.json b/package.json index d3a09a3b..e6f6a979 100755 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "main": "script.js", "scripts": { "start": "webpack-dev-server --config webpack.web.dev.js", + "eslint": "eslint \"src/**/*.{js,vue}\"", "build": "webpack --config webpack.web.prod.js --define process.env.NODE_ENV='production'", "build:babel": "webpack --config webpack.web.babel.js --define process.env.NODE_ENV='production'", "build:prod": "webpack --config webpack.web.prod.js --define process.env.NODE_ENV='production'", @@ -22,6 +23,7 @@ "copy-webpack-plugin": "^4.5.1", "css-loader": "^0.28.10", "eslint": "^4.18.2", + "eslint-plugin-vue": "^4.4.0", "extract-loader": "^1.0.2", "file-loader": "^1.1.11", "less": "^2.7.3", diff --git a/src/modules/main_menu/components/badge-visibility.vue b/src/modules/main_menu/components/badge-visibility.vue index de12c528..46f31e7d 100644 --- a/src/modules/main_menu/components/badge-visibility.vue +++ b/src/modules/main_menu/components/badge-visibility.vue @@ -1,62 +1,84 @@ \ No newline at end of file diff --git a/src/modules/main_menu/components/feedback-page.vue b/src/modules/main_menu/components/feedback-page.vue index 0d186850..a3ab7a46 100644 --- a/src/modules/main_menu/components/feedback-page.vue +++ b/src/modules/main_menu/components/feedback-page.vue @@ -1,35 +1,32 @@ \ No newline at end of file diff --git a/src/modules/main_menu/components/filter-editor.vue b/src/modules/main_menu/components/filter-editor.vue index 17b81dc5..b060cfee 100644 --- a/src/modules/main_menu/components/filter-editor.vue +++ b/src/modules/main_menu/components/filter-editor.vue @@ -1,55 +1,55 @@ \ No newline at end of file diff --git a/src/modules/main_menu/components/menu-container.vue b/src/modules/main_menu/components/menu-container.vue index 0f9f397a..fb10b9e6 100644 --- a/src/modules/main_menu/components/menu-container.vue +++ b/src/modules/main_menu/components/menu-container.vue @@ -1,21 +1,21 @@ \ No newline at end of file diff --git a/src/modules/main_menu/components/profile-selector.vue b/src/modules/main_menu/components/profile-selector.vue index 26fe851a..6cf14c4e 100644 --- a/src/modules/main_menu/components/profile-selector.vue +++ b/src/modules/main_menu/components/profile-selector.vue @@ -1,79 +1,84 @@ \ No newline at end of file diff --git a/src/modules/main_menu/components/setting-select-box.vue b/src/modules/main_menu/components/setting-select-box.vue index 9b050152..8e8e7af3 100644 --- a/src/modules/main_menu/components/setting-select-box.vue +++ b/src/modules/main_menu/components/setting-select-box.vue @@ -1,49 +1,55 @@ \ No newline at end of file diff --git a/src/modules/main_menu/components/setting-text-box.vue b/src/modules/main_menu/components/setting-text-box.vue index cdaabef5..eb39203d 100644 --- a/src/modules/main_menu/components/setting-text-box.vue +++ b/src/modules/main_menu/components/setting-text-box.vue @@ -1,46 +1,48 @@ \ No newline at end of file diff --git a/src/sites/twitch-twilight/modules/host-options.vue b/src/sites/twitch-twilight/modules/host-options.vue index 8d4055c7..0f34f3fe 100644 --- a/src/sites/twitch-twilight/modules/host-options.vue +++ b/src/sites/twitch-twilight/modules/host-options.vue @@ -1,154 +1,193 @@ @@ -160,7 +199,7 @@ export default { draggable }, - data() { + data() { return this.$vnode.data; }, diff --git a/src/std-components/tab-container.vue b/src/std-components/tab-container.vue index 09bfc2fc..dbe3d2db 100644 --- a/src/std-components/tab-container.vue +++ b/src/std-components/tab-container.vue @@ -1,58 +1,59 @@