Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add prettier #326

Open
wants to merge 1 commit into
base: feature/weui_v2_beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
build/*
docs/*
38 changes: 38 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// alloyteam prettier
module.exports = {
// 一行最多 100 字符
printWidth: 100,
// 使用 4 个空格缩进
tabWidth: 4,
// 不使用缩进符,而使用空格
useTabs: false,
// 行尾需要有分号
semi: true,
// 使用单引号
singleQuote: true,
// 对象的 key 仅在必要时用引号
quoteProps: 'as-needed',
// jsx 不使用单引号,而使用双引号
jsxSingleQuote: false,
// 末尾不需要逗号
trailingComma: 'none',
// 大括号内的首尾需要空格
bracketSpacing: true,
// jsx 标签的反尖括号需要换行
jsxBracketSameLine: false,
// 箭头函数,只有一个参数的时候,也需要括号
arrowParens: 'always',
// 每个文件格式化的范围是文件的全部内容
rangeStart: 0,
rangeEnd: Infinity,
// 不需要写文件开头的 @prettier
requirePragma: false,
// 不需要自动在文件开头插入 @prettier
insertPragma: false,
// 使用默认的折行标准
proseWrap: 'preserve',
// 根据显示样式决定 html 要不要折行
htmlWhitespaceSensitivity: 'css',
// 换行符使用 lf
endOfLine: 'lf'
};
260 changes: 137 additions & 123 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,125 +1,139 @@
{
"name": "react-weui",
"version": "1.2.3",
"description": "weui for react",
"main": "./build/packages/index.js",
"scripts": {
"start": "webpack-dev-server",
"start:doc": "webpack-dev-server --config webpack.config.doc.js --progress --colors --port 8080",
"build": "node scripts/build.js -p",
"lint": "eslint components --ext .ts,.tsx",
"autofix": "eslint components --ext .ts,.tsx --fix",
"pretest": "npm run lint",
"test": "mocha",
"test:watch": "npm run test -- --watch",
"coverage": "npm run lint & nyc --require @babel/register mocha && nyc report --reporter=lcov",
"postpublish": "gh-pages -d ./build/demo"
},
"repository": {
"type": "git",
"url": "git+https://github.com/weui/react-weui.git"
},
"keywords": [
"mobile",
"ui",
"framework",
"weui",
"react",
"wechat"
],
"author": "wechat ui team",
"license": "MIT",
"bugs": {
"url": "https://github.com/weui/react-weui/issues"
},
"homepage": "https://github.com/weui/react-weui",
"dependencies": {
"prop-types": "^15.7.2",
"weui": "^2.3.0"
},
"devDependencies": {
"@babel/cli": "^7.10.5",
"@babel/core": "^7.10.5",
"@babel/plugin-external-helpers": "^7.10.4",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-transform-runtime": "^7.10.5",
"@babel/polyfill": "^7.10.4",
"@babel/preset-env": "^7.10.4",
"@babel/preset-react": "^7.10.4",
"@babel/register": "^7.10.5",
"@babel/runtime": "^7.10.5",
"@rollup/plugin-babel": "^5.1.0",
"@rollup/plugin-commonjs": "^14.0.0",
"@rollup/plugin-node-resolve": "^8.4.0",
"@types/react": "^16.9.43",
"@typescript-eslint/eslint-plugin": "^3.7.1",
"@typescript-eslint/parser": "^3.7.1",
"autoprefixer": "^6.3.5",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-plugin-istanbul": "^3.0.0",
"babel-plugin-transform-class-properties": "^6.18.0",
"babel-plugin-transform-require-ignore": "0.0.2",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-standalone": "^6.18.2",
"chalk": "^1.1.3",
"codemirror": "^5.20.2",
"css-loader": "^0.28.4",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"eslint": "^7.6.0",
"eslint-config-alloy": "^3.7.4",
"eslint-plugin-react": "^7.20.5",
"extract-text-webpack-plugin": "^3.0.0",
"fastclick": "^1.0.6",
"file-loader": "^6.0.0",
"gh-pages": "^1.0.0",
"github-markdown-css": "^2.4.1",
"highlight.js": "^9.8.0",
"history": "^4.5.1",
"html-webpack-plugin": "^4.3.0",
"ignore-styles": "^5.0.1",
"jsdom": "9.8.3",
"jsdom-global": "2.1.0",
"json-loader": "^0.5.4",
"less": "^2.7.2",
"less-loader": "^4.0.5",
"minimist": "^1.2.0",
"mocha": "^6.2.0",
"nyc": "^9.0.1",
"open-browser-webpack-plugin": "0.0.1",
"postcss-loader": "^2.0.6",
"raw-loader": "^0.5.1",
"react": "^16.9.0",
"react-codemirror": "^0.2.6",
"react-docgen": "^3.0.0",
"react-dom": "^16.9.0",
"react-fontawesome": "^1.3.1",
"react-remarkable": "^1.1.1",
"react-router": "^4.1.1",
"react-router-dom": "^4.1.1",
"react-split-pane": "^0.1.52",
"react-transition-group": "^2.0.2",
"rimraf": "^2.4.3",
"rollup": "^2.23.0",
"rollup-plugin-less": "0.1.3",
"rollup-plugin-progress": "^0.2.1",
"rollup-plugin-replace": "^1.1.1",
"rollup-plugin-terser": "^6.1.0",
"semver": "^6.3.0",
"sinon": "^1.17.2",
"style-loader": "^0.13.0",
"ts-loader": "^8.0.1",
"typescript": "^3.9.7",
"uglify-loader": "^1.2.0",
"url-loader": "^4.1.0",
"webpack": "^4.44.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
},
"peerDependencies": {
"react": ">= 16.0.0",
"react-dom": ">= 16.0.0"
}
"name": "react-weui",
"version": "1.2.3",
"description": "weui for react",
"main": "./build/packages/index.js",
"scripts": {
"start": "webpack-dev-server",
"start:doc": "webpack-dev-server --config webpack.config.doc.js --progress --colors --port 8080",
"build": "node scripts/build.js -p",
"lint": "eslint components --ext .ts,.tsx",
"autofix": "eslint components --ext .ts,.tsx --fix",
"pretest": "npm run lint",
"test": "mocha",
"test:watch": "npm run test -- --watch",
"coverage": "npm run lint & nyc --require @babel/register mocha && nyc report --reporter=lcov",
"postpublish": "gh-pages -d ./build/demo"
},
"repository": {
"type": "git",
"url": "git+https://github.com/weui/react-weui.git"
},
"keywords": [
"mobile",
"ui",
"framework",
"weui",
"react",
"wechat"
],
"author": "wechat ui team",
"license": "MIT",
"bugs": {
"url": "https://github.com/weui/react-weui/issues"
},
"homepage": "https://github.com/weui/react-weui",
"dependencies": {
"prop-types": "^15.7.2",
"weui": "^2.3.0"
},
"devDependencies": {
"@babel/cli": "^7.10.5",
"@babel/core": "^7.10.5",
"@babel/plugin-external-helpers": "^7.10.4",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-transform-runtime": "^7.10.5",
"@babel/polyfill": "^7.10.4",
"@babel/preset-env": "^7.10.4",
"@babel/preset-react": "^7.10.4",
"@babel/register": "^7.10.5",
"@babel/runtime": "^7.10.5",
"@rollup/plugin-babel": "^5.1.0",
"@rollup/plugin-commonjs": "^14.0.0",
"@rollup/plugin-node-resolve": "^8.4.0",
"@types/react": "^16.9.43",
"@typescript-eslint/eslint-plugin": "^3.7.1",
"@typescript-eslint/parser": "^3.7.1",
"autoprefixer": "^6.3.5",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-plugin-istanbul": "^3.0.0",
"babel-plugin-transform-class-properties": "^6.18.0",
"babel-plugin-transform-require-ignore": "0.0.2",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-standalone": "^6.18.2",
"chalk": "^1.1.3",
"codemirror": "^5.20.2",
"css-loader": "^0.28.4",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"eslint": "^7.6.0",
"eslint-config-alloy": "^3.7.4",
"eslint-plugin-react": "^7.20.5",
"extract-text-webpack-plugin": "^3.0.0",
"fastclick": "^1.0.6",
"file-loader": "^6.0.0",
"gh-pages": "^1.0.0",
"github-markdown-css": "^2.4.1",
"highlight.js": "^9.8.0",
"history": "^4.5.1",
"html-webpack-plugin": "^4.3.0",
"husky": ">=4",
"ignore-styles": "^5.0.1",
"jsdom": "9.8.3",
"jsdom-global": "2.1.0",
"json-loader": "^0.5.4",
"less": "^2.7.2",
"less-loader": "^4.0.5",
"lint-staged": ">=10",
"minimist": "^1.2.0",
"mocha": "^6.2.0",
"nyc": "^9.0.1",
"open-browser-webpack-plugin": "0.0.1",
"postcss-loader": "^2.0.6",
"raw-loader": "^0.5.1",
"react": "^16.9.0",
"react-codemirror": "^0.2.6",
"react-docgen": "^3.0.0",
"react-dom": "^16.9.0",
"react-fontawesome": "^1.3.1",
"react-remarkable": "^1.1.1",
"react-router": "^4.1.1",
"react-router-dom": "^4.1.1",
"react-split-pane": "^0.1.52",
"react-transition-group": "^2.0.2",
"rimraf": "^2.4.3",
"rollup": "^2.23.0",
"rollup-plugin-less": "0.1.3",
"rollup-plugin-progress": "^0.2.1",
"rollup-plugin-replace": "^1.1.1",
"rollup-plugin-terser": "^6.1.0",
"semver": "^6.3.0",
"sinon": "^1.17.2",
"style-loader": "^0.13.0",
"ts-loader": "^8.0.1",
"typescript": "^3.9.7",
"uglify-loader": "^1.2.0",
"url-loader": "^4.1.0",
"webpack": "^4.44.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
},
"peerDependencies": {
"react": ">= 16.0.0",
"react-dom": ">= 16.0.0"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{ts,tsx}": [
"eslint --cache --fix",
"prettier --write",
"git add"
]
}
}
Loading