Skip to content

Commit

Permalink
lint: some linting
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaslabbe committed Dec 14, 2016
1 parent d336c2b commit 7c914d7
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 44 deletions.
7 changes: 0 additions & 7 deletions src/cli/cms/editor/handlebars/printBlock.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import {printInput} from './printInput'
import abeEngine from './abeEngine'

import {
config
,cmsTemplates
} from '../../../../cli'

export default function printBlock (ctx, root) {
var res = ''
var precontrib = false
Expand Down Expand Up @@ -74,7 +69,5 @@ export default function printBlock (ctx, root) {
res += printInput(ctx[0], root)
}

// var template = cmsTemplates.Handlebars.compile(res)
// return new cmsTemplates.Handlebars.SafeString(template(ctx, {data: {intl: config.intlData}}))
return res
}
4 changes: 2 additions & 2 deletions src/cli/cms/editor/handlebars/printInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export function createInputTextarea(attributes, inputClass, params) {
return `<textarea class="${inputClass}" ${attributes} rows="4">${params.value}</textarea>`
}

export function createInputLink(attributes, inputClass, params) {
export function createInputLink(attributes, inputClass) {
return `<div class="input-group">
<div class="input-group-addon link">
<span class="glyphicon glyphicon-link" aria-hidden="true"></span>
Expand All @@ -173,7 +173,7 @@ export function createInputImage(attributes, inputClass, params) {
<div class="input-error"></div>`
}

export function createInputText(attributes, inputClass, params) {
export function createInputText(attributes, inputClass) {
return `<div class="input-group">
<div class="input-group-addon">
<span class="glyphicon glyphicon-font" aria-hidden="true"></span>
Expand Down
1 change: 0 additions & 1 deletion src/cli/cms/operations/create.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import path from 'path'
import {
Manager,
coreUtils,
cmsTemplates,
cmsOperations,
Expand Down
1 change: 0 additions & 1 deletion src/cli/cms/operations/remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fse from 'fs-extra'
import path from 'path'

import {
config,
abeExtend,
cmsData,
coreUtils,
Expand Down
7 changes: 1 addition & 6 deletions src/cli/cms/structure/structure.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import path from 'path'

import {
coreUtils,
cmsStructure,
cmsData,
config
coreUtils
} from '../../'

export function editStructure(type, folderPath) {
Expand Down
1 change: 0 additions & 1 deletion src/cli/cms/templates/handlebars/attrAbe.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Handlebars from 'handlebars'
import abeEngine from '../../../'

/**
* Print properties inside html tag
Expand Down
1 change: 0 additions & 1 deletion src/cli/cms/templates/handlebars/isAuthorized.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
config,
User
} from '../../../'

Expand Down
14 changes: 6 additions & 8 deletions src/cli/cms/templates/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,22 @@ export function addHasAbeAttr(text) {
export function getAbeAttributeData(match, text, htmlAttribute, abeTag) {
var valueOfAttritube
var key = cmsData.regex.getAttr(match, 'key')
var getattr
var res

if (cmsData.regex.isSingleAbe(match, text)) {
valueOfAttritube = key.replace(/\./g, '-')
key = cmsData.regex.validDataAbe(valueOfAttritube)
getattr = key.replace(/\./g, '-')
res = ' data-abe-attr-' + valueOfAttritube + '="' + htmlAttribute + '"' + ' data-abe-' + valueOfAttritube + '="' + getattr + '"' + abeTag
key = key.replace(/\./g, '-')
res = ' data-abe-attr-' + valueOfAttritube + '="' + htmlAttribute + '"' + ' data-abe-' + valueOfAttritube + '="' + key + '"' + abeTag
}else {
var valueOfAttritube = key.split('.')
valueOfAttritube = key.split('.')
var parentKey = valueOfAttritube.shift()
valueOfAttritube = `${parentKey}[index].${valueOfAttritube[0]}`
var valueOfAttritubeIndexed = valueOfAttritube.replace(/\[index\]/, '{{@index}}')
key = cmsData.regex.validDataAbe(valueOfAttritube)
getattr = key

res = ` data-abe-attr-${valueOfAttritube}="${htmlAttribute}" data-abe-${valueOfAttritube}="${getattr}"`
+ ` data-abe-attr-${valueOfAttritubeIndexed}="${htmlAttribute}" data-abe-${valueOfAttritubeIndexed}="${getattr}"${abeTag}`
res = ` data-abe-attr-${valueOfAttritube}="${htmlAttribute}" data-abe-${valueOfAttritube}="${key}"`
+ ` data-abe-attr-${valueOfAttritubeIndexed}="${htmlAttribute}" data-abe-${valueOfAttritubeIndexed}="${key}"${abeTag}`
}

return res
Expand Down Expand Up @@ -83,7 +81,7 @@ data-abe-image_key="image_key" src="{{abe type='image' key='image_key' tab='defa
* @param {[type]} template [description]
*/
export function addAbeDataAttrForHtmlAttributes(template, key) {
export function addAbeDataAttrForHtmlAttributes(template) {
var text = template.replace(/<([A-Za-z]+)/g, '\nABE_SPLIT<$1')
let abeTagIntoAttribute = text.match(cmsData.regex.abeAsAttributePattern)

Expand Down
24 changes: 12 additions & 12 deletions src/cli/core/manager/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ class Manager {
try {
fse.accessSync(this._pathTemplate, fse.F_OK)
this._watchTemplateFolder = watch.createMonitor(this._pathTemplate, (monitor) => {
monitor.on('created', (f, stat) => {
monitor.on('created', () => {
this.getKeysFromSelect()
this.updateStructureAndTemplates()
this.events.template.emit('update')
})
monitor.on('changed', (f, curr, prev) => {
monitor.on('changed', () => {
this.getKeysFromSelect()
this.updateStructureAndTemplates()
this.events.template.emit('update')

})
monitor.on('removed', (f, stat) => {
monitor.on('removed', () => {
this.getKeysFromSelect()
this.updateStructureAndTemplates()
this.events.template.emit('update')
Expand All @@ -95,18 +95,18 @@ class Manager {
try {
fse.accessSync(this._pathPartials, fse.F_OK)
this._watchPartialsFolder = watch.createMonitor(this._pathPartials, (monitor) => {
monitor.on('created', (f, stat) => {
monitor.on('created', () => {
this.getKeysFromSelect()
this.updateStructureAndTemplates()
this.events.template.emit('update')
})
monitor.on('changed', (f, curr, prev) => {
monitor.on('changed', () => {
this.getKeysFromSelect()
this.updateStructureAndTemplates()
this.events.template.emit('update')

})
monitor.on('removed', (f, stat) => {
monitor.on('removed', () => {
this.getKeysFromSelect()
this.updateStructureAndTemplates()
this.events.template.emit('update')
Expand All @@ -119,15 +119,15 @@ class Manager {
try {
fse.accessSync(this._pathStructure, fse.F_OK)
this._watchStructure = watch.createMonitor(this._pathStructure, (monitor) => {
monitor.on('created', (f, stat) => {
monitor.on('created', () => {
this.updateStructureAndTemplates()
this.events.structure.emit('update')
})
monitor.on('changed', (f, curr, prev) => {
monitor.on('changed', () => {
this.updateStructureAndTemplates()
this.events.structure.emit('update')
})
monitor.on('removed', (f, stat) => {
monitor.on('removed', () => {
this.updateStructureAndTemplates()
this.events.structure.emit('update')
})
Expand All @@ -139,16 +139,16 @@ class Manager {
try {
fse.accessSync(this._pathReference, fse.F_OK)
this._watchReferenceFolder = watch.createMonitor(this._pathReference, (monitor) => {
monitor.on('created', (f, stat) => {
monitor.on('created', (f) => {
this.updateReferences(f)
this.events.reference.emit('update')
})
monitor.on('changed', (f, curr, prev) => {
monitor.on('changed', (f) => {
this.updateReferences(f)
this.events.reference.emit('update')

})
monitor.on('removed', (f, stat) => {
monitor.on('removed', () => {
this.updateReferences()
this.events.reference.emit('update')
})
Expand Down
1 change: 0 additions & 1 deletion src/cli/core/utils/file.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Promise from 'bluebird'
import path from 'path'
import mkdirp from 'mkdirp'
import execPromise from 'child-process-promise'
var fse = Promise.promisifyAll(require('fs-extra'))

import {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/extend/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var abeProcess = function(name, args = []) {
}

if(typeof proc !== 'undefined' && proc !== null) {
proc.on('message', function(msg) {
proc.on('message', function() {
abeExtend.lock.remove(name)
proc.kill()
})
Expand Down
4 changes: 1 addition & 3 deletions src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import {
moduloIf,
attrAbe,
ifIn,
ifCond,
isTrue,
truncate
ifCond
} from './cms/templates/index'

import {
Expand Down

0 comments on commit 7c914d7

Please sign in to comment.