diff --git a/.eslintrc b/.eslintrc index ab24739..9278e45 100644 --- a/.eslintrc +++ b/.eslintrc @@ -13,7 +13,7 @@ "lodash/prefer-filter": 0, - + "lodash/chaining": [2, "always"], "lodash/prefer-map": 0, "lodash/path-style": 0, "lodash/no-extra-args": 2, diff --git a/package.json b/package.json index 0045a59..27e3814 100644 --- a/package.json +++ b/package.json @@ -30,44 +30,44 @@ }, "homepage": "https://github.com/wix/react-templates", "dependencies": { - "chalk": "^1.1.3", - "cheerio": "^0.22.0", - "css": "^2.2.1", - "escodegen": "^1.8.1", - "esprima": "^3.0.0", - "lodash": "^4.16.2", - "normalize-html-whitespace": "^0.2.0", - "optionator": "^0.8.2", - "text-table": "^0.2.0" + "chalk": "1.1.3", + "cheerio": "0.22.0", + "css": "2.2.1", + "escodegen": "1.8.1", + "esprima": "3.1.3", + "lodash": "4.17.4", + "normalize-html-whitespace": "0.2.0", + "optionator": "0.8.2", + "text-table": "0.2.0" }, "devDependencies": { - "babel-cli": "^6.14.0", - "babel-core": "^6.14.0", - "babel-loader": "^6.2.5", - "babel-preset-es2015": "^6.14.0", - "brace": "^0.8.0", - "brfs": "^1.4.1", - "coveralls": "^2.11.14", - "eslint": "^3.6.1", - "eslint-config-wix-editor": "^0.2.3", - "eslint-plugin-lodash": "^1.10.3", - "eslint-plugin-react": "^6.3.0", - "eslint-plugin-wix-editor": "^1.1.1", + "babel-cli": "6.18.0", + "babel-core": "6.21.0", + "babel-loader": "6.2.10", + "babel-preset-es2015": "6.18.0", + "brace": "0.9.1", + "brfs": "1.4.3", + "coveralls": "2.11.15", + "eslint": "3.12.2", + "eslint-config-wix-editor": "0.2.3", + "eslint-plugin-lodash": "2.2.5", + "eslint-plugin-react": "6.8.0", + "eslint-plugin-wix-editor": "1.1.1", "grunt": "1.0.1", - "grunt-babel": "^6.0.0", + "grunt-babel": "6.0.0", "grunt-browserify": "5.0.0", "grunt-contrib-requirejs": "1.0.0", - "grunt-contrib-uglify": "^2.0.0", + "grunt-contrib-uglify": "2.0.0", "grunt-contrib-watch": "1.0.0", "grunt-eslint": "19.0.0", - "grunt-tape": "^0.1.0", - "istanbul": "^0.4.5", - "json-loader": "^0.5.4", - "react": "^15.3.2", - "react-dom": "^15.3.2", - "react-native": "^0.29.0", - "tape": "^4.6.0", - "webpack": "^1.13.2" + "grunt-tape": "0.1.0", + "istanbul": "0.4.5", + "json-loader": "0.5.4", + "react": "15.3.2", + "react-dom": "15.3.2", + "react-native": "0.39.2", + "tape": "4.6.3", + "webpack": "1.14.0" }, "keywords": [ "templates", diff --git a/playground/CodeMirrorEditor.js b/playground/CodeMirrorEditor.js index f621070..4190609 100644 --- a/playground/CodeMirrorEditor.js +++ b/playground/CodeMirrorEditor.js @@ -1,15 +1,16 @@ -define(['react', 'react-dom', 'lodash', 'jquery', './libs/codemirror-4.8/lib/codemirror', - './CMLint', - './libs/codemirror-4.8/mode/javascript/javascript', - './libs/codemirror-4.8/addon/hint/html-hint', - './libs/codemirror-4.8/addon/hint/show-hint', - './libs/codemirror-4.8/addon/hint/xml-hint', - './libs/codemirror-4.8/addon/hint/html-hint', - //'./libs/codemirror-4.8/addon/display/panel', - './libs/codemirror-4.8/mode/xml/xml', - //'./libs/codemirror-4.8/mode/css/css', - './libs/codemirror-4.8/addon/runmode/runmode' - //'./libs/codemirror-4.8/addon/display/placeholder' +define([ + 'react', 'react-dom', 'lodash', 'jquery', './libs/codemirror-4.8/lib/codemirror', + './CMLint', + './libs/codemirror-4.8/mode/javascript/javascript', + './libs/codemirror-4.8/addon/hint/html-hint', + './libs/codemirror-4.8/addon/hint/show-hint', + './libs/codemirror-4.8/addon/hint/xml-hint', + './libs/codemirror-4.8/addon/hint/html-hint', + //'./libs/codemirror-4.8/addon/display/panel', + './libs/codemirror-4.8/mode/xml/xml', + //'./libs/codemirror-4.8/mode/css/css', + './libs/codemirror-4.8/addon/runmode/runmode' + //'./libs/codemirror-4.8/addon/display/placeholder' ], function (React, ReactDOM, _, $, CodeMirror, CMLint) { 'use strict'; //codeMirror: 'libs/codemirror-4.8/lib/codemirror', @@ -171,4 +172,4 @@ define(['react', 'react-dom', 'lodash', 'jquery', './libs/codemirror-4.8/lib/cod this.editor.toTextArea(); } }); -}); \ No newline at end of file +}); diff --git a/playground/CodeMirrorViewer.js b/playground/CodeMirrorViewer.js index c3d25ca..2356590 100644 --- a/playground/CodeMirrorViewer.js +++ b/playground/CodeMirrorViewer.js @@ -1,7 +1,7 @@ define(['react', 'react-dom', 'lodash', 'jquery', './libs/codemirror-4.8/lib/codemirror', - './libs/codemirror-4.8/mode/javascript/javascript', - './libs/codemirror-4.8/mode/xml/xml', - './libs/codemirror-4.8/addon/runmode/runmode' + './libs/codemirror-4.8/mode/javascript/javascript', + './libs/codemirror-4.8/mode/xml/xml', + './libs/codemirror-4.8/addon/runmode/runmode' ], function (React, ReactDOM, _, $, CodeMirror) { 'use strict'; return React.createClass({ @@ -43,4 +43,4 @@ define(['react', 'react-dom', 'lodash', 'jquery', './libs/codemirror-4.8/lib/cod this.editor.toTextArea(); } }); -}); \ No newline at end of file +}); diff --git a/playground/examples.js b/playground/examples.js index 4e9a5a6..a2d3a8e 100644 --- a/playground/examples.js +++ b/playground/examples.js @@ -1,11 +1,11 @@ define(['lodash', 'react', './examples.rt', - 'text!./samples/hello.code', 'text!./samples/hello.rt', - 'text!./samples/todo.code', 'text!./samples/todo.rt', - 'text!./samples/rt-if.code', 'text!./samples/rt-if.rt', - 'text!./samples/rt-props.code', 'text!./samples/rt-props.rt', - 'text!./samples/rt-repeat.code', 'text!./samples/rt-repeat.rt', - 'text!./samples/weather.code', 'text!./samples/weather.rt', - 'text!./samples/rt-import.rt' + 'text!./samples/hello.code', 'text!./samples/hello.rt', + 'text!./samples/todo.code', 'text!./samples/todo.rt', + 'text!./samples/rt-if.code', 'text!./samples/rt-if.rt', + 'text!./samples/rt-props.code', 'text!./samples/rt-props.rt', + 'text!./samples/rt-repeat.code', 'text!./samples/rt-repeat.rt', + 'text!./samples/weather.code', 'text!./samples/weather.rt', + 'text!./samples/rt-import.rt' ], function (_, React, examplesTemplate, helloCode, helloRT, todoCode, todoRT, rtIfCode, rtIfRT, rtPropsCode, rtPropsRT, rtRepeatCode, rtRepeatRT, weatherCode, weatherRT, rtImportRT) { 'use strict'; var samples = { diff --git a/src/reactDOMSupport.js b/src/reactDOMSupport.js index f1c18ae..6131ba4 100644 --- a/src/reactDOMSupport.js +++ b/src/reactDOMSupport.js @@ -1,11 +1,11 @@ 'use strict'; const ver0_12_0 = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', - 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', 'circle', 'defs', 'ellipse', 'g', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan']; + 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', 'circle', 'defs', 'ellipse', 'g', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan']; const ver0_11_2 = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', 'circle', 'defs', 'ellipse', 'g', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan', 'injection']; const ver0_11_0 = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', 'circle', 'defs', 'ellipse', 'g', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan', 'injection']; const ver0_10_0 = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', 'circle', 'defs', 'g', 'line', 'linearGradient', 'path', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'injection']; const svg = ['a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateMotion', 'animateTransform', 'circle', 'clipPath', 'color-profile', 'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'g', 'image', 'line', - 'linearGradient', 'marker', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tref', 'tspan', 'use']; + 'linearGradient', 'marker', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tref', 'tspan', 'use']; const v12_svg = ver0_12_0.concat(svg); const versions = { diff --git a/src/reactSupport.js b/src/reactSupport.js index 1ead764..a3a95a6 100644 --- a/src/reactSupport.js +++ b/src/reactSupport.js @@ -18,11 +18,11 @@ function shouldUseCreateElement(context) { } const reactSupportedAttributes = ['accept', 'acceptCharset', 'accessKey', 'action', 'allowFullScreen', 'allowTransparency', 'alt', 'async', 'autoComplete', 'autoPlay', 'cellPadding', 'cellSpacing', 'charSet', 'checked', - 'classID', 'className', 'cols', 'colSpan', 'content', 'contentEditable', 'contextMenu', 'controls', 'coords', 'crossOrigin', 'data', 'dateTime', 'defer', 'dir', 'disabled', 'download', - 'draggable', 'encType', 'form', 'formNoValidate', 'frameBorder', 'height', 'hidden', 'href', 'hrefLang', 'htmlFor', 'httpEquiv', 'icon', 'id', 'label', 'lang', 'list', 'loop', 'manifest', - 'max', 'maxLength', 'media', 'mediaGroup', 'method', 'min', 'multiple', 'muted', 'name', 'noValidate', 'open', 'pattern', 'placeholder', 'poster', 'preload', 'radioGroup', 'readOnly', 'rel', - 'required', 'role', 'rows', 'rowSpan', 'sandbox', 'scope', 'scrolling', 'seamless', 'selected', 'shape', 'size', 'sizes', 'span', 'spellCheck', 'src', 'srcDoc', 'srcSet', 'start', 'step', - 'style', 'tabIndex', 'target', 'title', 'type', 'useMap', 'value', 'width', 'wmode']; + 'classID', 'className', 'cols', 'colSpan', 'content', 'contentEditable', 'contextMenu', 'controls', 'coords', 'crossOrigin', 'data', 'dateTime', 'defer', 'dir', 'disabled', 'download', + 'draggable', 'encType', 'form', 'formNoValidate', 'frameBorder', 'height', 'hidden', 'href', 'hrefLang', 'htmlFor', 'httpEquiv', 'icon', 'id', 'label', 'lang', 'list', 'loop', 'manifest', + 'max', 'maxLength', 'media', 'mediaGroup', 'method', 'min', 'multiple', 'muted', 'name', 'noValidate', 'open', 'pattern', 'placeholder', 'poster', 'preload', 'radioGroup', 'readOnly', 'rel', + 'required', 'role', 'rows', 'rowSpan', 'sandbox', 'scope', 'scrolling', 'seamless', 'selected', 'shape', 'size', 'sizes', 'span', 'spellCheck', 'src', 'srcDoc', 'srcSet', 'start', 'step', + 'style', 'tabIndex', 'target', 'title', 'type', 'useMap', 'value', 'width', 'wmode']; const classNameProp = 'className'; const attributesMapping = {'class': classNameProp, 'rt-class': classNameProp, 'for': 'htmlFor'}; //eslint-disable-line quote-props