omio - add prettier

This commit is contained in:
dntzhang 2018-12-13 14:39:01 +08:00
parent bb4664c327
commit 9d402d2a30
5 changed files with 70 additions and 45 deletions

0
packages/omio/.editorconfig Executable file → Normal file
View File

1
packages/omio/.eslintignore Executable file → Normal file
View File

@ -1 +1,2 @@
test/ts/
examples/*/b.js

14
packages/omio/.eslintrc Normal file
View File

@ -0,0 +1,14 @@
{
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
"semi": 2,
"indent": ["error", 2]
}
}

View File

@ -1,9 +1,9 @@
module.exports = {
parser: 'babel-eslint',
extends: 'eslint:recommended',
plugins: [
'react'
],
parser: "babel-eslint",
// extends: "eslint:recommended",
// plugins: ["react"],
"extends": ["prettier"],
"plugins": ["prettier"],
env: {
browser: true,
mocha: true,
@ -21,46 +21,46 @@ module.exports = {
expect: true
},
rules: {
'react/jsx-uses-react': 2,
'react/jsx-uses-vars': 2,
'no-unused-vars': [1, { varsIgnorePattern: '^h$' }],
'no-cond-assign': 1,
'no-empty': 0,
'no-console': 1,
semi: 2,
"prettier/prettier": "error",
"no-unused-vars": [1, { varsIgnorePattern: "^h$" }],
"no-cond-assign": 1,
"no-empty": 0,
"no-console": 1,
semi: [1, "never"],
camelcase: 0,
'comma-style': 2,
'comma-dangle': [2, 'never'],
indent: [2, 'tab', {SwitchCase: 1}],
'no-mixed-spaces-and-tabs': [2, 'smart-tabs'],
'no-trailing-spaces': [2, { skipBlankLines: true }],
'max-nested-callbacks': [2, 3],
'no-eval': 2,
'no-implied-eval': 2,
'no-new-func': 2,
'guard-for-in': 0,
"comma-style": 2,
"comma-dangle": [2, "never"],
indent: ["error", 2],
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
"no-trailing-spaces": [2, { skipBlankLines: true }],
"max-nested-callbacks": [2, 3],
"no-eval": 2,
"no-implied-eval": 2,
"no-new-func": 2,
"guard-for-in": 0,
eqeqeq: 0,
'no-else-return': 2,
'no-redeclare': 2,
'no-dupe-keys': 2,
"no-else-return": 2,
"no-redeclare": 2,
"no-dupe-keys": 2,
radix: 2,
strict: [2, 'never'],
'no-shadow': 0,
'callback-return': [1, ['callback', 'cb', 'next', 'done']],
'no-delete-var': 2,
'no-undef-init': 2,
'no-shadow-restricted-names': 2,
'handle-callback-err': 0,
'no-lonely-if': 2,
'keyword-spacing': 2,
'constructor-super': 2,
'no-this-before-super': 2,
'no-dupe-class-members': 2,
'no-const-assign': 2,
'prefer-spread': 2,
'no-useless-concat': 2,
'no-var': 2,
'object-shorthand': 2,
'prefer-arrow-callback': 2
strict: [2, "never"],
"no-shadow": 0,
"callback-return": [1, ["callback", "cb", "next", "done"]],
"no-delete-var": 2,
"no-undef-init": 2,
"no-shadow-restricted-names": 2,
"handle-callback-err": 0,
"no-lonely-if": 2,
"keyword-spacing": 2,
"constructor-super": 2,
"no-this-before-super": 2,
"no-dupe-class-members": 2,
"no-const-assign": 2,
"prefer-spread": 2,
"no-useless-concat": 2,
"no-var": 2,
"object-shorthand": 2,
"prefer-arrow-callback": 2,
"quotes": [1, "single"]
}
};
};

View File

@ -31,6 +31,7 @@
"size": "node -e \"process.stdout.write('gzip size: ')\" && gzip-size --raw dist/omi.min.js",
"test": "npm-run-all lint --parallel test:mocha test:karma test:ts test:flow test:size",
"fix": "eslint src --fix",
"fix-e": "eslint examples --fix",
"test:flow": "flow check",
"test:ts": "tsc -p test/ts/ && mocha --require babel-register test/ts/**/*-test.js",
"test:mocha": "mocha --recursive --require babel-register test/shared test/node",
@ -98,6 +99,8 @@
"cross-env": "^5.1.4",
"diff": "^3.0.0",
"eslint": "^4.18.2",
"eslint-config-prettier": "^3.1.0",
"eslint-plugin-prettier": "^3.0.0",
"eslint-plugin-react": "^7.7.0",
"flow-bin": "^0.67.1",
"gzip-size-cli": "^2.0.0",
@ -118,6 +121,7 @@
"mocha": "^5.0.4",
"npm-run-all": "^4.0.0",
"rimraf": "^2.5.3",
"prettier": "^1.14.3",
"rollup": "^0.57.1",
"rollup-plugin-babel": "^3.0.2",
"rollup-plugin-license": "^0.6.0",
@ -144,5 +148,11 @@
"path": "./dist/omi.min.js",
"threshold": "4Kb"
}
]
],
"prettier": {
"singleQuote": true,
"semi": false,
"tabWidth": 2,
"useTabs": false
}
}