Commit 9216a9cc authored by 郝聪敏's avatar 郝聪敏

添加eslint

parent f003ce5f
/build/ node_modules/*
/config/ build/*
/dist/ config/*
/*.js dist/*
/test/unit/coverage/ lib/*
static/*
\ No newline at end of file
// https://eslint.org/docs/user-guide/configuring
module.exports = { module.exports = {
root: true, root: true,
parserOptions: { parserOptions: {
parser: 'babel-eslint' parser: 'babel-eslint',
}, },
env: { env: {
browser: true, browser: true,
}, },
extends: [ extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential', 'plugin:vue/essential',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md 'standard',
'standard'
], ],
// required to lint *.vue files
plugins: [ plugins: [
'vue' 'vue',
], ],
// add your custom rules here
rules: { rules: {
// allow async-await // 防止iview的标签报错
'generator-star-spacing': 'off', "vue/no-parsing-error": [2, { "x-invalid-end-tag": false }],
// allow debugger during development },
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
} }
This diff is collapsed.
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
"unit": "jest --config test/unit/jest.conf.js --coverage", "unit": "jest --config test/unit/jest.conf.js --coverage",
"e2e": "node test/e2e/runner.js", "e2e": "node test/e2e/runner.js",
"test": "npm run unit && npm run e2e", "test": "npm run unit && npm run e2e",
"lint": "eslint --ext .js,.vue src test/unit test/e2e/specs", "lint": "eslint --fix --cache --ext .js,.vue src",
"build": "node build/build.js" "build": "node build/build.js"
}, },
"dependencies": { "dependencies": {
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
"devDependencies": { "devDependencies": {
"autoprefixer": "^7.1.2", "autoprefixer": "^7.1.2",
"babel-core": "^6.22.1", "babel-core": "^6.22.1",
"babel-eslint": "^8.2.1", "babel-eslint": "^8.2.6",
"babel-helper-vue-jsx-merge-props": "^2.0.3", "babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-jest": "^21.0.2", "babel-jest": "^21.0.2",
"babel-loader": "^7.1.1", "babel-loader": "^7.1.1",
...@@ -40,15 +40,15 @@ ...@@ -40,15 +40,15 @@
"copy-webpack-plugin": "^4.0.1", "copy-webpack-plugin": "^4.0.1",
"cross-spawn": "^5.0.1", "cross-spawn": "^5.0.1",
"css-loader": "^0.28.0", "css-loader": "^0.28.0",
"eslint": "^4.15.0", "eslint": "^5.16.0",
"eslint-config-standard": "^10.2.1", "eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0", "eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1", "eslint-loader": "^1.9.0",
"eslint-plugin-import": "^2.7.0", "eslint-plugin-import": "^2.19.1",
"eslint-plugin-node": "^5.2.0", "eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.4.0", "eslint-plugin-promise": "^3.8.0",
"eslint-plugin-standard": "^3.0.1", "eslint-plugin-standard": "^3.1.0",
"eslint-plugin-vue": "^4.0.0", "eslint-plugin-vue": "^6.0.1",
"extract-text-webpack-plugin": "^3.0.0", "extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4", "file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1", "friendly-errors-webpack-plugin": "^1.6.1",
...@@ -76,7 +76,8 @@ ...@@ -76,7 +76,8 @@
"webpack": "^3.6.0", "webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0", "webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1", "webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0" "webpack-merge": "^4.1.0",
"husky": "^3.1.0"
}, },
"engines": { "engines": {
"node": ">= 6.0.0", "node": ">= 6.0.0",
...@@ -86,5 +87,10 @@ ...@@ -86,5 +87,10 @@
"> 1%", "> 1%",
"last 2 versions", "last 2 versions",
"not ie <= 8" "not ie <= 8"
] ],
"husky": {
"hooks": {
"pre-commit": "npm run lint"
}
}
} }
\ No newline at end of file
...@@ -3,43 +3,43 @@ import { ...@@ -3,43 +3,43 @@ import {
sapi sapi
} from '../config' } from '../config'
import qs from 'qs' import qs from 'qs'
//获取服务列表 // 获取服务列表
export function getservicelist () { export function getservicelist () {
return axios.get(`/heimdallr/service/list`) return axios.get(`/heimdallr/service/list`)
} }
//获取文字说明 // 获取文字说明
export function getkey (key) { export function getkey (key) {
return axios.get(`/heimdallr/get-key-explain/${key}`) return axios.get(`/heimdallr/get-key-explain/${key}`)
} }
//获取配置列表 // 获取配置列表
export function getconfigurelist (data) { export function getconfigurelist (data) {
return axios.get(`/heimdallr/config/service/${data.key}/${data.service_name}`) return axios.get(`/heimdallr/config/service/${data.key}/${data.service_name}`)
} }
//发布 // 发布
export function postconfigurelist (data,params) { export function postconfigurelist (data, params) {
return axios.post(`/heimdallr/config/service/${data.key}/${data.service_name}`,params,{headers: { return axios.post(`/heimdallr/config/service/${data.key}/${data.service_name}`, params, {headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}}) }})
} }
//获取版本 // 获取版本
export function getVersionnumber(data) { export function getVersionnumber (data) {
return axios.get(`/heimdallr/config-version/service/${data.key}/${data.service_name}/list`) return axios.get(`/heimdallr/config-version/service/${data.key}/${data.service_name}/list`)
} }
//回滚版本 // 回滚版本
export function rollbacknum(data) { export function rollbacknum (data) {
return axios.get(`/heimdallr/config-version/service/${data.key}/${data.service_name}/set/${data.version}`) return axios.get(`/heimdallr/config-version/service/${data.key}/${data.service_name}/set/${data.version}`)
} }
//获取节点列表 // 获取节点列表
export function getnodelist(data) { export function getnodelist (data) {
return axios.get(`/heimdallr/node/list/${data.service_name}`) return axios.get(`/heimdallr/node/list/${data.service_name}`)
} }
//获取节点配置 // 获取节点配置
export function getnodeconfig(data) { export function getnodeconfig (data) {
return axios.get(`/heimdallr/config/node/${data.service_name}/${data.node_id}`) return axios.get(`/heimdallr/config/node/${data.service_name}/${data.node_id}`)
} }
//设置节点配置 // 设置节点配置
export function nodeconfig(data,weight) { export function nodeconfig (data, weight) {
return axios.post(`/heimdallr/config/node/${data.service_name}/${data.node_id}`,weight,{headers: { return axios.post(`/heimdallr/config/node/${data.service_name}/${data.node_id}`, weight, {headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}}) }})
} }
...@@ -3,7 +3,7 @@ import { ...@@ -3,7 +3,7 @@ import {
sapi sapi
} from '../config' } from '../config'
export function login (data) { export function login (data) {
return axios.get(`/heimdallr/login`,{headers: { return axios.get(`/heimdallr/login`, {headers: {
'heimdallr-user': data 'heimdallr-user': data
}}) }})
} }
......
...@@ -34,13 +34,13 @@ ...@@ -34,13 +34,13 @@
</template> </template>
<script> <script>
import {logout} from '../api/user.api' import {logout} from '../api/user.api'
export default { export default {
data () { data () {
return { return {
isCollapsed: false isCollapsed: false
} }
}, },
computed : { computed: {
menuitemClasses: function () { menuitemClasses: function () {
return [ return [
'menu-item', 'menu-item',
...@@ -58,7 +58,7 @@ import {logout} from '../api/user.api' ...@@ -58,7 +58,7 @@ import {logout} from '../api/user.api'
}) })
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.layout{ .layout{
......
...@@ -27,14 +27,14 @@ import {login} from '../api/user.api' ...@@ -27,14 +27,14 @@ import {login} from '../api/user.api'
import localStorage from '../services/localStorage.service.js' import localStorage from '../services/localStorage.service.js'
export default { export default {
data () { data () {
var that=this var that = this
    const validateMenuClassifyId = (rule, value, callback) => { const validateMenuClassifyId = (rule, value, callback) => {
    if (this.status) {   if (this.status) {
      callback(new Error('用户名或密码错误')) callback(new Error('用户名或密码错误'))
this.status = false this.status = false
      } else { } else {
        callback() callback()
      } }
} }
return { return {
loginForm: { loginForm: {
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
], ],
password: [ password: [
{required: true, message: '请输入密码', trigger: 'blur'}, {required: true, message: '请输入密码', trigger: 'blur'},
{ required: true,validator: validateMenuClassifyId , trigger: 'blur'} { required: true, validator: validateMenuClassifyId, trigger: 'blur'}
] ]
} }
} }
...@@ -60,11 +60,10 @@ export default { ...@@ -60,11 +60,10 @@ export default {
if (valid) { if (valid) {
let data = btoa(`${this.loginForm.loginName}:${this.loginForm.password}`) let data = btoa(`${this.loginForm.loginName}:${this.loginForm.password}`)
login(data).then((data) => { login(data).then((data) => {
if(data.code === 400) { if (data.code === 400) {
this.error = data.body this.error = data.body
this.status = true this.status = true
this.$refs['loginForm'].validate() this.$refs['loginForm'].validate()
return
} else { } else {
this.status = false this.status = false
localStorage.set('heimdallr-token', data.body['heimdallr-token']) localStorage.set('heimdallr-token', data.body['heimdallr-token'])
......
const sapi = "http://heimdallr-arch.liangkebang.net" const sapi = 'http://heimdallr-arch.liangkebang.net'
// const sapi = 'http://192.168.29.88:5555' // const sapi = 'http://192.168.29.88:5555'
export { export {
sapi sapi
......
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
</div> </div>
</template> </template>
<script> <script>
import {getservicelist,getkey,getconfigurelist,postconfigurelist,getVersionnumber,rollbacknum,getnodelist,nodeconfig} from '../../api/mainconfigguration.server' import {getservicelist, getkey, getconfigurelist, postconfigurelist, getVersionnumber, rollbacknum, getnodelist, nodeconfig} from '../../api/mainconfigguration.server'
export default { export default {
data () { data () {
return { return {
...@@ -237,15 +237,15 @@ export default { ...@@ -237,15 +237,15 @@ export default {
title: '状态', title: '状态',
key: 'Status', key: 'Status',
align: 'center', align: 'center',
render: (h, params) =>{ render: (h, params) => {
return h('div', params.row.Status == 'passing' ? 'up': 'down') return h('div', params.row.Status == 'passing' ? 'up' : 'down')
}, }
}, },
{ {
title: '权重', title: '权重',
key: 'weight', key: 'weight',
align: 'center', align: 'center',
render: (h, params) =>{ render: (h, params) => {
return h('div', params.row.Meta.weight || 100) return h('div', params.row.Meta.weight || 100)
} }
}, },
...@@ -265,7 +265,7 @@ export default { ...@@ -265,7 +265,7 @@ export default {
}, },
on: { on: {
click: () => { click: () => {
this.updatenode (params.row) this.updatenode(params.row)
} }
} }
}, '修改'), }, '修改'),
...@@ -295,22 +295,22 @@ export default { ...@@ -295,22 +295,22 @@ export default {
this.isShowList = false this.isShowList = false
this.key = key this.key = key
this.getkeytext(key) this.getkeytext(key)
let data ={ let data = {
key: key, key: key,
service_name: this.server service_name: this.server
} }
getconfigurelist(data).then(data =>{ getconfigurelist(data).then(data => {
this.testmostatus = data.body this.testmostatus = data.body
this.testmostatus == 'false' ? '关闭' : '开启' this.testmostatus == 'false' ? '关闭' : '开启'
data.body == false ? this.closetest = true : this.opentest = false data.body == false ? this.closetest = true : this.opentest = false
}) })
}, },
opentestradio (data) { opentestradio (data) {
this.closetest = ! this.closetest this.closetest = !this.closetest
this.aftertestmostatus = true this.aftertestmostatus = true
}, },
closetestradio (data) { closetestradio (data) {
this.opentest = ! this.opentest this.opentest = !this.opentest
this.aftertestmostatus = false this.aftertestmostatus = false
}, },
confireupdaterido () { confireupdaterido () {
...@@ -323,42 +323,42 @@ export default { ...@@ -323,42 +323,42 @@ export default {
this.key = key this.key = key
this.logData = [] this.logData = []
this.getkeytext(key) this.getkeytext(key)
this.getconfigurlist(key,this.server) this.getconfigurlist(key, this.server)
}, },
domainnameprefixlist (key) { domainnameprefixlist (key) {
this.isShowList = true this.isShowList = true
this.key = key this.key = key
this.logData = [] this.logData = []
this.getkeytext(key) this.getkeytext(key)
this.getconfigurlist(key,this.server) this.getconfigurlist(key, this.server)
}, },
internallylist (key) { internallylist (key) {
this.isShowList = true this.isShowList = true
this.key = key this.key = key
this.logData = [] this.logData = []
this.getkeytext(key) this.getkeytext(key)
this.getconfigurlist(key,this.server) this.getconfigurlist(key, this.server)
}, },
foreignlist (key) { foreignlist (key) {
this.isShowList = true this.isShowList = true
this.key = key this.key = key
this.logData = [] this.logData = []
this.getkeytext(key) this.getkeytext(key)
this.getconfigurlist(key,this.server) this.getconfigurlist(key, this.server)
}, },
authenticationlist (key) { authenticationlist (key) {
this.isShowList = true this.isShowList = true
this.key = key this.key = key
this.logData = [] this.logData = []
this.getkeytext(key) this.getkeytext(key)
this.getconfigurlist(key,this.server) this.getconfigurlist(key, this.server)
}, },
oneadd () { oneadd () {
if (this.singlebaraddition == '') { if (this.singlebaraddition == '') {
this.$Message.error('请先输入要添加的内容') this.$Message.error('请先输入要添加的内容')
return return
} }
this.logData.push({sort:this.singlebaraddition}) this.logData.push({sort: this.singlebaraddition})
this.logparamsarr.push(this.singlebaraddition) this.logparamsarr.push(this.singlebaraddition)
this.singlebaraddition = '' this.singlebaraddition = ''
}, },
...@@ -370,14 +370,14 @@ export default { ...@@ -370,14 +370,14 @@ export default {
this.$Message.error('请先输入要添加的内容') this.$Message.error('请先输入要添加的内容')
return return
} }
let str = this.formInline.alladdcontent.replace(/\[|]/g,'') let str = this.formInline.alladdcontent.replace(/\[|]/g, '')
str = str.replace(/\n/g,'') str = str.replace(/\n/g, '')
str = str.replace(/\"/g,'') str = str.replace(/\"/g, '')
str = str.replace(/\'/g,'') str = str.replace(/\'/g, '')
let arr = str.split(',') let arr = str.split(',')
this.logparamsarr = arr this.logparamsarr = arr
arr.map(item =>{ arr.map(item => {
this.logData.push({sort:item}) this.logData.push({sort: item})
}) })
this.alladdModal = false this.alladdModal = false
}, },
...@@ -393,16 +393,16 @@ export default { ...@@ -393,16 +393,16 @@ export default {
rollback () { rollback () {
this.rollbackModal = true this.rollbackModal = true
let data = { let data = {
service_name : this.versionNumber, service_name: this.versionNumber,
key: this.key key: this.key
} }
getVersionnumber(data).then(data =>{ getVersionnumber(data).then(data => {
this.rollbacklist = data.body this.rollbacklist = data.body
this.content = data.body.length == 0 ? '' : data.body[0].value this.content = data.body.length == 0 ? '' : data.body[0].value
this.version = data.body.length == 0 ? '' : data.body[0].key this.version = data.body.length == 0 ? '' : data.body[0].key
}) })
}, },
selectlist (value,key) { selectlist (value, key) {
this.content = value this.content = value
this.version = key this.version = key
}, },
...@@ -411,12 +411,12 @@ export default { ...@@ -411,12 +411,12 @@ export default {
this.$Message.error('没有要回滚的内容') this.$Message.error('没有要回滚的内容')
return return
} }
let data ={ let data = {
key: this.key, key: this.key,
service_name: this.server, service_name: this.server,
version: this.version version: this.version
} }
rollbacknum(data).then(data =>{ rollbacknum(data).then(data => {
if (data.code === 200) { if (data.code === 200) {
this.rollbackModal = false this.rollbackModal = false
this.$Message.success('回滚成功') this.$Message.success('回滚成功')
...@@ -452,7 +452,7 @@ export default { ...@@ -452,7 +452,7 @@ export default {
}, },
getserlist () { getserlist () {
return getservicelist().then((data) => { return getservicelist().then((data) => {
let k='' let k = ''
for (k in data.body) { for (k in data.body) {
this.serviceList.push(k) this.serviceList.push(k)
this.server = this.serviceList[0] this.server = this.serviceList[0]
...@@ -462,18 +462,18 @@ export default { ...@@ -462,18 +462,18 @@ export default {
}, },
getkeytext (key) { getkeytext (key) {
getkey(key).then((data) => { getkey(key).then((data) => {
this.textExplain = data.body.replace(/\n/g,"<br/>") this.textExplain = data.body.replace(/\n/g, '<br/>')
}) })
}, },
getconfigurlist (key,service_name) { getconfigurlist (key, service_name) {
let data ={ let data = {
key: key, key: key,
service_name: service_name service_name: service_name
} }
getconfigurelist(data).then(data =>{ getconfigurelist(data).then(data => {
data.body.map(item =>{ data.body.map(item => {
this.logData.push({ this.logData.push({
sort:item sort: item
}) })
}) })
}) })
...@@ -483,12 +483,12 @@ export default { ...@@ -483,12 +483,12 @@ export default {
this.$Message.error('请先添加要发布的内容') this.$Message.error('请先添加要发布的内容')
return return
} }
let data ={ let data = {
key: this.key, key: this.key,
service_name: this.server service_name: this.server
} }
let params = this.logparamsarr let params = this.logparamsarr
postconfigurelist(data,params).then(data => { postconfigurelist(data, params).then(data => {
if (data.code === 200) { if (data.code === 200) {
this.$Message.success('发布成功') this.$Message.success('发布成功')
} }
...@@ -514,7 +514,7 @@ export default { ...@@ -514,7 +514,7 @@ export default {
service_name: this.server service_name: this.server
} }
let weight = { weight: data.Meta.weight ? data.Meta.weight : 100} let weight = { weight: data.Meta.weight ? data.Meta.weight : 100}
nodeconfig(params,weight).then(data => { nodeconfig(params, weight).then(data => {
if (data.code === 200) { if (data.code === 200) {
this.$Message.success('发布成功') this.$Message.success('发布成功')
} else { } else {
......
...@@ -38,7 +38,6 @@ function responseInterceptor (response) { ...@@ -38,7 +38,6 @@ function responseInterceptor (response) {
return Promise.resolve(response.data || null) return Promise.resolve(response.data || null)
} }
// Notice.error({ // Notice.error({
// title: '', // title: '',
// desc: response.data.errorMsg || response.data.message || '请联系客服' // desc: response.data.errorMsg || response.data.message || '请联系客服'
......
export default{ export default {
get (key) { get (key) {
let result = localStorage.getItem(key) let result = localStorage.getItem(key)
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment