Skip to content

Commit

Permalink
'init'
Browse files Browse the repository at this point in the history
  • Loading branch information
ray_pan committed Jun 26, 2017
1 parent 9624ef1 commit ff7c822
Show file tree
Hide file tree
Showing 11 changed files with 223 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

[{package.json,.travis.yml,*.md}]
indent_style = space
indent_size = 2
93 changes: 93 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
module.exports = {
// 脚本执行的环境,不同的执行环境有不同的预定义全局变量
'env': {
'browser': true,
'es6': true,
'node': true
},
'plugins': [
'react'
],
// 需要同构babel-eslint来解析es7.decorators,es7.classProperties
'parser': 'babel-eslint',
// 使用推荐的规范配置:http://eslint.org/docs/rules/
//"extends": "eslint:recommended",
// "extends": [
// "eslint:recommended",
// "plugin:react/recommended"
// ],
// https://github.com/airbnb/javascript
'extends': 'eslint-config-airbnb',
// 解析规则,决定ESLint认为哪些是错误
'parserOptions': {
// ECMAScript中的模块类型
'sourceType': 'module',
// 指定要使用的ECMAScript的版本
'ecmaVersion': 7,
// 额外的语言特性配置
'ecmaFeatures': {
// 在全局作用域允许return语句
'globalReturn': true,
// 开启全局的严格模式
'impliedStrict': true,
// 支持未来的选项
'experimentalObjectRestSpread': true,
// 使用JSX
'jsx': true
}
},
// 全局变量
'globals': {
'__uri': true, // fis路径转换
'__inline': true, // fis内嵌转换
'UE': true, // UEditor
'wx': true // 微信SDK
},
// lint规则配置 "off" or 0 "warn" or 1 2 or 2
// https://github.com/airbnb/javascript
'rules': {

// 排版规则
'indent': [ // 缩进:4个空格
'warn',
2,
{
'SwitchCase': 1
}
],
'quotes': [ // 引号 单引号
1,
'single'
],
'no-extra-semi': 1, // 禁止多余的分号
'semi': [ // 分号 加分号 http://eslint.org/docs/rules/semi
1,
'always'
],

// 语法规则
'strict': 2,
'no-console': 1, //不允许有console调试
'no-case-declarations': 0, // 允许在 case 子句中使用词法声明
'no-undef': 2, // 变量不通过 var 进行声明或引用未定义变量。
'no-unused-vars': 1, //变量声明但未使用。
'no-eval': 1, // 不使用 eval()。
'valid-typeof': 2, //typeof的结果必须和一个有效的字符串进行比较,如typeof foo === 'strnig'即是不合法的字符串
'no-unreachable': 1, //不允许在return、throw、continue、break等中断语句之后出现代码。
'no-dupe-args': 1, //定义对象时不允许有重复的键。
'no-dupe-keys': 1, //方法的参数中不允许有重复值。

// react规则
'react/prop-types': 0,
'react/display-name': 0,
'react/require-render-return': 2,
'react/jsx-no-target-blank': 0,
'react/no-danger-with-children': 0,
'react/no-string-refs': 0,
'react/no-unknown-property': 2,
'react/no-danger': 0,
'no-class-assign': 0,
'react/jsx-uses-react': 2,
'react/jsx-uses-vars': 2
}
};
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*.iml
.idea/
.vscode/
.ipr
.iws
*~
~*
*.diff
*.log
*.patch
*.bak
.DS_Store
Thumbs.db
.project
.*proj
.svn/
*.swp
out/
node_modules/
tmp/
/dist/
/lib/
26 changes: 26 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"ignoreFiles": [],
"extends": "stylelint-config-standard",
"rules": {
"color-hex-case": null,
"at-rule-empty-line-before": null,
"at-rule-name-space-after": null,
"comment-empty-line-before": null,
"declaration-bang-space-before": null,
"declaration-empty-line-before": null,
"function-comma-newline-after": null,
"function-name-case": null,
"function-parentheses-newline-inside": null,
"function-max-empty-lines": null,
"function-whitespace-after": null,
"indentation": null,
"number-leading-zero": null,
"number-no-trailing-zeros": null,
"rule-empty-line-before": null,
"selector-combinator-space-after": null,
"selector-list-comma-newline-after": null,
"selector-pseudo-element-colon-notation": null,
"unit-no-unknown": null,
"value-list-max-empty-lines": null
}
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## 版本号 / 更新日期
* `[+]` 新增 XXX 功能
* `[-]` 移除 XXX 功能
* `[^]` 更新 XXX 功能
* `[#]` 修复 XXX 问题

## ${version} / 2017-06-01
* 初始化项目
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# component
iloka的组件项目脚手架

基于efit构建工具的组件脚手架。

## 使用方法

```
npm i -g efit
mkdir foo && cd foo
efit init component
```
17 changes: 17 additions & 0 deletions fis-conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var pkg = require('./package');
var eslintrc = require('./.eslintrc');
var stylelintrc = fis.util.readJSON('./.stylelintrc');

// 项目基础配置
fis.component({
project: {
// 项目名称
name: pkg.name,
// 项目版本号,填了后自动替换源码中@VERSION@标识
version: pkg.version,
// eslint配置文件 http://eslint.org/
eslintrc: eslintrc,
// stylelint配置文件 https://stylelint.io/
stylelintrc: stylelintrc
}
});
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "${name}",
"version": "${version}",
"description": "${description}",
"author": "${author}",
"main": "lib/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "efit release -l -r ./src -c -u -d ./lib --no-color",
"prepublish": "npm run build"
},
"files": [
"lib"
],
"repository": {
"type": "git",
"url": ""
},
"license": "MIT"
}
Binary file added src/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* ${description}
*/

export default {
init(){
console.log('${name} init.');
}
};
3 changes: 3 additions & 0 deletions src/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.${name} {
background: url("./img/logo.png") no-repeat center;
}

0 comments on commit ff7c822

Please sign in to comment.