Skip to content

Commit f16e49a

Browse files
Used lint script to align code styling with rules of project
1 parent aaedf58 commit f16e49a

File tree

7 files changed

+59
-63
lines changed

7 files changed

+59
-63
lines changed

src/components/dashboard_items/CodeSnippet.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default {
4242
},
4343
computed: {
4444
// needs access to current component aka activeComponent
45-
...mapState(['componentMap', 'activeComponent', 'activeComponentObj']),
45+
...mapState(['componentMap', 'activeComponent', 'activeComponentObj'])
4646
},
4747
methods: {
4848
getWindowHeight (e) {
@@ -220,7 +220,7 @@ export default {
220220
watch: {
221221
// watches activeComponentObj for changes to make it reactive upon mutation
222222
activeComponentObj: {
223-
handler(){
223+
handler () {
224224
this.code = this.createCodeSnippet(this.activeComponentObj.componentName, this.activeComponentObj.children)
225225
}
226226
}

src/components/dashboard_items/Tree.vue

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -18,76 +18,76 @@ Description:
1818
</template>
1919

2020
<script>
21-
import { tree } from "vued3tree";
22-
import { mapState } from "vuex";
21+
import { tree } from 'vued3tree'
22+
import { mapState } from 'vuex'
2323
export default {
24-
name: "Tree",
24+
name: 'Tree',
2525
components: {
26-
tree,
26+
tree
2727
},
2828
computed: {
29-
...mapState(["componentMap", "activeComponent"]),
29+
...mapState(['componentMap', 'activeComponent']),
3030
// Returns project tree on re-render
31-
computedTree() {
31+
computedTree () {
3232
// console.log('buildtree', this.buildTree())
33-
return this.buildTree();
34-
},
33+
return this.buildTree()
34+
}
3535
},
36-
data() {
36+
data () {
3737
return {
38-
tree: null,
39-
};
38+
tree: null
39+
}
4040
},
4141
methods: {
4242
// Called by transformToTree, formats componentMap
43-
formatComponentMap(compMap) {
43+
formatComponentMap (compMap) {
4444
// console.log('compMap', compMap)
45-
let result = [];
45+
let result = []
4646
Object.values(compMap).forEach((compData) => {
4747
result.push({
4848
name: compData.componentName,
49-
children: compData.children,
50-
});
51-
});
49+
children: compData.children
50+
})
51+
})
5252
console.log(JSON.stringify(result))
5353
// console.log('Formatcomponent map result', result)
54-
return result;
54+
return result
5555
},
5656
// Called by buildTree, transforms componentMap
57-
transformToTree(data) {
58-
let result = {};
59-
const nodes = {};
60-
const formattedData = this.formatComponentMap(data);
57+
transformToTree (data) {
58+
let result = {}
59+
const nodes = {}
60+
const formattedData = this.formatComponentMap(data)
6161
6262
formattedData.forEach((component) => {
6363
if (!nodes[component.name]) {
64-
nodes[component.name] = { name: component.name, children: [] };
65-
result = nodes;
64+
nodes[component.name] = { name: component.name, children: [] }
65+
result = nodes
6666
}
6767
component.children.forEach((child) => {
68-
if (!nodes[child]) nodes[child] = { name: child, children: [] };
69-
nodes[component.name].children.push(nodes[child]);
70-
});
71-
});
68+
if (!nodes[child]) nodes[child] = { name: child, children: [] }
69+
nodes[component.name].children.push(nodes[child])
70+
})
71+
})
7272
console.log(nodes)
7373
console.log(result)
74-
return result;
74+
return result
7575
},
7676
// Called by computedTree, calls transformToTree
77-
buildTree() {
78-
let build = this.transformToTree(this.componentMap);
79-
return build["App"];
80-
},
77+
buildTree () {
78+
let build = this.transformToTree(this.componentMap)
79+
return build['App']
80+
}
8181
},
82-
watch:{
83-
componentMap:{
84-
deep:true,
85-
handler (){
82+
watch: {
83+
componentMap: {
84+
deep: true,
85+
handler () {
8686
this.buildTree()
8787
}
8888
}
8989
}
90-
};
90+
}
9191
</script>
9292

9393
<style lang="stylus">

src/components/file_system_interface/ExportProject.vue

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,13 @@ export default {
228228
const routes = Object.keys(this.routes)
229229
console.log(componentName)
230230
console.log(currentComponent)
231-
if (!routes.includes(componentName)){
231+
if (!routes.includes(componentName)) {
232232
let imports = ''
233-
if (currentComponent.actions.length || currentComponent.state.length){
233+
if (currentComponent.actions.length || currentComponent.state.length) {
234234
imports += 'import { '
235235
if (currentComponent.actions.length && currentComponent.state.length) {
236236
imports += 'mapState, mapActions'
237-
}
238-
else if (currentComponent.state.length) imports += 'mapState'
237+
} else if (currentComponent.state.length) imports += 'mapState'
239238
else imports += 'mapActions'
240239
imports += ' } from "vuex"\n'
241240
}
@@ -245,15 +244,15 @@ export default {
245244
imports += `import ${name} from '@/components/${name}.vue';\n`
246245
})
247246
248-
// add components section
247+
// add components section
249248
let childrenComponentNames = ''
250249
children.forEach(name => {
251250
childrenComponentNames += ` ${name},\n`
252251
})
253252
254253
// if true add data section and populate with props
255254
let data = ''
256-
if (currentComponent.props.length){
255+
if (currentComponent.props.length) {
257256
data += ' data () {\n return {'
258257
currentComponent.props.forEach(prop => {
259258
data += `\n ${prop}: "PLACEHOLDER FOR VALUE",`
@@ -265,10 +264,10 @@ export default {
265264
266265
// if true add computed section and populate with state
267266
let computed = ''
268-
if (currentComponent.state.length){
267+
if (currentComponent.state.length) {
269268
computed += ' computed: {'
270269
computed += '\n ...mapState(['
271-
currentComponent.state.forEach((state) =>{
270+
currentComponent.state.forEach((state) => {
272271
computed += `\n "${state}",`
273272
})
274273
computed += '\n ]),\n'
@@ -277,7 +276,7 @@ export default {
277276
278277
// if true add methods section and populate with actions
279278
let methods = ''
280-
if (currentComponent.actions.length){
279+
if (currentComponent.actions.length) {
281280
methods += ' methods: {'
282281
methods += '\n ...mapActions(['
283282
currentComponent.actions.forEach((action) => {
@@ -297,9 +296,7 @@ export default {
297296
output += methods
298297
output += '};\n<\/script>'
299298
return output
300-
}
301-
302-
else{
299+
} else {
303300
let str = ''
304301
children.forEach(name => {
305302
str += `import ${name} from '@/components/${name}.vue';\n`
@@ -310,7 +307,6 @@ export default {
310307
})
311308
return `\n\n<script>\n${str}\nexport default {\n name: '${componentName}',\n components: {\n${childrenComponentNames} }\n};\n<\/script>`
312309
}
313-
314310
},
315311
/**
316312
* @description writes the <style> in vue component

src/components/file_system_interface/SaveProjectComponent.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default {
9898
this.parseAndDelete(comphtml)
9999
}
100100
}
101-
101+
102102
fs.writeFileSync(data, JSON.stringify(state))
103103
localforage
104104
.setItem(fileName, JSON.parse(fs.readFileSync(data, 'utf8')))

src/components/home_sidebar_items/CreateComponent.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export default {
103103
parent: {},
104104
isActive: false
105105
}
106-
if (!this.componentMap[component.componentName]){
106+
if (!this.componentMap[component.componentName]) {
107107
this.registerComponent(component)
108108
this.setActiveComponent(component.componentName)
109109
}

src/components/home_sidebar_items/EditDeleteComponents.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Description:
33
Contains edit functionality for selected component
44
Functionality includes: delete component, set active component, search for component, change name of component,adjust layer of component,
5-
delete props, state, actions, HTML elements, or children of component.
5+
delete props, state, actions, HTML elements, or children of component.
66
-->
77

88
<template>
@@ -262,7 +262,7 @@ export default {
262262
}
263263
},
264264
265-
// edit name of selected component
265+
// edit name of selected component
266266
editCompName (name) {
267267
if (name && name !== this.activeComponent && this.activeComponent && !this.componentMap[name]) this.editComponentName(name)
268268
this.setActiveComponent(this.activeComponent)

src/store/mutations.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const mutations = {
114114
// state.activeComponentObj = active;
115115
state.activeComponentObj = Object.assign({}, active)
116116

117-
state.componentMap = Object.assign({}, state.componentMap, {[state.activeComponent]: state.activeComponentObj})
117+
state.componentMap = Object.assign({}, state.componentMap, { [state.activeComponent]: state.activeComponentObj })
118118
},
119119

120120
[types.CREATE_PROP]: (state, payload) => {
@@ -143,10 +143,10 @@ const mutations = {
143143
}
144144
}
145145
}
146-
state.selectedProps = [];
146+
state.selectedProps = []
147147
state.activeComponentObj = Object.assign({}, active)
148148

149-
state.componentMap = Object.assign({}, state.componentMap, {[state.activeComponent]: state.activeComponentObj})
149+
state.componentMap = Object.assign({}, state.componentMap, { [state.activeComponent]: state.activeComponentObj })
150150
},
151151

152152
[types.CREATE_STATE]: (state, payload) => {
@@ -161,7 +161,7 @@ const mutations = {
161161
},
162162

163163
[types.ADD_STATE_TO_COMPONENT]: (state, payload) => {
164-
let active = state.activeComponentObj;
164+
let active = state.activeComponentObj
165165

166166
if (!state.activeComponentObj.state) {
167167
state.activeComponentObj.state = payload
@@ -172,12 +172,12 @@ const mutations = {
172172
}
173173
}
174174
}
175-
state.selectedState = [];
175+
state.selectedState = []
176176
// state.activeComponentObj = null;
177177
// state.activeComponentObj = active;
178178
state.activeComponentObj = Object.assign({}, active)
179179

180-
state.componentMap = Object.assign({}, state.componentMap, {[state.activeComponent]: state.activeComponentObj})
180+
state.componentMap = Object.assign({}, state.componentMap, { [state.activeComponent]: state.activeComponentObj })
181181
},
182182

183183
[types.DELETE_ACTION_FROM_COMPONENT]: (state, payload) => {
@@ -406,7 +406,7 @@ const mutations = {
406406
},
407407
// pushs new component to componentMap
408408
[types.ADD_COMPONENT_TO_COMPONENT_MAP]: (state, payload) => {
409-
const { componentName, htmlList, children, parent, isActive, actions, props } = payload;
409+
const { componentName, htmlList, children, parent, isActive, actions, props } = payload
410410
const s = payload.state
411411
state.componentMap = Object.assign({}, state.componentMap, {
412412
[componentName]: {

0 commit comments

Comments
 (0)