add eslint prettier

This commit is contained in:
zhichen 2018-11-14 19:38:13 +08:00
parent 746035c11a
commit 48ceb4032f
8 changed files with 125 additions and 29 deletions

View File

@ -0,0 +1,16 @@
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab

View File

@ -0,0 +1,2 @@
node_modules
build

View File

@ -0,0 +1,33 @@
{
"extends": "eslint-config-ali/react",
"parser": "babel-eslint",
"env": {},
"globals": {
"window": true
},
"rules": {
"no-shadow": "off",
"no-empty": "off",
"no-useless-escape": "off",
"no-template-curly-in-string": "off",
"no-unused-vars": "off",
"no-tabs": "off",
"react/no-string-refs": "off",
"react/no-unused-state": "off",
"no-return-assign": "off",
"no-plusplus": "off",
"no-script-url": "off",
"no-mixed-operators": "off",
"react/jsx-indent": "off",
"react/jsx-no-bind": "off",
"react/forbid-prop-types": "off",
"react/no-array-index-key": "off",
"react/sort-comp": "off",
"implicit-arrow-linebreak": "off",
"prefer-const": "off",
"space-before-function-paren": "off",
"wrap-iife": "off",
"arrow-parens": "off",
"indent": "off"
}
}

View File

@ -0,0 +1,3 @@
*.svg
*.ejs
.DS_Store

View File

@ -0,0 +1,9 @@
{
"tabWidth": 2,
"printWidth": 100,
"semi": true,
"useTabs": false,
"bracketSpacing": true,
"singleQuote": true,
"trailingComma": "es5"
}

View File

@ -18,7 +18,6 @@
"editor.formatOnPaste": false "editor.formatOnPaste": false
}, },
"[html]": { "[html]": {
"editor.formatOnSave": true "editor.formatOnSave": false
} }
} }

View File

@ -1,10 +1,22 @@
{ {
"private": true, "private": true,
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": [
"eslint --fix",
"git add"
]
},
"scripts": { "scripts": {
"start": "roadhog dev", "start": "roadhog dev",
"build": "node build.js", "build": "node build.js",
"dist": "roadhog build", "dist": "roadhog build",
"lint": "eslint --ext .js src test" "eslint": "eslint --ext .js src/",
"eslint-fix": "eslint --ext .js --fix src/"
}, },
"dependencies": { "dependencies": {
"@alifd/next": "^1.7.6", "@alifd/next": "^1.7.6",
@ -17,17 +29,18 @@
}, },
"devDependencies": { "devDependencies": {
"babel-core": "^6.26.3", "babel-core": "^6.26.3",
"babel-eslint": "^10.0.1",
"babel-plugin-dva-hmr": "^0.3.2", "babel-plugin-dva-hmr": "^0.3.2",
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-preset-es2015": "^6.24.1", "babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1", "babel-preset-react": "^6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-preset-stage-2": "^6.24.1", "babel-preset-stage-2": "^6.24.1",
"eslint": "^4.14.0", "eslint": "^5.9.0",
"eslint-config-umi": "^0.1.1", "eslint-config-ali": "^4.0.0",
"eslint-plugin-flowtype": "^2.34.1", "eslint-config-prettier": "^3.3.0",
"eslint-plugin-import": "^2.6.0", "eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^5.1.1", "eslint-plugin-prettier": "^3.0.0",
"eslint-plugin-react": "^7.1.0", "eslint-plugin-react": "^7.11.1",
"husky": "^0.12.0", "husky": "^0.12.0",
"roadhog": "^2.0.0" "roadhog": "^2.0.0"
} }

View File

@ -0,0 +1,21 @@
{
"compilerOptions": {
"strictNullChecks": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"jsx": "preserve",
"noUnusedParameters": true,
"noUnusedLocals": true,
"noImplicitAny": true,
"target": "es6",
"lib": [
"dom",
"es7"
]
},
"exclude": [
"node_modules",
"lib",
"es"
]
}