From d4ebdf92c50f081c9b903267568515e1067fe4b5 Mon Sep 17 00:00:00 2001 From: kekee000 Date: Wed, 29 Apr 2015 13:55:08 +0800 Subject: [PATCH] modify fecs line rules --- src/.fecsignore | 4 ++++ src/.fecsrc | 15 +++++++++++++++ src/editor/controller/initRender.js | 2 -- src/fonteditor/data/online-font.js | 7 ++++--- src/fonteditor/widget/glyfviewer/binder.js | 2 -- src/graphics/getArc.js | 3 --- src/graphics/image/contour/findBreakPoints.js | 2 +- src/graphics/image/contour/findContours.js | 1 - src/graphics/image/contour/fitCurve.js | 2 -- src/graphics/image/util/de.js | 2 -- src/graphics/isBezierCross.js | 3 +-- src/graphics/join/getJoint.js | 4 ++-- src/graphics/pathTransform.js | 4 ++-- src/math/bezierCubic2Q2.js | 18 ++++++++++-------- src/math/quarticEquation.js | 1 - src/render/util/drawGraduation.js | 2 -- src/ttf/data/empty.js | 1 - src/ttf/svg/path2contours.js | 4 +--- src/ttf/table/CFF.js | 4 ++-- src/ttf/table/cff/parseCFFDict.js | 1 - src/ttf/table/cff/parseCFFEncoding.js | 1 - src/ttf/table/cff/parseCFFGlyph.js | 2 -- src/ttf/table/cmap/parse.js | 2 -- src/ttf/table/glyf/parse.js | 2 -- src/ttf/table/glyf/sizeof.js | 1 - src/ttf/table/glyf/write.js | 1 - src/ttf/ttf2eot.js | 2 -- src/ttf/ttf2woff.js | 3 +-- src/ttf/util/glyfAdjust.js | 4 ++-- 29 files changed, 45 insertions(+), 55 deletions(-) create mode 100644 src/.fecsignore create mode 100644 src/.fecsrc diff --git a/src/.fecsignore b/src/.fecsignore new file mode 100644 index 0000000..9adc753 --- /dev/null +++ b/src/.fecsignore @@ -0,0 +1,4 @@ +fonteditor/template/dialog/* +fonteditor/template/export/* +editor/shapes/* +ttf/data/* diff --git a/src/.fecsrc b/src/.fecsrc new file mode 100644 index 0000000..eb82220 --- /dev/null +++ b/src/.fecsrc @@ -0,0 +1,15 @@ +{ + "eslint": { + "env": { + "node": true, + "browser": true + }, + + "rules": { + "no-console": 0, + "fecs-max-statements": 0, + "max-params": 0, + "max-depth": 0 + } + } +} diff --git a/src/editor/controller/initRender.js b/src/editor/controller/initRender.js index 87f3973..f491ed7 100644 --- a/src/editor/controller/initRender.js +++ b/src/editor/controller/initRender.js @@ -48,7 +48,6 @@ define( } - /* eslint-disable max-depth */ /** * 初始化渲染器 */ @@ -257,7 +256,6 @@ define( me.render.refresh(); }); } - /* eslint-enable max-depth */ return initRender; } diff --git a/src/fonteditor/data/online-font.js b/src/fonteditor/data/online-font.js index a30255e..b6109e5 100644 --- a/src/fonteditor/data/online-font.js +++ b/src/fonteditor/data/online-font.js @@ -3,7 +3,6 @@ * @author mengke01(kekee000@gmail.com) */ -/* eslint-disable max-len */ define( function (require) { return [ @@ -34,12 +33,14 @@ define( }, { name: 'baiduHealth.woff', - url: 'http://vs-static.baidu.com/m-health/new-composite/20141223/asset/common/css/font/baiduHealth.woff', + url: 'http://vs-static.baidu.com' + + '/m-health/new-composite/20141223/asset/common/css/font/baiduHealth.woff', from: '百度健康图标' }, { name: 'fonteditor.woff', - url: 'http://vs-static.baidu.com/m-health/med-detail/201412301413/asset/common/css/fonts/fonteditor.woff', + url: 'http://vs-static.baidu.com' + + '/m-health/med-detail/201412301413/asset/common/css/fonts/fonteditor.woff', from: '百度健康医药馆图标' }, { diff --git a/src/fonteditor/widget/glyfviewer/binder.js b/src/fonteditor/widget/glyfviewer/binder.js index f8b2abe..44a1586 100644 --- a/src/fonteditor/widget/glyfviewer/binder.js +++ b/src/fonteditor/widget/glyfviewer/binder.js @@ -66,7 +66,6 @@ define( } - /* eslint-disable max-depth */ function downlistener(e) { var me = this; e.ctrlKey = e.ctrlKey || e.metaKey; @@ -134,7 +133,6 @@ define( } } - /* eslint-disable max-depth */ /** * 绑定dom事件 diff --git a/src/graphics/getArc.js b/src/graphics/getArc.js index 0d7edc7..5ddfcc4 100644 --- a/src/graphics/getArc.js +++ b/src/graphics/getArc.js @@ -48,7 +48,6 @@ define( return path; } - /* eslint-disable fecs-max-statements, max-params */ /** * 获取椭圆弧度 * @@ -183,8 +182,6 @@ define( return [p0, p1]; } - /* eslint-enable fecs-max-statements, max-params */ - return getArc; } diff --git a/src/graphics/image/contour/findBreakPoints.js b/src/graphics/image/contour/findBreakPoints.js index a531bdc..ecae54c 100644 --- a/src/graphics/image/contour/findBreakPoints.js +++ b/src/graphics/image/contour/findBreakPoints.js @@ -21,7 +21,7 @@ define( return Math.sqrt(Math.pow(p0.x - p1.x, 2) + Math.pow(p0.y - p1.y, 2)); } - /* eslint-disable fecs-max-statements */ + /* 查找轮廓中的关键点 * * @param {Array} contour 轮廓点集合 diff --git a/src/graphics/image/contour/findContours.js b/src/graphics/image/contour/findContours.js index 2a2b755..7f2de89 100644 --- a/src/graphics/image/contour/findContours.js +++ b/src/graphics/image/contour/findContours.js @@ -53,7 +53,6 @@ define( return newContour; } - /* eslint-disable fecs-max-statements */ /** * 查找轮廓集合 * @param {Object} imageData 二值图像数据 diff --git a/src/graphics/image/contour/fitCurve.js b/src/graphics/image/contour/fitCurve.js index 9647230..cd07ec7 100644 --- a/src/graphics/image/contour/fitCurve.js +++ b/src/graphics/image/contour/fitCurve.js @@ -417,7 +417,6 @@ define( } - /* eslint-disable max-params */ /** * 三次bezier曲线拟合 * @@ -505,7 +504,6 @@ define( tHatCenter.y = -tHatCenter.y; fitCubic(points, splitPoint, last, tHatCenter, tHat2, error, result); } - /* eslint-enable max-params */ /** diff --git a/src/graphics/image/util/de.js b/src/graphics/image/util/de.js index d541c9d..c035d9a 100644 --- a/src/graphics/image/util/de.js +++ b/src/graphics/image/util/de.js @@ -90,7 +90,6 @@ define( return offsetArray; } - /* eslint-disable max-params */ /** * 在结构数组内赋值 @@ -120,7 +119,6 @@ define( return false; } - /* eslint-enable max-params */ /** * 是否临近指定的点 diff --git a/src/graphics/isBezierCross.js b/src/graphics/isBezierCross.js index 69e033a..5d0ba53 100644 --- a/src/graphics/isBezierCross.js +++ b/src/graphics/isBezierCross.js @@ -16,7 +16,6 @@ define( var minus = matrix.minus; var plus = matrix.plus; - /* eslint-disable fecs-max-statements, max-params */ /** * 求两个bezier曲线的交点 * @@ -210,7 +209,7 @@ define( return false; } - /* eslint-enable fecs-max-statements, max-params */ + return isBezierCross; } diff --git a/src/graphics/join/getJoint.js b/src/graphics/join/getJoint.js index 09a18d0..7ec5e46 100644 --- a/src/graphics/join/getJoint.js +++ b/src/graphics/join/getJoint.js @@ -16,7 +16,7 @@ define( return (p.x * 31 + p.y) * 31; } - /* eslint-disable max-params */ + /** * 求路径和曲线段的交点集合 * @param {Array} path 路径 @@ -74,7 +74,7 @@ define( return joint.length ? joint : false; } - /* eslint-enable max-params */ + return getJoint; } diff --git a/src/graphics/pathTransform.js b/src/graphics/pathTransform.js index 6222ec1..5f24e79 100644 --- a/src/graphics/pathTransform.js +++ b/src/graphics/pathTransform.js @@ -17,7 +17,7 @@ define( function (require) { - /* eslint-disable max-params */ + /** * 图形仿射矩阵变换 * @@ -43,7 +43,7 @@ define( } return contour; } - /* eslint-enable max-params */ + return transform; } diff --git a/src/math/bezierCubic2Q2.js b/src/math/bezierCubic2Q2.js index 9c23308..8a7e06c 100644 --- a/src/math/bezierCubic2Q2.js +++ b/src/math/bezierCubic2Q2.js @@ -39,14 +39,16 @@ define(function (require) { // 判断极端情况,控制点和起止点一样 if (p1.x === c1.x && p1.y === c1.y && c2.x === p2.x && c2.y === p2.y) { - return [[ - p1, - { - x: (p1.x + p2.x) / 2, - y: (p1.y + p2.y) / 2 - }, - p2 - ]]; + return [ + [ + p1, + { + x: (p1.x + p2.x) / 2, + y: (p1.y + p2.y) / 2 + }, + p2 + ] + ]; } diff --git a/src/math/quarticEquation.js b/src/math/quarticEquation.js index 8a52661..7995b51 100644 --- a/src/math/quarticEquation.js +++ b/src/math/quarticEquation.js @@ -12,7 +12,6 @@ define( var cubeEquation = require('./cubeEquation'); - /* eslint-disable fecs-max-statements */ /** * 求解四次方程 * diff --git a/src/render/util/drawGraduation.js b/src/render/util/drawGraduation.js index f7fc808..b1eaad8 100644 --- a/src/render/util/drawGraduation.js +++ b/src/render/util/drawGraduation.js @@ -7,7 +7,6 @@ define( function (require) { - /* eslint-disable fecs-max-statements */ /** * 绘制刻度信息 * @@ -131,7 +130,6 @@ define( ctx.restore(); ctx.stroke(); } - /* eslint-enable fecs-max-statements */ return drawGraduation; diff --git a/src/ttf/data/empty.js b/src/ttf/data/empty.js index c07a7c1..19c57e7 100644 --- a/src/ttf/data/empty.js +++ b/src/ttf/data/empty.js @@ -5,7 +5,6 @@ define( function (require) { - /* eslint-disable */ return { "version": 1, "numTables": 10, diff --git a/src/ttf/svg/path2contours.js b/src/ttf/svg/path2contours.js index 4a2dbfb..640c609 100644 --- a/src/ttf/svg/path2contours.js +++ b/src/ttf/svg/path2contours.js @@ -75,7 +75,7 @@ define(function (require) { return contour; } - /* eslint-disable fecs-max-statements, max-depth */ + /** * svg 命令数组转轮廓 * @@ -458,8 +458,6 @@ define(function (require) { }); } - - /* eslint-enable fecs-max-statements, max-depth */ /** * svg path转轮廓 * diff --git a/src/ttf/table/CFF.js b/src/ttf/table/CFF.js index f3122b5..e74ff01 100644 --- a/src/ttf/table/CFF.js +++ b/src/ttf/table/CFF.js @@ -143,11 +143,11 @@ define( cff.topDict = topDict; // 私有字典数据 - var privateDictLength = topDict['private'][0]; + var privateDictLength = topDict.private[0]; var privateDict = {}; if (privateDictLength) { - var privateDictOffset = offset + topDict['private'][1]; + var privateDictOffset = offset + topDict.private[1]; privateDict = parseCFFDict.parsePrivateDict( reader, privateDictOffset, diff --git a/src/ttf/table/cff/parseCFFDict.js b/src/ttf/table/cff/parseCFFDict.js index c6c6d45..bd1cea4 100644 --- a/src/ttf/table/cff/parseCFFDict.js +++ b/src/ttf/table/cff/parseCFFDict.js @@ -6,7 +6,6 @@ define( function (require) { - /* eslint-disable no-console */ var getCFFString = require('./getCFFString'); diff --git a/src/ttf/table/cff/parseCFFEncoding.js b/src/ttf/table/cff/parseCFFEncoding.js index 1ae19fd..00e0dfc 100644 --- a/src/ttf/table/cff/parseCFFEncoding.js +++ b/src/ttf/table/cff/parseCFFEncoding.js @@ -6,7 +6,6 @@ define( function (require) { - /* eslint-disable no-console */ /** * 解析cff encoding数据 diff --git a/src/ttf/table/cff/parseCFFGlyph.js b/src/ttf/table/cff/parseCFFGlyph.js index acc8962..76b08ed 100644 --- a/src/ttf/table/cff/parseCFFGlyph.js +++ b/src/ttf/table/cff/parseCFFGlyph.js @@ -6,9 +6,7 @@ define( function (require) { - /* eslint-disable no-console */ - /* eslint-disable fecs-max-statements */ /** * 解析cff字形,返回直线和三次bezier曲线点数组 * @param {Array} code 操作码 diff --git a/src/ttf/table/cmap/parse.js b/src/ttf/table/cmap/parse.js index 9a5677f..97ccf3a 100644 --- a/src/ttf/table/cmap/parse.js +++ b/src/ttf/table/cmap/parse.js @@ -6,11 +6,9 @@ define( function (require) { - /* eslint-disable no-console */ var readWindowsAllCodes = require('../../util/readWindowsAllCodes'); - /* eslint-disable fecs-max-statements */ /** * 读取cmap子表 * diff --git a/src/ttf/table/glyf/parse.js b/src/ttf/table/glyf/parse.js index ef2852a..1f9de6e 100644 --- a/src/ttf/table/glyf/parse.js +++ b/src/ttf/table/glyf/parse.js @@ -5,7 +5,6 @@ define( function (require) { - /* eslint-disable no-console */ var glyFlag = require('../../enum/glyFlag'); var componentFlag = require('../../enum/componentFlag'); @@ -14,7 +13,6 @@ define( var MAX_INSTRUCTION_LENGTH = 5000; // 设置instructions阈值防止读取错误 var MAX_NUMBER_OF_COORDINATES = 20000; // 设置坐标最大个数阈值,防止glyf读取错误 - /* eslint-disable fecs-max-statements */ /** * 读取简单字形 * diff --git a/src/ttf/table/glyf/sizeof.js b/src/ttf/table/glyf/sizeof.js index 39dd76a..3df146b 100644 --- a/src/ttf/table/glyf/sizeof.js +++ b/src/ttf/table/glyf/sizeof.js @@ -9,7 +9,6 @@ define( var glyFlag = require('../../enum/glyFlag'); - /* eslint-disable fecs-max-statements */ /** * 获取glyf的大小 * diff --git a/src/ttf/table/glyf/write.js b/src/ttf/table/glyf/write.js index c6801f2..703b4de 100644 --- a/src/ttf/table/glyf/write.js +++ b/src/ttf/table/glyf/write.js @@ -8,7 +8,6 @@ define( function (require) { var componentFlag = require('../../enum/componentFlag'); - /* eslint-disable fecs-max-statements */ /** * 写glyf * @param {Object} writer 写入器 diff --git a/src/ttf/ttf2eot.js b/src/ttf/ttf2eot.js index 4224f6e..1d9f29a 100644 --- a/src/ttf/ttf2eot.js +++ b/src/ttf/ttf2eot.js @@ -39,7 +39,6 @@ define( ] ); - /* eslint-disable fecs-max-statements */ /** * ttf格式转换成eot字体格式 * @@ -161,7 +160,6 @@ define( return eotWriter.getBuffer(); } - /* eslint-enable fecs-max-statements */ return ttf2eot; } diff --git a/src/ttf/ttf2woff.js b/src/ttf/ttf2woff.js index c2bf5d7..107f7d5 100644 --- a/src/ttf/ttf2woff.js +++ b/src/ttf/ttf2woff.js @@ -113,7 +113,7 @@ define( return xml; } - /* eslint-disable fecs-max-statements */ + /** * ttf格式转换成woff字体格式 * @@ -301,7 +301,6 @@ define( return woffWriter.getBuffer(); } - /* eslint-enable fecs-max-statements */ return ttf2woff; } diff --git a/src/ttf/util/glyfAdjust.js b/src/ttf/util/glyfAdjust.js index e4dfbcc..68719de 100644 --- a/src/ttf/util/glyfAdjust.js +++ b/src/ttf/util/glyfAdjust.js @@ -9,7 +9,7 @@ define(function (require) { var pathCeil = require('graphics/pathCeil'); var computeBoundingBox = require('graphics/computeBoundingBox'); - /* eslint-disable max-params */ + /** * 简单字形的缩放和平移调整 * @@ -97,7 +97,7 @@ define(function (require) { return g; } - /* eslint-enable max-params */ + return glyfAdjust; });