Skip to content

Commit

Permalink
Refactor whole source code following coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
tuandm committed Feb 27, 2019
1 parent a76bca2 commit 9b14787
Show file tree
Hide file tree
Showing 165 changed files with 4,637 additions and 3,249 deletions.
53 changes: 53 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
'use strict'

module.exports = {
root: true,
parserOptions: {
ecmaVersion: 6,
},
env: {
node: true,
mocha: true,
},
extends: ['plugin:eslint-plugin/recommended', 'plugin:vue-libs/recommended'],
plugins: ['eslint-plugin'],
rules: {
'eslint-plugin/report-message-format': ['error', "^[A-Z`'{].*\\.$"],
'eslint-plugin/prefer-placeholders': 'error',
'eslint-plugin/consistent-output': 'error',
'no-mixed-operators': 'error',
'space-before-function-paren': 'off',
'vue/comma-dangle': ['error', 'always-multiline'],
'comma-dangle': ['error', 'always-multiline'],
'semi': ['error', 'always'],
"no-mixed-operators": [
"error",
{
"groups": [
["&", "|", "^", "~", "<<", ">>", ">>>"],
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
["&&", "||"],
["in", "instanceof"]
],
"allowSamePrecedence": true
}
]
},

overrides: [
{
files: ['lib/rules/*.js'],
rules: {
'consistent-docs-description': 'error',
'no-invalid-meta': 'error',
'eslint-plugin/require-meta-type': 'error',
'require-meta-docs-url': [
'error',
{
pattern: `https://eslint.vuejs.org/rules/{{name}}.html`,
},
],
},
},
],
}
6 changes: 6 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
singleQuote: true,
semi: true,
tabWidth: 2,
trailingComma: 'es5',
}
1,625 changes: 1,452 additions & 173 deletions package-lock.json

Large diffs are not rendered by default.

137 changes: 71 additions & 66 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,68 +1,73 @@
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"@babel/core": "^7.3.3",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/polyfill": "^7.2.5",
"@babel/preset-env": "^7.3.1",
"babel-core": "^6.26.3",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^8.0.5",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-vue-jsx": "^3.7.0",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-2": "^6.24.1",
"laravel-mix": "^4.0.7",
"lodash": "^4.17.5",
"popper.js": "^1.14.7",
"resolve-url-loader": "^2.3.2",
"sass": "^1.17.0",
"sass-loader": "^7.1.0",
"webpack": "^4.29.4",
"webpack-cli": "^3.2.3"
},
"dependencies": {
"axios": "^0.18",
"clipboard": "^2.0.4",
"cross-env": "^5.1",
"driver.js": "^0.9.2",
"dropzone": "^5.5.1",
"echarts": "^4.2.0-rc.2",
"element-ui": "^2.5.4",
"file-saver": "^2.0.0",
"js-cookie": "^2.2.0",
"jsonlint": "^1.6.3",
"jszip": "^3.1.5",
"normalize.css": "^8.0.1",
"nprogress": "^0.2.0",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"script-loader": "^0.7.2",
"sortablejs": "^1.8.3",
"svg-sprite-loader": "^4.1.3",
"svgo": "^1.1.1",
"tui-editor": "^1.3.0",
"uglifyjs-webpack-plugin": "^2.1.1",
"url-loader": "^1.1.2",
"vue": "^2.6.6",
"vue-count-to": "^1.0.13",
"vue-i18n": "^8.8.2",
"vue-router": "^3.0.2",
"vue-splitpane": "^1.0.2",
"vue-template-compiler": "^2.6.6",
"vuex": "^3.1.0",
"xlsx": "^0.14.1"
},
"resolutions": {
"ajv": "6.8.1"
}
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"@babel/core": "^7.3.3",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/polyfill": "^7.2.5",
"@babel/preset-env": "^7.3.1",
"babel-core": "^6.26.3",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^8.0.5",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-vue-jsx": "^3.7.0",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-2": "^6.24.1",
"cross-env": "^5.1",
"eslint": "^5.14.1",
"eslint-loader": "^2.1.2",
"eslint-plugin-eslint-plugin": "^2.0.1",
"eslint-plugin-vue": "^5.2.2",
"eslint-plugin-vue-libs": "^3.0.0",
"laravel-mix": "^4.0.7",
"laravel-mix-eslint": "^0.1.2",
"lodash": "^4.17.5",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"resolve-url-loader": "^2.3.2",
"sass": "^1.17.0",
"sass-loader": "^7.1.0",
"script-loader": "^0.7.2",
"svg-sprite-loader": "^4.1.3",
"uglifyjs-webpack-plugin": "^2.1.1",
"url-loader": "^1.1.2",
"webpack": "^4.29.4",
"webpack-cli": "^3.2.3"
},
"dependencies": {
"axios": "^0.18",
"clipboard": "^2.0.4",
"driver.js": "^0.9.2",
"dropzone": "^5.5.1",
"echarts": "^4.2.0-rc.2",
"element-ui": "^2.5.4",
"file-saver": "^2.0.0",
"js-cookie": "^2.2.0",
"jsonlint": "^1.6.3",
"jszip": "^3.1.5",
"normalize.css": "^8.0.1",
"nprogress": "^0.2.0",
"sortablejs": "^1.8.3",
"svgo": "^1.1.1",
"tui-editor": "^1.3.0",
"vue": "^2.6.6",
"vue-count-to": "^1.0.13",
"vue-i18n": "^8.8.2",
"vue-router": "^3.0.2",
"vue-splitpane": "^1.0.2",
"vue-template-compiler": "^2.6.6",
"vuex": "^3.1.0",
"xlsx": "^0.14.1"
},
"resolutions": {
"ajv": "6.8.1"
}
}
4 changes: 2 additions & 2 deletions public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"/js/app.js": "/js/app.js?id=fafb2f1358b200e5c7f3",
"/css/app.css": "/css/app.css?id=607226ae0eb62a93db16"
"/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css"
}
22 changes: 11 additions & 11 deletions resources/js/api/article.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
import request from '@/utils/request'
import request from '@/utils/request';

