Merge pull request #53 from samogot/lint
Add ESLint and some more stuff
This commit is contained in:
commit
c5083733be
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
|
||||
parserOptions:
|
||||
ecmaVersion: 8
|
||||
sourceType: module
|
||||
|
||||
env:
|
||||
browser: true
|
||||
node: true
|
||||
|
||||
plugins:
|
||||
- vue
|
||||
|
||||
extends:
|
||||
- eslint:recommended
|
||||
- plugin:vue/recommended
|
||||
|
||||
rules:
|
||||
no-unused-vars: 'off'
|
||||
no-console: 'off'
|
||||
no-empty: 'off'
|
|
@ -5,13 +5,13 @@
|
|||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const styles = require('./styles/index.scss');
|
||||
const { Global, Logger, Utils, PluginManager, BDIpc, WebpackModules, SocketProxy, Events } = require('./modules');
|
||||
const { Global, Logger, Utils, PluginManager, BDIpc, WebpackModules, SocketProxy, Events, Vendor } = require('./modules');
|
||||
//const { UI } = require('./modules/ui/index.jsx');
|
||||
|
||||
class BetterDiscord {
|
||||
|
@ -50,11 +50,5 @@ if (window.BetterDiscord) {
|
|||
Logger.log('main', 'Attempting to inject again?');
|
||||
} else {
|
||||
let bdInstance = new BetterDiscord();
|
||||
window.BetterDiscord = {
|
||||
'vendor': {
|
||||
jQuery: require('jquery'),
|
||||
$: require('jquery'),
|
||||
moment: WebpackModules.getModuleByName('Moment')
|
||||
}
|
||||
};
|
||||
window.BetterDiscord = {'vendor': Vendor};
|
||||
}
|
|
@ -5,10 +5,11 @@
|
|||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const { Module } = require('./modulebase');
|
||||
const { Vendor } = require('./vendor');
|
||||
const fs = window.require('fs');
|
||||
const path = window.require('path');
|
||||
|
||||
|
@ -29,7 +30,7 @@ class Logger {
|
|||
}
|
||||
level = this.parseLevel(level);
|
||||
console[level]('[%cBetter%cDiscord:%s] %s', 'color: #3E82E5', '', `${module}${level === 'debug' ? '|DBG' : ''}`, message);
|
||||
logs.push(`[${BetterDiscord.vendor.moment().format('DD/MM/YY hh:mm:ss')}|${module}|${level}] ${message}`);
|
||||
logs.push(`[${Vendor.moment().format('DD/MM/YY hh:mm:ss')}|${module}|${level}] ${message}`);
|
||||
window.bdlogs = logs;
|
||||
}
|
||||
|
||||
|
@ -78,7 +79,7 @@ class Utils {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class FileUtils {
|
||||
|
@ -102,7 +103,7 @@ class FileUtils {
|
|||
}
|
||||
|
||||
static async directoryExists(path) {
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.stat(path, (err, stats) => {
|
||||
if (err) return reject({
|
||||
'message': `Directory does not exist: ${path}`,
|
||||
|
@ -126,7 +127,7 @@ class FileUtils {
|
|||
throw (err);
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.readFile(path, 'utf-8', (err, data) => {
|
||||
if (err) reject({
|
||||
'message': `Could not read file: ${path}`,
|
||||
|
@ -208,17 +209,17 @@ class Filters {
|
|||
};
|
||||
}
|
||||
|
||||
static byDisplayName(name) {
|
||||
static byDisplayName(name) {
|
||||
return module => {
|
||||
return module && module.displayName === name;
|
||||
};
|
||||
}
|
||||
|
||||
static combine(...filters) {
|
||||
static combine(...filters) {
|
||||
return module => {
|
||||
return filters.every(filter => filter(module));
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = { Logger, Utils, FileUtils, Filters }
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* BetterDiscord Client Utils Module
|
||||
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const {WebpackModules} = require('./webpackmodules');
|
||||
const jQuery = require('jquery');
|
||||
|
||||
class Vendor {
|
||||
|
||||
static get jQuery() {
|
||||
return jQuery;
|
||||
}
|
||||
|
||||
static get $() {
|
||||
return jQuery;
|
||||
}
|
||||
|
||||
static get moment() {
|
||||
return WebpackModules.getModuleByName('Moment');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = {Vendor};
|
|
@ -7,4 +7,5 @@ export { WebpackModules } from './core/webpackmodules';
|
|||
export { Events } from './core/events';
|
||||
export { SocketProxy } from './core/discordsocket';
|
||||
export { CssEditor } from './core/csseditor';
|
||||
export { Settings } from './core/settings';
|
||||
export { Settings } from './core/settings';
|
||||
export { Vendor } from './core/vendor';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const $ = require('jquery');
|
||||
|
@ -32,8 +32,8 @@ class UI {
|
|||
|
||||
this.vueInstance = new Vue({
|
||||
el: '#bd-settings',
|
||||
template: '<BdSettingsWrapper/>',
|
||||
components: { BdSettingsWrapper }
|
||||
components: { BdSettingsWrapper },
|
||||
template: '<BdSettingsWrapper/>'
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ class CSSEditor extends Module {
|
|||
//TODO Currently uses a development path
|
||||
get editorPath() {
|
||||
return path.resolve(__dirname, '..', '..', '..', 'csseditor', 'dist');
|
||||
return path.resolve(__dirname, '..', '..', '..', 'tests', 'csseditor');
|
||||
// return path.resolve(__dirname, '..', '..', '..', 'tests', 'csseditor');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const
|
||||
const
|
||||
path = require('path'),
|
||||
fs = require('fs');
|
||||
|
||||
|
@ -54,7 +54,7 @@ class FileUtils {
|
|||
}
|
||||
|
||||
static async directoryExists(path) {
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.stat(path, (err, stats) => {
|
||||
if(err) return reject({
|
||||
'message': `Directory does not exist: ${path}`,
|
||||
|
@ -78,7 +78,7 @@ class FileUtils {
|
|||
throw(err);
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.readFile(path, 'utf-8', (err, data) => {
|
||||
if(err) reject({
|
||||
'message': `Could not read file: ${path}`,
|
||||
|
@ -145,7 +145,7 @@ class WindowUtils extends Module {
|
|||
channel = channel.startsWith('bd-') ? channel : `bd-${channel}`;
|
||||
this.webContents.send(channel, message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -10,8 +10,8 @@ window.cmCommands = VueCodemirror.CodeMirror.commands;
|
|||
|
||||
new Vue({
|
||||
el: '#root',
|
||||
template: '<Editor/>',
|
||||
components: { Editor }
|
||||
components: { Editor },
|
||||
template: '<Editor/>'
|
||||
});
|
||||
|
||||
const style = document.createElement('style');
|
||||
|
|
File diff suppressed because it is too large
Load Diff
36
package.json
36
package.json
|
@ -16,35 +16,37 @@
|
|||
},
|
||||
"private": false,
|
||||
"devDependencies": {
|
||||
"webpack": "^3.10.0",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-loader": "^7.1.2",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-loader": "^7.1.2",
|
||||
"jquery": "^3.2.1",
|
||||
"vue": "^2.5.13",
|
||||
"vue-loader": "^13.7.0",
|
||||
"vue-template-compiler": "^2.5.13",
|
||||
"codemirror": "^5.23.0",
|
||||
"css-loader": "^0.28.9",
|
||||
"sass-loader": "^6.0.6",
|
||||
"node-sass": "^4.7.2",
|
||||
"electron": "^1.7.10",
|
||||
"eslint": "^4.16.0",
|
||||
"eslint-plugin-vue": "^4.2.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-babel": "^7.0.0",
|
||||
"pump": "^2.0.0",
|
||||
"gulp-plumber": "^1.2.0",
|
||||
"gulp-watch": "^5.0.0",
|
||||
"codemirror": "^5.23.0",
|
||||
"jquery": "^3.2.1",
|
||||
"node-sass": "^4.7.2",
|
||||
"pump": "^2.0.0",
|
||||
"sass-loader": "^6.0.6",
|
||||
"v-tooltip": "^2.0.0-rc.30",
|
||||
"vue": "^2.5.13",
|
||||
"vue-codemirror": "^4.0.3",
|
||||
"vue-loader": "^13.7.0",
|
||||
"vue-material-design-icons": "^1.0.0",
|
||||
"v-tooltip": "^2.0.0-rc.30"
|
||||
|
||||
"vue-template-compiler": "^2.5.13",
|
||||
"webpack": "^3.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "cd ./client && npm run build && cd ../core && npm run build && cd ../csseditor && npm run build",
|
||||
"watch_client": "cd ./client && npm run watch",
|
||||
"watch_core": "cd ./core && npm run watch",
|
||||
"test": "npm run build"
|
||||
"build": "npm run build --prefix client && npm run build --prefix core && npm run build --prefix csseditor",
|
||||
"watch_client": "npm run watch --prefix client",
|
||||
"watch_core": "npm run watch --prefix core",
|
||||
"lint": "eslint -f unix client/src core/src csseditor/src",
|
||||
"test": "npm run build && npm run lint"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue