Skip to content

Instantly share code, notes, and snippets.

@xyzdata
Last active August 27, 2017 15:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save xyzdata/7d861fde6dd15262ae007e68ca0898f0 to your computer and use it in GitHub Desktop.
Save xyzdata/7d861fde6dd15262ae007e68ca0898f0 to your computer and use it in GitHub Desktop.
`1` for `warnings` and `2` for `errors` & "rules": { "semi": [2, "always"] }
@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

.babelrc
.editorconfig
.eslintrc
.npmrc

https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb

https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb/.eslintrc

.eslintrc

{
"extends": "./index.js",
"rules": {
// disable requiring trailing commas because it might be nice to revert to being JSON at some point,
// and I don't want to make big changes now.
"comma-dangle": 0
}
}

eslint-1-warnings-2-errors

https://gist.github.com/xgqfrms-gildata/7d861fde6dd15262ae007e68ca0898f0

.babelrc

{
"presets": ["airbnb"]
}

https://gist.github.com/xgqfrms-GitHub/b95f1824f2ea5a2e28b09dff6fd191bc

https://gist.github.com/xgqfrms-gildata/f2b41a63feb21081e9f51d464d7434d7#gistcomment-2134644

@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

["error", "never"] === [2, "never"]

"comma-dangle": ["error", "never"], & "comma-dangle": [2, "never"],

http://eslint.org/docs/rules/comma-dangle

"comma-dangle": [2, "never"],
// or

"comma-dangle": ["error", "never"],
// or

"comma-dangle": ["error", {
    "arrays": "never",
    "objects": "never",
    "imports": "never",
    "exports": "never",
    "functions": "ignore",
}]

@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

ECMAScript : 2016 === 7 & 2017 === 8

"ecmaVersion": 8,

http://eslint.org/docs/user-guide/configuring#specifying-parser-options

ecmaVersion - set to 3, 5 (default), 6, 7, or 8 to specify the version of ECMAScript syntax you want to use.
You can also set to 2015 (same as 6), 2016 (same as 7), or 2017 (same as 8) to use the year-based naming.

@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

{
    "name": "app-demo",
    "version": "1.0.1",
    "description": "This is a react project created by xgqfrms & webgeeker 2016.10.04",
    "main": "gulpfile.js",
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    "repository": {
        "type": "git",
        "url": "git+https://github.com/xgqfrms/React.git"
    },
    "keywords": [
        "react",
        "xgqfrms",
        "webgeeker",
        "js",
        "node",
        "ES6",
        "ant"
    ],
    "author": "xgqfrms",
    "license": "MIT",
    "bugs": {
        "url": "https://github.com/xgqfrms/React/issues"
    },
    "homepage": "https://github.com/xgqfrms/React#readme"
}

@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

keyword-spacing

no-else-return

@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

"space-before-blocks": [1, {
    "functions": "never",
    "keywords": "never",
    "classes": "always"
}],
"keyword-spacing": [1, {
    "overrides": {
        "if": { "before": false, "after": false },
        "for": { "before": false, "after": false },
        "while": { "before": false, "after": false },
        "classes": { "before": true, "after": true }
    }
}],

@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

const qs = require('qs');
const Mock = require('mockjs');
const config = require('../utils/config');
const {apiPrefix} = config;


// https://dummyimage.com/ 

let usersListData = Mock.mock({
'data|80-100': [
    {
        id: '@id',
        name: '@name',
        nickName: '@last',
        phone: /^1[34578]\d{9}$/,
        'age|11-99': 1,
        address: '@county(true)',
        isMale: '@boolean',
        email: '@email',
        createTime: '@datetime',
        avatar () {
            return Mock.Random.image('100x100', Mock.Random.color(), '#ccc', 'png', this.nickName.substr(0, 1))
        }
    }
]
});

@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

如何更具不同的用户权限,动态的生成菜单目录 ???

金融终权限控制系统设计.pdf

https://segmentfault.com/q/1010000007222057

http://paladin1988.iteye.com/blog/1682888

@xyzdata
Copy link
Author

xyzdata commented Jun 29, 2017

