diff --git a/detox/.eslintrc b/detox/.eslintrc index e4562bae3c..58f7e76605 100644 --- a/detox/.eslintrc +++ b/detox/.eslintrc @@ -1,404 +1,12 @@ { - "env": { - "es6": true, - "node": true - }, + "plugins": ["node"], + "extends": ["plugin:node/recommended"], "parserOptions": { - "ecmaVersion": 8, - "sourceType": "module", - "ecmaFeatures": { - "impliedStrict": true, - "jsx": true, - "experimentalObjectRestSpread": true - } + "ecmaVersion": 2018, + "sourceType": "module" }, - "plugins": [ - "react", - "react-native", - "promise", - "prettier", - "jest" - ], - "extends": [ - "prettier", - "prettier/react" - ], "rules": { - /* - * possible errors - */ - "comma-dangle": "error", - "no-cond-assign": [ - "error", - "except-parens" - ], - "no-console": "warn", - "no-constant-condition": "error", - "no-control-regex": "error", - "no-debugger": "warn", - "no-dupe-args": "error", - "no-dupe-keys": "error", - "no-duplicate-case": "error", - "no-empty": "error", - "no-empty-character-class": "error", - "no-ex-assign": "error", - "no-extra-boolean-cast": "error", - "no-extra-parens": 0, - "no-extra-semi": "error", - "no-func-assign": "error", - "no-inner-declarations": "error", - "no-invalid-regexp": "error", - "no-irregular-whitespace": "error", - "no-negated-in-lhs": "error", - "no-obj-calls": "error", - "no-regex-spaces": "error", - "no-sparse-arrays": "error", - "no-unexpected-multiline": "error", - "no-unreachable": "error", - "use-isnan": "error", - "valid-jsdoc": 0, - "valid-typeof": "error", - /* - * best practices - */ - "accessor-pairs": "warn", - "array-callback-return": 0, - "block-scoped-var": "error", - "complexity": 0, - "consistent-return": "error", - "curly": [ - "error", - "all" - ], - "default-case": "error", - "dot-location": [ - "error", - "property" - ], - "dot-notation": "error", - "eqeqeq": "error", - "guard-for-in": "error", - "no-alert": "error", - "no-caller": "error", - "no-case-declarations": "error", - "no-div-regex": 0, - "no-else-return": 0, - "no-empty-function": "error", - "no-empty-pattern": "error", - "no-eq-null": "error", - "no-eval": "error", - "no-extend-native": "error", - "no-extra-bind": "error", - "no-extra-label": "error", - "no-fallthrough": "error", - "no-floating-decimal": "error", - "no-implicit-coercion": "error", - "no-implicit-globals": 0, - "no-implied-eval": "error", - "no-invalid-this": 0, - "no-iterator": "error", - "no-labels": "error", - "no-lone-blocks": "error", - "no-loop-func": "error", - "no-magic-numbers": 0, - "no-multi-spaces": "error", - "no-multi-str": 0, - "no-native-reassign": "error", - "no-new": "error", - "no-new-func": "error", - "no-new-wrappers": "error", - "no-octal": "error", - "no-octal-escape": "error", - "no-param-reassign": "error", - "no-proto": "error", - "no-redeclare": 0, - "no-return-assign": 0, - "no-script-url": "error", - "no-self-assign": "error", - "no-self-compare": "error", - "no-sequences": "error", - "no-throw-literal": "error", - "no-unmodified-loop-condition": 0, - "no-unused-expressions": "error", - "no-unused-labels": 0, - "no-useless-call": "error", - "no-useless-concat": "error", - "no-void": "error", - "no-warning-comments": 0, - "no-with": "error", - "radix": 0, - "vars-on-top": 0, - "wrap-iife": "error", - "yoda": 0, - "strict": [ - "error", - "never" - ], - /* - * variables - */ - "init-declarations": 0, - "no-catch-shadow": "error", - "no-delete-var": "error", - "no-label-var": "error", - "no-restricted-globals": "error", - "no-shadow": "error", - "no-shadow-restricted-names": "error", - "no-undef": 0, - "no-undef-init": "error", - "no-undefined": 0, - "no-unused-vars": 0, - "no-use-before-define": 0, - /* - * Node.js - */ - "callback-return": 0, - "global-require": 0, - "handle-callback-err": 0, - "no-mixed-requires": "error", - "no-new-require": "error", - "no-path-concat": "error", - "no-process-env": 0, - "no-process-exit": "error", - "no-restricted-modules": 0, - "no-sync": 0, - /* - * style - */ - "array-bracket-spacing": [ - "error", - "never" - ], - "block-spacing": "error", - "brace-style": [ - "error", - "1tbs" - ], - "camelcase": [ - "error", - { - "properties": "never" - } - ], - "comma-spacing": [ - "error", - { - "before": false, - "after": true - } - ], - "comma-style": [ - "error", - "last" - ], - "computed-property-spacing": [ - "error", - "never" - ], - "consistent-this": [ - "error", - "self" - ], - "eol-last": [ - "error", - "unix" - ], - "func-names": 0, - "func-style": 0, - "id-blacklist": 0, - "id-length": 0, - "id-match": 0, - "jsx-quotes": "error", - "key-spacing": [ - "error", - { - "singleLine": { - "beforeColon": false, - "afterColon": true, - "mode": "strict" - }, - "multiLine": { - "beforeColon": false, - "afterColon": true, - "mode": "strict" - } - } - ], - "keyword-spacing": [ - "error", - { - "before": true, - "after": true - } - ], - "linebreak-style": [ - "error", - "unix" - ], - "lines-around-comment": 0, - "max-depth": [ - "error", - 4 - ], - "max-len": [ - "warn", - 150 - ], - "max-nested-callbacks": [ - "error", - 4 - ], - "max-params": [ - "error", - 6 - ], - "max-statements": [ - "warn", - 15, - { - "ignoreTopLevelFunctions": true - } - ], - "new-parens": "error", - "newline-after-var": 0, - "newline-before-return": 0, - "newline-per-chained-call": 0, - "no-array-constructor": "error", - "no-bitwise": 0, - "no-continue": 0, - "no-inline-comments": 0, - "no-lonely-if": "error", - "no-mixed-spaces-and-tabs": 0, - "no-multiple-empty-lines": [ - "error", - { - "max": 1 - } - ], - "no-negated-condition": 0, - "no-nested-ternary": "error", - "no-new-object": "error", - "no-plusplus": 0, - "no-restricted-syntax": 0, - "no-spaced-func": "error", - "no-ternary": 0, - "no-trailing-spaces": [ - "error", - { - "skipBlankLines": true - } - ], - "no-underscore-dangle": 0, - "no-unneeded-ternary": "error", - "no-whitespace-before-property": "error", - "one-var": 0, - "one-var-declaration-per-line": 0, - "operator-assignment": 0, - "padded-blocks": [ - "error", - "never" - ], - "quote-props": [ - "warn", - "consistent-as-needed" - ], - "quotes": 0, - "require-jsdoc": 0, - "semi": [ - "error", - "always" - ], - "semi-spacing": [ - "error", - { - "before": false, - "after": true - } - ], - "sort-imports": 0, - "sort-vars": 0, - "space-before-blocks": [ - "warn", - "always" - ], - "space-before-function-paren": ["error", { - "anonymous": "never", - "named": "never", - "asyncArrow": "always" - }], - "space-in-parens": [ - "error", - "never" - ], - "space-infix-ops": "error", - "space-unary-ops": "error", - "spaced-comment": 0, - "wrap-regex": "error", - /* - * ECMAScript 6 - */ - "arrow-body-style": 0, - "arrow-spacing": [ - "error", - { - "before": true, - "after": true - } - ], - "constructor-super": "error", - "generator-star-spacing": [ - "error", - "after" - ], - "no-class-assign": "error", - "no-confusing-arrow": "error", - "no-const-assign": "error", - "no-dupe-class-members": "error", - "no-new-symbol": "error", - "no-restricted-imports": 0, - "no-this-before-super": "error", - "no-useless-constructor": 0, - "no-var": "error", - "object-shorthand": 0, - "prefer-arrow-callback": 0, - "prefer-const": "error", - "prefer-reflect": 0, - "prefer-rest-params": "error", - "prefer-spread": "error", - "prefer-template": 0, - "require-yield": 0, - "template-curly-spacing": [ - "error", - "never" - ], - "yield-star-spacing": [ - "error", - "after" - ], - /* - * babel plugin - */ - "babel/object-shorthand": 0, - "babel/no-await-in-loop": 0, - /* - * prettier plugin - */ - "prettier/prettier": [ - "error", { - "useTabs": true - } - ], - /* - * promise - */ - "promise/always-return": "off", - "promise/no-return-wrap": "error", - "promise/param-names": "error", - "promise/catch-or-return": "off", - "promise/no-native": "off", - "promise/no-nesting": "error", - "promise/no-promise-in-callback": "error", - "promise/no-callback-in-promise": "off", - "promise/avoid-new": "off" + "no-mixed-spaces-and-tabs": "error", + "node/no-unpublished-require": "warn" } } diff --git a/detox/.nvmrc b/detox/.nvmrc index 9c51f30944..45a4fb75db 100644 --- a/detox/.nvmrc +++ b/detox/.nvmrc @@ -1 +1 @@ -7.10.0 \ No newline at end of file +8 diff --git a/detox/package.json b/detox/package.json index a89a197e80..593a377f3b 100644 --- a/detox/package.json +++ b/detox/package.json @@ -24,6 +24,7 @@ "build": "scripts/build.sh", "lint": "eslint src", "unit": "jest --coverage --verbose", + "pretest": "npm run lint", "test": "npm run unit", "unit:watch": "jest --watch", "prepublish": "npm run build", @@ -31,14 +32,8 @@ }, "devDependencies": { "eslint": "^4.11.0", - "eslint-config-prettier": "2.5.0", - "eslint-plugin-jest": "^20.0.3", - "eslint-plugin-prettier": "2.2.0", - "eslint-plugin-promise": "^3.4.2", - "eslint-plugin-react": "^7.1.0", - "eslint-plugin-react-native": "^3.1.0", + "eslint-plugin-node": "^6.0.1", "jest": "22.x.x", - "minimist": "^1.2.0", "mockdate": "^2.0.1", "prettier": "1.7.0" }, @@ -50,6 +45,7 @@ "get-port": "^2.1.0", "ini": "^1.3.4", "lodash": "^4.14.1", + "minimist": "^1.2.0", "npmlog": "^4.0.2", "shell-utils": "^1.0.9", "tail": "^1.2.3", @@ -57,7 +53,7 @@ "ws": "^1.1.1" }, "engines": { - "node": ">=7.6" + "node": ">=8.3.0" }, "jest": { "roots": [ diff --git a/detox/src/devices/Device.js b/detox/src/devices/Device.js index 76c99b16de..84528a3aec 100644 --- a/detox/src/devices/Device.js +++ b/detox/src/devices/Device.js @@ -88,7 +88,7 @@ class Device { const _bundleId = bundleId || this._bundleId; if (this._isAppInBackground(params, _bundleId)) { if (hasPayload) { - await this.deviceDriver.deliverPayload({...params, delayPayload: true}); + await this.deviceDriver.deliverPayload({...params, delayPayload: true}); } } diff --git a/docs/Guide.Contributing.md b/docs/Guide.Contributing.md index 80db052f6a..4c02696b9c 100644 --- a/docs/Guide.Contributing.md +++ b/docs/Guide.Contributing.md @@ -5,7 +5,7 @@ title: Contributing ## Prerequisites -### Install `node` v7.6 or higher (to support async-await natively) +### Install `node` v8.3.0 or higher ``` brew install node diff --git a/docs/Introduction.GettingStarted.md b/docs/Introduction.GettingStarted.md index 0c48adaf99..a5c631c06f 100644 --- a/docs/Introduction.GettingStarted.md +++ b/docs/Introduction.GettingStarted.md @@ -32,13 +32,13 @@ Homebrew is a package manager for macOS, we'll need it to install other command #### 2. Install [Node.js](https://nodejs.org/en/) -Node is the JavaScript runtime Detox will run on. **Install Node 7.6.0 or above for native async-await support** +Node is the JavaScript runtime Detox will run on. **Install Node 8.3.0 or above** ```sh brew update && brew install node ``` -> TIP: Verify it works by typing in terminal `node -v` to output current node version, should be higher than 7.6.0 +> TIP: Verify it works by typing in terminal `node -v` to output current node version, should be 8.3.0 or higher #### 3. Install [appleSimUtils](https://github.com/wix/AppleSimulatorUtils) diff --git a/docs/Troubleshooting.RunningTests.md b/docs/Troubleshooting.RunningTests.md index 707db30ae7..51e7dfd379 100644 --- a/docs/Troubleshooting.RunningTests.md +++ b/docs/Troubleshooting.RunningTests.md @@ -63,9 +63,9 @@ child_process.js:531 throw err; ``` -**Solution:** This error means that your version of Node does not support `async-await` syntax. You should do one of the two: +**Solution:** This error means that your version of Node does not support `async-await` syntax. You should do the following: -1. Update Node to a version **higher than 7.6.0**, these versions will provide native support for async-await. +1. Update Node to a version **8.3.0 or higher**.
diff --git a/examples/demo-native-ios/README.md b/examples/demo-native-ios/README.md index 8084188a51..0b434d4141 100644 --- a/examples/demo-native-ios/README.md +++ b/examples/demo-native-ios/README.md @@ -6,7 +6,7 @@ * make sure you have Xcode installed (tested with v8.1-8.2) * iPhone 7 Plus simulator is installed -* make sure you have node installed (`brew install node`, node 7.6.0 and up is prefered, for native async-await support) +* make sure you have node installed (`brew install node`, node 8.3.0 and up is prefered, for native async-await support) ### Step 1: Npm install * Make sure you're in folder `examples/demo-native-ios` @@ -25,4 +25,4 @@ ```sh detox test --configuration ios.sim.release ``` - This action will open a new simulator and run the tests on it. \ No newline at end of file + This action will open a new simulator and run the tests on it. diff --git a/examples/demo-react-native/README.md b/examples/demo-react-native/README.md index 77e2767407..1c0b47188e 100644 --- a/examples/demo-react-native/README.md +++ b/examples/demo-react-native/README.md @@ -5,7 +5,7 @@ ## Requirements * Make sure you have Xcode installed (tested with Xcode 8.1-8.2). -* make sure you have node installed (`brew install node`, node 7.6.0 and up is required for native async-await support, otherwise you'll have to babel the tests). +* make sure you have node installed (`brew install node`, node 8.3.0 and up is required for native async-await support, otherwise you'll have to babel the tests). * Make sure you have react-native dependencies installed: * react-native-cli is installed (`npm install -g react-native-cli`) * watchman is installed (`brew install watchman`)