diff --git a/packages/omio/.editorconfig b/packages/omio/.editorconfig old mode 100755 new mode 100644 diff --git a/packages/omio/.eslintignore b/packages/omio/.eslintignore old mode 100755 new mode 100644 index feb23905f..bd54edf89 --- a/packages/omio/.eslintignore +++ b/packages/omio/.eslintignore @@ -1 +1,2 @@ test/ts/ +examples/*/b.js diff --git a/packages/omio/.eslintrc b/packages/omio/.eslintrc new file mode 100644 index 000000000..0d940c3e0 --- /dev/null +++ b/packages/omio/.eslintrc @@ -0,0 +1,14 @@ +{ + "parser": "babel-eslint", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module", + "ecmaFeatures": { + "jsx": true + } + }, + "rules": { + "semi": 2, + "indent": ["error", 2] + } +} diff --git a/packages/omio/config/eslint-config.js b/packages/omio/config/eslint-config.js index 95ac48965..0f5685715 100755 --- a/packages/omio/config/eslint-config.js +++ b/packages/omio/config/eslint-config.js @@ -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"] } -}; +}; \ No newline at end of file diff --git a/packages/omio/package.json b/packages/omio/package.json index f2542b1c9..535cb6534 100755 --- a/packages/omio/package.json +++ b/packages/omio/package.json @@ -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 + } }