[
    {
        "id":1,
        "icon":"laptop",
        "name":"Dashboard",
        "router":"/dashboard"
    },
    {
        "id":2,
        "bpid":1,
        "name":"Users",
        "icon":"user",
        "router":"/user"
    },
    {
        "id":7,
        "bpid":1,
        "name":"Posts",
        "icon":"shopping-cart",
        "router":"/post"
    },
    {
        "id":21,
        "mpid":-1,
        "bpid":2,
        "name":"User Detail",
        "router":"/user/:id"
    },
    {
        "id":3,
        "bpid":1,
        "name":"Request",
        "icon":"api",
        "router":"/request"
    },
    {
        "id":4,
        "bpid":1,
        "name":"UI Element",
        "icon":"camera-o"
    },
    {
        "id":41,
        "bpid":4,
        "mpid":4,
        "name":"IconFont",
        "icon":"heart-o",
        "router":"/UIElement/iconfont"
    },
    {
        "id":42,
        "bpid":4,
        "mpid":4,
        "name":"DataTable",
        "icon":"database",
        "router":"/UIElement/dataTable"
    },
    {
        "id":43,
        "bpid":4,
        "mpid":4,
        "name":"DropOption",
        "icon":"bars",
        "router":"/UIElement/dropOption"
    },
    {
        "id":44,
        "bpid":4,
        "mpid":4,
        "name":"Search",
        "icon":"search",
        "router":"/UIElement/search"
    },
    {
        "id":45,
        "bpid":4,
        "mpid":4,
        "name":"Editor",
        "icon":"edit",
        "router":"/UIElement/editor"
    },
    {
        "id":46,
        "bpid":4,
        "mpid":4,
        "name":"layer (Function)",
        "icon":"credit-card",
        "router":"/UIElement/layer"
    },
    {
        "id":5,
        "bpid":1,
        "name":"Recharts",
        "icon":"code-o"
    },
    {
        "id":51,
        "bpid":5,
        "mpid":5,
        "name":"LineChart",
        "icon":"line-chart",
        "router":"/chart/lineChart"
    },
    {
        "id":52,
        "bpid":5,
        "mpid":5,
        "name":"BarChart",
        "icon":"bar-chart",
        "router":"/chart/barChart"
    },
    {
        "id":53,
        "bpid":5,
        "mpid":5,
        "name":"AreaChart",
        "icon":"area-chart",
        "router":"/chart/areaChart"
    },
    {
        "id":6,
        "bpid":1,
        "name":"Test Navigation",
        "icon":"setting"
    },
    {
        "id":61,
        "bpid":6,
        "mpid":6,
        "name":"Test Navigation1",
        "router":"/navigation/navigation1"
    },
    {
        "id":62,
        "bpid":6,
        "mpid":6,
        "name":"Test Navigation2",
        "router":"/navigation/navigation2"
    },
    {
        "id":621,
        "bpid":62,
        "mpid":62,
        "name":"Test Navigation21",
        "router":"/navigation/navigation2/navigation1"
    },
    {
        "id":622,
        "bpid":62,
        "mpid":62,
        "name":"Test Navigation22",
        "router":"/navigation/navigation2/navigation2"
    }
]

@xyzdata
Copy link
Author

xyzdata commented Jun 30, 2017

前端架构设计 ,Micah Godbolt ,164 ,2017.05

===================================
链接:http://pan.baidu.com/s/1pLg8YpH
密码:ms4q

http://www.ituring.com.cn/book/1946

Frontend-Architecture-Design-Systems-Sustainable

O'Reilly Media; 1 edition (February 12, 2016)

https://www.amazon.com/Frontend-Architecture-Design-Systems-Sustainable/dp/1491926783/

http://www.jianshu.com/p/92c7cfc55d0a

https://www.zhihu.com/question/26187669

https://item.jd.com/12052766.html

https://github.com/vikingmute/

本书中默认的开发环境是 Node.js 5.0.0,
书中介绍到的几个库的版本分别为React@15.0.1、webpack@1.12.14 及Redux@3.2.1,
其他如未特别说明的则为最新版本。

@xyzdata
Copy link
Author

xyzdata commented Jun 30, 2017

ES7 Object Spread - 试验性 (尚未标准化)

vikingmute/webpack-react-codes#30

数组是可以用到的,但是对象一直报错!

@gaoxiaopang

https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment

// ES7 - 试验性 (尚未标准化)
// Uncaught SyntaxError: Unexpected token ...
({a, b, ...rest} = {a:1, b:2, c:3, d:4});

image

@xyzdata
Copy link
Author

xyzdata commented Jun 30, 2017

({a, b, ...rest} = {a:1, b:2, c:3, d:4});

{a, b, ...rest} = {a:1, b:2, c:3, d:4};

[a, b, c, d] = [1, 2, 3, 4];

[a, b, ...rest] = [1, 2, 3, 4];

[x, y, z, ...rest] = [a, b, c, d];

([x, y, z, ...rest] = [a, b, c, d]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment