diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 25ede1a..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,71 +0,0 @@ -module.exports = { - "env": { - "browser": true, - "es6": true - }, - "extends": "eslint:recommended", - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parserOptions": { - "ecmaVersion": 2018, - "sourceType": "module" - }, - "rules": { - "no-unexpected-multiline": 2, - "block-scoped-var": 2, - "complexity": [1, 15], - "consistent-return": 2, - "curly": 2, - "default-case": 2, - "dot-location": [2, "property"], - "eqeqeq": [2, "smart"], - "no-alert": 2, - "no-caller": 2, - "no-else-return": 2, - "no-eval": 2, - "no-implied-eval": 2, - "no-extend-native": 2, - "no-extra-bind": 2, - "no-implicit-coercion": 2, - "no-invalid-this": 2, - "no-lone-blocks": 2, - "no-loop-func": 2, - "no-multi-spaces": 2, - "no-native-reassign": 2, - "no-new": 2, - "no-param-reassign": 2, - "no-return-assign": 2, - "no-sequences": 2, - "no-useless-call": 2, - "array-bracket-spacing": [2, "always"], - "brace-style": [2, "1tbs", { "allowSingleLine": true }], - "camelcase": 2, - "comma-style": 2, - "consistent-this": [2, "that"], - "indent": 2, - "jsx-quotes": 2, - "key-spacing": [2, { "beforeColon": false, "afterColon": true }], - "linebreak-style": [2, "unix"], - "max-params": [2, 4], - "no-multiple-empty-lines": [2, { "max": 2 }], - "no-nested-ternary": 2, - "no-spaced-func": 2, - "no-trailing-spaces": 2, - "object-curly-spacing": [2, "always"], - "semi": [2, "always"], - "semi-spacing": 2, - "keyword-spacing": 2, - "space-before-function-paren": [2, "never"], - "space-infix-ops": [2, { "int32Hint": false }], - "arrow-body-style": 2, - "no-confusing-arrow": 2, - "no-class-assign": 2, - "no-const-assign": 2, - "no-dupe-class-members": 2, - "no-this-before-super": 2, - "no-var": 2, - "yoda": [2, "never", { "exceptRange": true }] - } -}; \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..3fc4568 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,19 @@ +import globals from "globals"; + +/** @type {import('eslint').Linter.Config[]} */ +export default [ + { + files: ["*/*.js"], + languageOptions: { + sourceType: "module" + } + }, + { + languageOptions: { + globals: globals.browser + } + }, + { + ignores: ["dist/"] + } +]; diff --git a/lib/deflate.js b/lib/deflate.js index b3b5a19..cbf8de8 100644 --- a/lib/deflate.js +++ b/lib/deflate.js @@ -5,8 +5,6 @@ import { deflateInit2, deflateSetHeader, deflateSetDictionary, deflate as zlibDe import msg from './zlib/messages'; import ZStream from './zlib/zstream'; -/* eslint-disable */ - var toString = Object.prototype.toString; /** diff --git a/lib/inflate.js b/lib/inflate.js index 3912377..ad0c9c6 100644 --- a/lib/inflate.js +++ b/lib/inflate.js @@ -6,8 +6,6 @@ import msg from './zlib/messages'; import ZStream from './zlib/zstream'; import GZheader from './zlib/gzheader'; -/* eslint-disable */ - var toString = Object.prototype.toString; /** diff --git a/lib/utils/common.js b/lib/utils/common.js index 70e6659..e08adc9 100644 --- a/lib/utils/common.js +++ b/lib/utils/common.js @@ -1,5 +1,3 @@ -/* eslint-disable */ - function _has(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } diff --git a/lib/utils/strings.js b/lib/utils/strings.js index f20fe00..24e85ae 100644 --- a/lib/utils/strings.js +++ b/lib/utils/strings.js @@ -1,5 +1,3 @@ -/* eslint-disable */ - // String encode/decode helpers import { Buf8, shrinkBuf } from './common'; diff --git a/lib/zlib/adler32.js b/lib/zlib/adler32.js index f5315f0..d29527b 100644 --- a/lib/zlib/adler32.js +++ b/lib/zlib/adler32.js @@ -1,5 +1,3 @@ -/* eslint-disable */ - // Note: adler32 takes 12% for level 0 and 2% for level 6. // It isn't worth it to make additional optimizations as in original. // Small size is preferable. diff --git a/lib/zlib/constants.js b/lib/zlib/constants.js index e0e5614..c35a0d4 100644 --- a/lib/zlib/constants.js +++ b/lib/zlib/constants.js @@ -1,5 +1,3 @@ -/* eslint-disable */ - // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // diff --git a/lib/zlib/crc32.js b/lib/zlib/crc32.js index c5e9aa3..314ed44 100644 --- a/lib/zlib/crc32.js +++ b/lib/zlib/crc32.js @@ -1,5 +1,3 @@ -/* eslint-disable */ - // Note: we can't get significant speed boost here. // So write code to minimize size - no pregenerated tables // and array tools dependencies. diff --git a/lib/zlib/deflate.js b/lib/zlib/deflate.js index 6099006..0edae2c 100644 --- a/lib/zlib/deflate.js +++ b/lib/zlib/deflate.js @@ -1,5 +1,3 @@ -/* eslint-disable */ - // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // diff --git a/lib/zlib/gzheader.js b/lib/zlib/gzheader.js index 6dd8b8c..c36dd3b 100644 --- a/lib/zlib/gzheader.js +++ b/lib/zlib/gzheader.js @@ -1,5 +1,3 @@ -/* eslint-disable */ - // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // diff --git a/lib/zlib/inffast.js b/lib/zlib/inffast.js index 6c355dc..f3ad1a2 100644 --- a/lib/zlib/inffast.js +++ b/lib/zlib/inffast.js @@ -1,5 +1,3 @@ -/* eslint-disable */ - // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // diff --git a/lib/zlib/inflate.js b/lib/zlib/inflate.js index c662d16..ffbe9da 100644 --- a/lib/zlib/inflate.js +++ b/lib/zlib/inflate.js @@ -1,5 +1,3 @@ -/* eslint-disable */ - // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // diff --git a/lib/zlib/inftrees.js b/lib/zlib/inftrees.js index 8d1704e..c430f17 100644 --- a/lib/zlib/inftrees.js +++ b/lib/zlib/inftrees.js @@ -1,5 +1,3 @@ -/* eslint-disable */ - // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // diff --git a/lib/zlib/messages.js b/lib/zlib/messages.js index 4fa9e86..4f8b483 100644 --- a/lib/zlib/messages.js +++ b/lib/zlib/messages.js @@ -1,5 +1,3 @@ -/* eslint-disable */ - // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // diff --git a/lib/zlib/trees.js b/lib/zlib/trees.js index ba04b95..ac341c4 100644 --- a/lib/zlib/trees.js +++ b/lib/zlib/trees.js @@ -1,5 +1,3 @@ -/* eslint-disable */ - // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // @@ -19,8 +17,6 @@ // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. -/* eslint-disable space-unary-ops */ - import { Z_FIXED, Z_BINARY, Z_TEXT, Z_UNKNOWN } from './constants'; import { arraySet } from '../utils/common'; @@ -86,7 +82,6 @@ var REPZ_3_10 = 17; var REPZ_11_138 = 18; /* repeat a zero length 11-138 times (7 bits of repeat count) */ -/* eslint-disable comma-spacing,array-bracket-spacing */ var extra_lbits = /* extra bits for each length code */ [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; @@ -98,7 +93,6 @@ var extra_blbits = /* extra bits for each bit length code */ var bl_order = [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; -/* eslint-enable comma-spacing,array-bracket-spacing */ /* The lengths of the bit length codes are sent in order of decreasing * probability, to avoid transmitting the lengths for unused bit length codes. diff --git a/lib/zlib/zstream.js b/lib/zlib/zstream.js index d2f5f3b..fb672a2 100644 --- a/lib/zlib/zstream.js +++ b/lib/zlib/zstream.js @@ -1,5 +1,3 @@ -/* eslint-disable */ - // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // diff --git a/package.json b/package.json index 2a48d49..a87e818 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "scripts": { "build-package": "rollup -c", "test": "mocha", - "lint": "eslint lib", + "lint": "eslint", "prepare": "husky" }, "keywords": [ @@ -35,7 +35,8 @@ "@commitlint/cli": "^19.6.1", "@commitlint/config-conventional": "^19.6.0", "@rollup/plugin-buble": "^0.21.1", - "eslint": "^6.8.0", + "eslint": "^9.17.0", + "globals": "^15.14.0", "husky": "^9.1.7", "mocha": "^7.1.1", "reify": "^0.20.12",