mirror of
https://github.com/bobwen-dev/react-templates
synced 2025-04-12 00:56:39 +02:00
eslint fixes
This commit is contained in:
parent
b79ed7a040
commit
707b5d8fd2
@ -61,7 +61,7 @@ function handleSingleFile(currentOptions, filename) {
|
|||||||
} else {
|
} else {
|
||||||
outputFilename = filename + '.ts';
|
outputFilename = filename + '.ts';
|
||||||
}
|
}
|
||||||
} else if (sourceExt === '.jsrt'){
|
} else if (sourceExt === '.jsrt') {
|
||||||
outputFilename = filename.replace(/\.jsrt$/, '.js');
|
outputFilename = filename.replace(/\.jsrt$/, '.js');
|
||||||
currentOptions = _.assign({}, currentOptions, {modules: 'jsrt'});
|
currentOptions = _.assign({}, currentOptions, {modules: 'jsrt'});
|
||||||
} else {
|
} else {
|
||||||
|
@ -27,7 +27,7 @@ var table = require('text-table');
|
|||||||
* @returns {string} The original word with an s on the end if count is not one.
|
* @returns {string} The original word with an s on the end if count is not one.
|
||||||
*/
|
*/
|
||||||
function pluralize(word, count) {
|
function pluralize(word, count) {
|
||||||
return (count === 1 ? word : word + 's');
|
return count === 1 ? word : word + 's';
|
||||||
}
|
}
|
||||||
|
|
||||||
//function pluralize(n, single, plural) {
|
//function pluralize(n, single, plural) {
|
||||||
|
@ -293,7 +293,9 @@ function convertHtmlToReact(node, context) {
|
|||||||
data.scopeMapping[boundParam] = boundParam;
|
data.scopeMapping[boundParam] = boundParam;
|
||||||
});
|
});
|
||||||
_.each(node.attribs[scopeProp].split(';'), function (scopePart) {
|
_.each(node.attribs[scopeProp].split(';'), function (scopePart) {
|
||||||
if (scopePart.trim().length === 0) return;
|
if (scopePart.trim().length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var scopeSubParts = scopePart.split(' as ');
|
var scopeSubParts = scopePart.split(' as ');
|
||||||
if (scopeSubParts.length < 2) {
|
if (scopeSubParts.length < 2) {
|
||||||
@ -351,7 +353,7 @@ function convertHtmlToReact(node, context) {
|
|||||||
if (node.attribs[templateProp]) {
|
if (node.attribs[templateProp]) {
|
||||||
data.repeatFunction = generateInjectedFunc(context, 'repeat' + stringUtils.capitalize(data.item), 'return ' + data.body);
|
data.repeatFunction = generateInjectedFunc(context, 'repeat' + stringUtils.capitalize(data.item), 'return ' + data.body);
|
||||||
data.repeatBinds = ['this'].concat(_.reject(context.boundParams, function (param) {
|
data.repeatBinds = ['this'].concat(_.reject(context.boundParams, function (param) {
|
||||||
return (param === data.item || param === data.item + 'Index');
|
return param === data.item || param === data.item + 'Index';
|
||||||
}));
|
}));
|
||||||
data.body = repeatTemplate(data);
|
data.body = repeatTemplate(data);
|
||||||
}
|
}
|
||||||
@ -364,7 +366,7 @@ function convertHtmlToReact(node, context) {
|
|||||||
}
|
}
|
||||||
return data.body;
|
return data.body;
|
||||||
} else if (node.type === 'comment') {
|
} else if (node.type === 'comment') {
|
||||||
return (commentTemplate(node));
|
return commentTemplate(node);
|
||||||
} else if (node.type === 'text') {
|
} else if (node.type === 'text') {
|
||||||
if (node.data.trim()) {
|
if (node.data.trim()) {
|
||||||
return convertText(node, context, node.data);
|
return convertText(node, context, node.data);
|
||||||
|
@ -189,7 +189,7 @@ test('html tests', function (t) {
|
|||||||
var code = reactTemplates.convertTemplateToReact(html).replace(/\r/g, '');
|
var code = reactTemplates.convertTemplateToReact(html).replace(/\r/g, '');
|
||||||
var defineMap = {'react/addons': React, lodash: _};
|
var defineMap = {'react/addons': React, lodash: _};
|
||||||
//noinspection JSUnusedLocalSymbols
|
//noinspection JSUnusedLocalSymbols
|
||||||
var define = function (requirementsNames, content) { //eslint-disable-line no-unused-vars
|
var define = function (requirementsNames, content) { //eslint-disable-line no-unused-vars,func-style
|
||||||
var requirements = _.map(requirementsNames, function (reqName) {
|
var requirements = _.map(requirementsNames, function (reqName) {
|
||||||
return defineMap[reqName];
|
return defineMap[reqName];
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user