Skip to content

Commit

Permalink
Better eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
edi9999 committed Jan 23, 2016
1 parent dad3e3f commit 6e6dc95
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"parser": "babel-eslint",
"globals":{
"saveAs": true,
"JSZipUtils": true
},
"env": {
"node": true,
"browser": true,
Expand Down
1 change: 1 addition & 0 deletions es6/docxgenTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var expectToThrow = function (obj, method, type, expectedError) {
expect(e.properties, toShowOnFail).to.have.property("id");
expect(e.properties.id, toShowOnFail).to.be.a("string");
delete e.properties.explanation;
delete e.stack;
return expect(JSON.parse(JSON.stringify(e))).to.be.deep.equal(expectedError);
};

Expand Down
6 changes: 4 additions & 2 deletions es6/xmlTemplater.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,16 @@ module.exports = class XmlTemplater {
this.currentCompiledTag = new CompiledXmlTag([this.templaterState.getLeftValue(), {type: "tag", tag: this.templaterState.textInsideTag}, this.templaterState.getRightValue()]);
options.insideValue = this.templaterState.getLeftValue() + newValue + this.templaterState.getRightValue();
return this.replaceXmlTag(content, options);
// <w>{aaa</w> ... <w> aaa} </w>
}
// <w>{aaa</w> ... <w> aaa} </w>
else if (this.templaterState.tagEnd.numXmlTag > this.templaterState.tagStart.numXmlTag) {
// 1. for the first (@templaterState.tagStart.numXmlTag): replace **{tag by **tagValue

options.insideValue = newValue;
this.currentCompiledTag = new CompiledXmlTag([{type: "tag", tag: this.templaterState.textInsideTag}]);
if (!(this.templaterState.matches[this.templaterState.tagStart.numXmlTag].first != null) && !(this.templaterState.matches[this.templaterState.tagStart.numXmlTag].last != null)) { // normal case

// normal case
if (!(this.templaterState.matches[this.templaterState.tagStart.numXmlTag].first != null) && !(this.templaterState.matches[this.templaterState.tagStart.numXmlTag].last != null)) {
this.currentCompiledTag = new CompiledXmlTag([this.templaterState.getLeftValue(), {type: "tag", tag: this.templaterState.textInsideTag}]);
options.insideValue = this.templaterState.getLeftValue() + newValue;
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"browserify": "npm run browserify:test && npm run browserify:lib",
"convertto:es5": "rm js -rf ; mkdir -p test/spec; mkdir -p js; babel es6 --out-dir js; mv js/docxgenTest.js test/spec/docxgenTest.spec.js",
"test:watch": "mocha test/spec/docxgenTest.spec.js -w",
"lint": "bash -c 'eslint . --ignore-path <(cat .gitignore .eslintignore)'",
"test": "mocha test/spec/docxgenTest.spec.js"
}
}

0 comments on commit 6e6dc95

Please sign in to comment.