add use strict to generated code
This commit is contained in:
parent
e4c5d6e613
commit
208c2fc651
|
@ -4,7 +4,7 @@
|
|||
"description": "Light weight templates for react -> write html get valid react code",
|
||||
"main": "./src/reactTemplates.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "node test/src/test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -108,7 +108,6 @@ function generateProps(node, context) {
|
|||
str = str.trim();
|
||||
if (!str || str.indexOf(':') === -1) {
|
||||
return null;
|
||||
|
||||
}
|
||||
var res = str.split(':');
|
||||
res[0] = res[0].trim();
|
||||
|
@ -253,5 +252,8 @@ function convertFile(source, target) {
|
|||
fs.writeFileSync(target, js);
|
||||
}
|
||||
|
||||
module.exports.convertTemplateToReact = convertTemplateToReact;
|
||||
module.exports.convertFile = convertFile;
|
||||
module.exports = {
|
||||
convertTemplateToReact: convertTemplateToReact,
|
||||
convertFile: convertFile,
|
||||
_test: {}
|
||||
};
|
|
@ -2,6 +2,7 @@ define([
|
|||
'react',
|
||||
'lodash'
|
||||
], function (React, _) {
|
||||
'use strict';
|
||||
return function () {
|
||||
return React.DOM.div.apply(this, _.flatten([{}].concat([])));
|
||||
};
|
||||
|
|
|
@ -2,6 +2,7 @@ define([
|
|||
'react',
|
||||
'lodash'
|
||||
], function (React, _) {
|
||||
'use strict';
|
||||
function generated1(items, itemsIndex, evt) {
|
||||
this.happend(evt);
|
||||
return false;
|
||||
|
|
|
@ -2,6 +2,7 @@ define([
|
|||
'react',
|
||||
'lodash'
|
||||
], function (React, _) {
|
||||
'use strict';
|
||||
return function () {
|
||||
return React.DOM.div.apply(this, _.flatten([{}].concat([
|
||||
React.DOM.div.apply(this, _.flatten([{
|
||||
|
|
|
@ -7,7 +7,7 @@ var path = require('path');
|
|||
|
||||
var dataPath = path.resolve(__dirname, '..', 'data');
|
||||
|
||||
test('timing test', function (t) {
|
||||
test('conversion test', function (t) {
|
||||
var files = ['div.rt', 'test.rt', 'repeat.rt'];
|
||||
t.plan(files.length);
|
||||
|
||||
|
@ -21,7 +21,7 @@ test('timing test', function (t) {
|
|||
var actual = reactTemplates.convertTemplateToReact(html);
|
||||
t.equal(actual, expected);
|
||||
if (actual !== expected) {
|
||||
fs.writeFileSync(filename + ".actual.js", actual);
|
||||
fs.writeFileSync(filename + '.actual.js', actual);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue