From a378b4c88f0dae55f462b763c917e5dcdcf50ca4 Mon Sep 17 00:00:00 2001 From: Mathew Heard Date: Thu, 28 Oct 2021 07:59:38 +1100 Subject: [PATCH] add eslint --- .eslintrc.yml | 8 ++++++++ .github/workflows/eslint.yml | 13 +++++++++++++ index.js | 5 +++-- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 .eslintrc.yml create mode 100644 .github/workflows/eslint.yml diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 0000000..d5bf7f3 --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,8 @@ +env: + node: true + es2021: true +extends: 'eslint:recommended' +parserOptions: + ecmaVersion: 12 + sourceType: module +rules: {} diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml new file mode 100644 index 0000000..b03305d --- /dev/null +++ b/.github/workflows/eslint.yml @@ -0,0 +1,13 @@ +name: Eslint +on: + push: + +jobs: + check_eslint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install modules + run: | + sudo npm install -g eslint + - run: eslint index.js --ext .js,.jsx,.ts,.tsx \ No newline at end of file diff --git a/index.js b/index.js index 557c902..2df7f31 100644 --- a/index.js +++ b/index.js @@ -237,12 +237,13 @@ Q.resolve = value=>QPromise.resolve(value) const Util = process.binding('util') +let _promiseState if(Util.getPromiseDetails){ - function _promiseState(promise){ + _promiseState = function(promise){ return Util.getPromiseDetails(promise)[0] } } else{ - function _promiseState(promise){ + _promiseState = function(promise){ const p = util.inspect(promise) if(p.includes('{ ')){ return 2