diff --git a/.eslintrc.js b/.eslintrc.js index ba6c95d8..0fe1bff7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,102 +1,100 @@ module.exports = { - "env": { - "commonjs": true, - "es6": true, - "node": true - }, - "extends": "airbnb-base", - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parserOptions": { - "ecmaVersion": 2018 - }, - "rules": { - "camelcase": "off", - // "class-methods-use-this": "off", - "comma-dangle": ["error", { - "functions": "ignore", - "arrays": "always-multiline", - "objects": "always-multiline", - "imports": "always-multiline", - "exports": "always-multiline", - }], - // "consistent-return": "off", - // "dot-notation": "off", - "func-names": "off", - "global-require": "off", - // "guard-for-in": "off", - // "import/newline-after-import": "off", - "import/no-dynamic-require": "off", - // "import/order": "off", - "max-len": [ - "warn", - { - "code": 120, - "ignoreComments": false, - "ignoreRegExpLiterals": true, - "ignoreStrings": true, - "ignoreTemplateLiterals": true, - "ignoreTrailingComments": false, - "ignoreUrls": true, - "tabWidth": 2 - } - ], - // "new-cap": "off", - "newline-per-chained-call": "off", - // "no-bitwise": "off", - // "no-buffer-constructor": "off", - // "no-cond-assign": "off", - // "no-confusing-arrow": "off", - "no-console": "off", - // "no-dupe-keys": "off", - // "no-else-return": "off", - // "no-empty": "off", - // "no-empty-function": "off", - // "no-lonely-if": "off", - // "no-loop-func": "off", - // "no-mixed-operators": "off", - // "no-multi-assign": "off", - "no-param-reassign": "off", - "no-plusplus": "off", - "no-prototype-builtins": "off", - // "no-restricted-syntax": "off", - // "no-return-assign": "off", - // "no-shadow": "off", - "no-throw-literal": "off", - // "no-unreachable": "off", - "no-unused-vars": ["error", { - "args": "none", - "caughtErrors": "none" - }], - "no-trailing-spaces": ['error',{ - "skipBlankLines" : true - }], - "no-use-before-define": "off", - "no-useless-concat": "off", - "no-useless-constructor": "off", - "no-useless-escape": "off", - "no-var": "off", - "no-void": "off", - "object-curly-newline": [ - "error", - { - "consistent": true - } - ], - "object-shorthand": "off", - "one-var": "off", - "one-var-declaration-per-line": "off", - "operator-assignment": "off", - "prefer-arrow-callback": "off", - "prefer-const": "off", - "prefer-destructuring": "off", - "prefer-template": "off", - "quote-props": "off", - "quotes": "off", - "radix": "off", - "vars-on-top": "off", - "wrap-iife": "off" - } -} + "env": { + "browser": true, + "commonjs": true, + "es6": true + }, + "extends": "airbnb-base", + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parserOptions": { + "ecmaVersion": 2018 + }, + "rules": { + "arrow-body-style": "off", + "arrow-spacing": "off", + "arrow-parens": "off", + "camelcase": "off", + "class-methods-use-this": "off", + "comma-dangle": "off", + "comma-spacing": "off", + "consistent-return": "off", + "dot-notation": "off", + "function-paren-newline": "off", + "func-names": "off", + "global-require": "off", + "guard-for-in": "off", + "indent": "off", + "import/no-extraneous-dependencies": "off", + "import/no-unresolved": "off", + "import/newline-after-import": "off", + "import/no-dynamic-require": "off", + "import/order": "off", + "max-len": "off", + "new-cap": "off", + "newline-per-chained-call": "off", + "no-unused-expressions": "off", + "no-useless-catch": "off", + "no-underscore-dangle": "off", + "no-bitwise": "off", + "no-buffer-constructor": "off", + "no-cond-assign": "off", + "no-confusing-arrow": "off", + "no-console": "off", + "no-dupe-keys": "off", + "no-else-return": "off", + "no-empty": "off", + "no-empty-function": "off", + "no-lonely-if": "off", + "no-loop-func": "off", + "no-mixed-operators": "off", + "no-multi-assign": "off", + "no-param-reassign": "off", + "no-plusplus": "off", + "no-prototype-builtins": "off", + "no-restricted-syntax": "off", + "no-return-assign": "off", + "no-shadow": "off", + "no-throw-literal": "off", + "no-unreachable": "off", + "no-unused-vars": "off", + "no-trailing-spaces": ['error',{ + "skipBlankLines" : true + }], + "no-multiple-empty-lines": "off", + "no-use-before-define": "off", + "no-useless-concat": "off", + "no-useless-constructor": "off", + "no-useless-escape": "off", + "no-var": "off", + "no-void": "off", + "object-curly-spacing": "off", + "object-curly-newline": [ + "error", + { + "consistent": true + } + ], + "object-shorthand": "off", + "one-var": "off", + "one-var-declaration-per-line": "off", + "operator-linebreak": "off", + "operator-assignment": "off", + "prefer-object-spread": "off", + "prefer-arrow-callback": "off", + "prefer-const": "off", + "prefer-destructuring": "off", + "prefer-template": "off", + "quote-props": "off", + "quotes": "off", + "radix": "off", + "semi": "off", + "space-before-function-paren": 'off', + "space-before-blocks": "off", + "space-infix-ops": "off", + "vars-on-top": "off", + "wrap-iife": "off" + } +}; diff --git a/package.json b/package.json index 7ffdb4f2..acbcfb6a 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,9 @@ "babel-runtime": "^6.26.0", "dotenv": "4.x", "dtslint": "^0.9.1", - "eslint": "^5.16.0", - "eslint-config-airbnb-base": "^13.1.0", - "eslint-plugin-import": "^2.17.2", + "eslint": "^6.8.0", + "eslint-config-airbnb-base": "^14.1.0", + "eslint-plugin-import": "^2.20.2", "expect.js": "0.3.x", "glob": "^7.1.6", "jsdoc": "^3.5.5", @@ -56,7 +56,7 @@ "test": "tools/scripts/test.sh", "test-with-temp-cloud": "tools/scripts/tests-with-temp-cloud.sh", "dtslint": "tools/scripts/ditslint.sh", - "lint": "eslint .", + "lint": "tools/scripts/lint.sh", "compile": "tools/scripts/compile.sh", "coverage": "tools/scripts/test.es6.sh --coverage", "test-es6": "tools/scripts/test.es6.sh", diff --git a/tools/scripts/compile.sh b/tools/scripts/compile.sh index 984af0fa..d43f1c65 100755 --- a/tools/scripts/compile.sh +++ b/tools/scripts/compile.sh @@ -1,3 +1,4 @@ #!/bin/bash rimraf ./lib-es5 babel lib --out-dir lib-es5 --verbose +npm run lint diff --git a/tools/scripts/lint.sh b/tools/scripts/lint.sh new file mode 100755 index 00000000..25cd03de --- /dev/null +++ b/tools/scripts/lint.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e; + +node_v=$(node --version) ; +if [[ "${node_v%%.*}" == 'v4' || "${node_v%%.*}" == 'v6' ]] +then + echo 'Old node version - Skipping eslint' +else + eslint . +fi + diff --git a/tools/scripts/test.es6.sh b/tools/scripts/test.es6.sh index d0a3c2d3..c6d2dba8 100755 --- a/tools/scripts/test.es6.sh +++ b/tools/scripts/test.es6.sh @@ -18,4 +18,3 @@ else echo 'Running tests on ES6 Code' mocha --ui bdd -R spec --recursive test/ fi - diff --git a/tools/scripts/test.sh b/tools/scripts/test.sh index 9160602a..53449397 100755 --- a/tools/scripts/test.sh +++ b/tools/scripts/test.sh @@ -2,7 +2,7 @@ set -e; node_v=$(node --version) ; - +npm run lint if [[ "${node_v%%.*}" == 'v4' || "${node_v%%.*}" == 'v6' ]] then npm run test-es5 @@ -10,3 +10,4 @@ else npm run test-es6 fi npm run dtslint +