mirror of
https://github.com/bobwen-dev/react-templates
synced 2025-04-12 00:56:39 +02:00
upgrade eslint and plugins
This commit is contained in:
parent
12040961f8
commit
58b8093090
@ -16,7 +16,7 @@ web/**
|
|||||||
|
|
||||||
playground/sample/**
|
playground/sample/**
|
||||||
test/data/**
|
test/data/**
|
||||||
dist-test/data/**
|
dist-test
|
||||||
dist
|
dist
|
||||||
|
|
||||||
internalTasks/release.js
|
internalTasks/release.js
|
||||||
|
56
.eslintrc
56
.eslintrc
@ -1,7 +1,13 @@
|
|||||||
{
|
{
|
||||||
"extends": "wix-editor/node",
|
"extends": "wix-editor/node",
|
||||||
"plugins": ["lodash3", "wix-editor"],
|
"plugins": ["lodash", "wix-editor"],
|
||||||
|
"settings": {
|
||||||
|
"lodash": {
|
||||||
|
"version": 3
|
||||||
|
}
|
||||||
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"semi": [2, "always"],
|
||||||
"no-var": 0,
|
"no-var": 0,
|
||||||
"object-shorthand": 0,
|
"object-shorthand": 0,
|
||||||
"prefer-arrow-callback": 0,
|
"prefer-arrow-callback": 0,
|
||||||
@ -11,30 +17,30 @@
|
|||||||
|
|
||||||
"no-restricted-syntax": [2, "WithStatement", "ContinueStatement", "ForStatement"],
|
"no-restricted-syntax": [2, "WithStatement", "ContinueStatement", "ForStatement"],
|
||||||
"no-negated-condition": 1,
|
"no-negated-condition": 1,
|
||||||
"lodash3/prop-shorthand": 2,
|
|
||||||
"lodash3/matches-shorthand": [2, "always", 3],
|
"lodash/prop-shorthand": 2,
|
||||||
"lodash3/matches-prop-shorthand": 2,
|
"lodash/matches-shorthand": [2, "always"],
|
||||||
"lodash3/prefer-chain": 2,
|
"lodash/matches-prop-shorthand": [2, "always"],
|
||||||
"lodash3/preferred-alias": 2,
|
"lodash/prefer-chain": 2,
|
||||||
"lodash3/no-single-chain": 2,
|
"lodash/preferred-alias": 2,
|
||||||
"lodash3/prefer-reject": [2, 3],
|
"lodash/no-single-chain": 2,
|
||||||
"lodash3/prefer-filter": [2, 3],
|
"lodash/prefer-reject": [2, 3],
|
||||||
"lodash3/no-unnecessary-bind": 2,
|
"lodash/prefer-filter": 0,
|
||||||
"lodash3/unwrap": 2,
|
"lodash/callback-binding": 2,
|
||||||
"lodash3/prefer-compact": 2,
|
"lodash/unwrap": 2,
|
||||||
"lodash3/no-double-unwrap": 2,
|
"lodash/prefer-lodash-chain": 2,
|
||||||
"lodash3/prefer-map": 2,
|
"lodash/prefer-compact": 2,
|
||||||
"lodash3/prefer-wrapper-method": 2,
|
"lodash/no-double-unwrap": 2,
|
||||||
"lodash3/prefer-invoke": 2,
|
"lodash/prefer-map": 0,
|
||||||
"lodash3/prefer-thru": 2,
|
"lodash/prefer-wrapper-method": 2,
|
||||||
"lodash3/prefer-lodash-chain": 2,
|
"lodash/prefer-thru": 2,
|
||||||
"lodash3/prefer-lodash-method": 0,
|
"lodash/prefer-get": [2, 3],
|
||||||
"lodash3/prefer-lodash-typecheck": 2,
|
"lodash/collection-return": 2,
|
||||||
"lodash3/no-commit": 2,
|
"lodash/prefer-times": 2,
|
||||||
"lodash3/prefer-get": [2, 3],
|
"lodash/chain-style": [2, "as-needed"],
|
||||||
"lodash3/collection-return": 2,
|
"lodash/path-style": 0,
|
||||||
"lodash3/prefer-matches": 2,
|
"lodash/no-extra-args": 2,
|
||||||
"lodash3/prefer-times": 2,
|
"lodash/identity-shorthand": [2, "always"],
|
||||||
|
|
||||||
"wix-editor/augmented-assignment": 1,
|
"wix-editor/augmented-assignment": 1,
|
||||||
"wix-editor/no-not-not": 1,
|
"wix-editor/no-not-not": 1,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- 0.10
|
|
||||||
- 0.12
|
- 0.12
|
||||||
- 4
|
- 4
|
||||||
|
- 5
|
||||||
|
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
|
22
package.json
22
package.json
@ -40,25 +40,25 @@
|
|||||||
"text-table": "^0.2.0"
|
"text-table": "^0.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-cli": "^6.3.17",
|
"babel-cli": "^6.6.0",
|
||||||
"babel-core": "^6.3.26",
|
"babel-core": "^6.6.0",
|
||||||
"babel-loader": "^6.2.0",
|
"babel-loader": "^6.2.4",
|
||||||
"babel-preset-es2015": "^6.3.13",
|
"babel-preset-es2015": "^6.6.0",
|
||||||
"brace": "0.7.0",
|
"brace": "0.7.0",
|
||||||
"brfs": "^1.4.1",
|
"brfs": "^1.4.1",
|
||||||
"coveralls": "2.11.6",
|
"coveralls": "^2.11.8",
|
||||||
"eslint": "1.10.3",
|
"eslint": "^2.2.0",
|
||||||
"eslint-config-wix-editor": "^0.1.1",
|
"eslint-config-wix-editor": "^0.2.3",
|
||||||
"eslint-plugin-lodash3": "^0.5.1",
|
"eslint-plugin-lodash": "^1.2.2",
|
||||||
"eslint-plugin-react": "^3.13.1",
|
"eslint-plugin-react": "^3.13.1",
|
||||||
"eslint-plugin-wix-editor": "^1.0.1",
|
"eslint-plugin-wix-editor": "^1.1.1",
|
||||||
"grunt": "^0.4.5",
|
"grunt": "^0.4.5",
|
||||||
"grunt-babel": "^6.0.0",
|
"grunt-babel": "^6.0.0",
|
||||||
"grunt-browserify": "^4.0.0",
|
"grunt-browserify": "^4.0.0",
|
||||||
"grunt-contrib-requirejs": "^0.4.4",
|
"grunt-contrib-requirejs": "^0.4.4",
|
||||||
"grunt-contrib-uglify": "^0.11.0",
|
"grunt-contrib-uglify": "^0.11.0",
|
||||||
"grunt-contrib-watch": "^0.6.1",
|
"grunt-contrib-watch": "^0.6.1",
|
||||||
"grunt-eslint": "^17.3.1",
|
"grunt-eslint": "^18.0.0",
|
||||||
"grunt-tape": "0.0.2",
|
"grunt-tape": "0.0.2",
|
||||||
"istanbul": "0.4.1",
|
"istanbul": "0.4.1",
|
||||||
"json-loader": "^0.5.4",
|
"json-loader": "^0.5.4",
|
||||||
@ -66,7 +66,7 @@
|
|||||||
"react-dom": "^0.14.2",
|
"react-dom": "^0.14.2",
|
||||||
"react-native": "^0.17.0",
|
"react-native": "^0.17.0",
|
||||||
"tape": "^4.4.0",
|
"tape": "^4.4.0",
|
||||||
"webpack": "^1.12.9"
|
"webpack": "^1.12.14"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"templates",
|
"templates",
|
||||||
|
@ -37,7 +37,8 @@ define(['react', 'lodash', 'jquery', './libs/codemirror-4.8/lib/codemirror'], fu
|
|||||||
}
|
}
|
||||||
|
|
||||||
function makeMarker(labels, severity, multiple, tooltips) {
|
function makeMarker(labels, severity, multiple, tooltips) {
|
||||||
var marker = document.createElement('div'), inner = marker;
|
var marker = document.createElement('div');
|
||||||
|
var inner = marker;
|
||||||
marker.className = 'CodeMirror-lint-marker-' + severity;
|
marker.className = 'CodeMirror-lint-marker-' + severity;
|
||||||
if (multiple) {
|
if (multiple) {
|
||||||
inner = marker.appendChild(document.createElement('div'));
|
inner = marker.appendChild(document.createElement('div'));
|
||||||
|
@ -113,12 +113,12 @@ function lineText(line) {
|
|||||||
module.exports = function (results) {
|
module.exports = function (results) {
|
||||||
results = _.groupBy(results, 'file');
|
results = _.groupBy(results, 'file');
|
||||||
|
|
||||||
var output = '\n',
|
var output = '\n';
|
||||||
total = 0,
|
var total = 0;
|
||||||
errors = 0,
|
var errors = 0;
|
||||||
warnings = 0,
|
var warnings = 0;
|
||||||
infos = 0,
|
var infos = 0;
|
||||||
summaryColor = 'cyan';
|
var summaryColor = 'cyan';
|
||||||
|
|
||||||
_.forEach(results, function (result, k) {
|
_.forEach(results, function (result, k) {
|
||||||
var messages = result;
|
var messages = result;
|
||||||
|
@ -20,7 +20,7 @@ function createRelativeReadFileSync(baseFile) {
|
|||||||
var basePath = path.dirname(baseFile);
|
var basePath = path.dirname(baseFile);
|
||||||
return function(filename) {
|
return function(filename) {
|
||||||
return fs.readFileSync(path.resolve(basePath, filename));
|
return fs.readFileSync(path.resolve(basePath, filename));
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -30,7 +30,7 @@ const propsMergeFunction = `function mergeProps(inline,external) {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
`
|
`;
|
||||||
|
|
||||||
var classSetTemplate = _.template('_.keys(_.pick(<%= classSet %>, _.identity)).join(" ")');
|
var classSetTemplate = _.template('_.keys(_.pick(<%= classSet %>, _.identity)).join(" ")');
|
||||||
|
|
||||||
@ -271,6 +271,7 @@ function genBind(func, args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleStyleProp(val, node, context) {
|
function handleStyleProp(val, node, context) {
|
||||||
|
/*eslint lodash/prefer-lodash-chain:0*/
|
||||||
const styleStr = _(val)
|
const styleStr = _(val)
|
||||||
.split(';')
|
.split(';')
|
||||||
.map(_.trim)
|
.map(_.trim)
|
||||||
@ -279,7 +280,7 @@ function handleStyleProp(val, node, context) {
|
|||||||
const pair = i.split(':');
|
const pair = i.split(':');
|
||||||
//const val = pair[1];
|
//const val = pair[1];
|
||||||
const val = pair.slice(1).join(':').trim();
|
const val = pair.slice(1).join(':').trim();
|
||||||
return _.camelCase(pair[0].trim()) + ' : ' + convertText(node, context, val.trim())
|
return _.camelCase(pair[0].trim()) + ' : ' + convertText(node, context, val.trim());
|
||||||
//return stringUtils.convertToCamelCase(pair[0].trim()) + ' : ' + convertText(node, context, val.trim())
|
//return stringUtils.convertToCamelCase(pair[0].trim()) + ' : ' + convertText(node, context, val.trim())
|
||||||
})
|
})
|
||||||
.join(',');
|
.join(',');
|
||||||
@ -306,6 +307,7 @@ function convertTagNameToConstructor(tagName, context) {
|
|||||||
/**
|
/**
|
||||||
* @param {string} html
|
* @param {string} html
|
||||||
* @param options
|
* @param options
|
||||||
|
* @param reportContext
|
||||||
* @return {Context}
|
* @return {Context}
|
||||||
*/
|
*/
|
||||||
function defaultContext(html, options, reportContext) {
|
function defaultContext(html, options, reportContext) {
|
||||||
@ -408,7 +410,7 @@ function convertHtmlToReact(node, context) {
|
|||||||
data.children = utils.concatChildren(children);
|
data.children = utils.concatChildren(children);
|
||||||
|
|
||||||
if (node.name === virtualNode) { //eslint-disable-line wix-editor/prefer-ternary
|
if (node.name === virtualNode) { //eslint-disable-line wix-editor/prefer-ternary
|
||||||
data.body = "[" + _.compact(children).join(',') + "]"
|
data.body = "[" + _.compact(children).join(',') + "]";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
data.body = _.template(getTagTemplateString(!hasNonSimpleChildren(node), reactSupport.shouldUseCreateElement(context)))(data);
|
data.body = _.template(getTagTemplateString(!hasNonSimpleChildren(node), reactSupport.shouldUseCreateElement(context)))(data);
|
||||||
@ -566,9 +568,9 @@ function convertRT(html, reportContext, options) {
|
|||||||
if (options.modules === 'typescript') {
|
if (options.modules === 'typescript') {
|
||||||
buildImport = (v, p) => `import ${v} = require('${p}');`;
|
buildImport = (v, p) => `import ${v} = require('${p}');`;
|
||||||
} else if (options.modules === 'es6') { // eslint-disable-line
|
} else if (options.modules === 'es6') { // eslint-disable-line
|
||||||
buildImport = (v, p) => `import ${v} from '${p}';`
|
buildImport = (v, p) => `import ${v} from '${p}';`;
|
||||||
} else {
|
} else {
|
||||||
buildImport = (v, p) => `var ${v} = require('${p}');`
|
buildImport = (v, p) => `var ${v} = require('${p}');`;
|
||||||
}
|
}
|
||||||
const header = options.flow ? '/* @flow */\n' : '';
|
const header = options.flow ? '/* @flow */\n' : '';
|
||||||
const vars = header + _(context.defines).map(buildImport).join('\n');
|
const vars = header + _(context.defines).map(buildImport).join('\n');
|
||||||
|
@ -215,7 +215,7 @@ test('html tests', function (t) {
|
|||||||
var filename = path.join(dataPath, testFile);
|
var filename = path.join(dataPath, testFile);
|
||||||
var options = {
|
var options = {
|
||||||
readFileSync: fsUtil.createRelativeReadFileSync(filename)
|
readFileSync: fsUtil.createRelativeReadFileSync(filename)
|
||||||
}
|
};
|
||||||
var code = '';
|
var code = '';
|
||||||
try {
|
try {
|
||||||
var html = fs.readFileSync(filename).toString();
|
var html = fs.readFileSync(filename).toString();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user