export function fetchList(query) {
return request({
url: '/articles',
method: 'get',
params: query
})
params: query,
});
}

export function fetchArticle(id) {
return request({
url: '/articles/' + id,
method: 'get'
})
method: 'get',
});
}

export function fetchPv(id) {
return request({
url: '/articles/' + id + '/pageviews',
method: 'get'
})
method: 'get',
});
}

export function createArticle(data) {
return request({
url: '/article/create',
method: 'post',
data
})
data,
});
}

export function updateArticle(data) {
return request({
url: '/article/update',
method: 'post',
data
})
data,
});
}
16 changes: 8 additions & 8 deletions resources/js/api/login.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import request from '@/utils/request'
import request from '@/utils/request';

export function login(email, password) {
return request({
url: '/auth/login',
method: 'post',
data: {
email,
password
}
})
password,
},
});
}

export function getInfo(token) {
return request({
url: '/auth/user',
method: 'get'
})
method: 'get',
});
}

export function logout() {
return request({
url: '/auth/logout',
method: 'post'
})
method: 'post',
});
}
6 changes: 3 additions & 3 deletions resources/js/api/qiniu.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import request from '@/utils/request'
import request from '@/utils/request';

export function getToken() {
return request({
url: '/qiniu/upload/token', // 假地址 自行替换
method: 'get'
})
method: 'get',
});
}
6 changes: 3 additions & 3 deletions resources/js/api/remoteSearch.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import request from '@/utils/request'
import request from '@/utils/request';

export function userSearch(name) {
return request({
url: '/search/user',
method: 'get',
params: { name }
})
params: { name },
});
}
6 changes: 3 additions & 3 deletions resources/js/api/table.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import request from '@/utils/request'
import request from '@/utils/request';

export function getList(params) {
return request({
url: '/table/list',
method: 'get',
params
})
params,
});
}
6 changes: 3 additions & 3 deletions resources/js/api/transaction.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import request from '@/utils/request'
import request from '@/utils/request';

export function fetchList(query) {
return request({
url: '/transaction/list',
method: 'get',
params: query
})
params: query,
});
}
44 changes: 22 additions & 22 deletions resources/js/app.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import Vue from 'vue'
import Cookies from 'js-cookie'
import ElementUI from 'element-ui'
import App from './views/App'
import store from './store'
import router from '@/router'
import i18n from './lang' // Internationalization
import '@/icons' // icon
import '@/permission' // permission control
import Vue from 'vue';
import Cookies from 'js-cookie';
import ElementUI from 'element-ui';
import App from './views/App';
import store from './store';
import router from '@/router';
import i18n from './lang'; // Internationalization
import '@/icons'; // icon
import '@/permission'; // permission control

import * as filters from './filters' // global filters
import * as filters from './filters'; // global filters

Vue.use(ElementUI, {
size: Cookies.get('size') || 'medium', // set element-ui default size
i18n: (key, value) => i18n.t(key, value)
})
size: Cookies.get('size') || 'medium', // set element-ui default size
i18n: (key, value) => i18n.t(key, value),
});

// register global utility filters.
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
})
Vue.filter(key, filters[key]);
});

Vue.config.productionTip = false
Vue.config.productionTip = false;

new Vue({
el: '#app',
router,
store,
i18n,
render: h => h(App)
})
el: '#app',
router,
store,
i18n,
render: h => h(App),
});
Loading

0 comments on commit 9b14787

Please sign in to comment.