diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 1521c8b7..00000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -dist diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index b8d65b77..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "env": { - "browser": true, - "es2021": true - }, - "extends": ["eslint:recommended", "prettier"], - "overrides": [], - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module" - }, - "rules": {} -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..74ae6127 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,30 @@ +import globals from 'globals' +import js from '@eslint/js' + +const languageOptions = { + globals: { + ...globals.browser + } +} +export default [ + { + ignores: ['dist/*'] + }, + { + ...js.configs.recommended, + files: ['**/*.js'], + ignores: ['examples/**/src/*.js'], + languageOptions: { + ...languageOptions, + sourceType: 'commonjs' + } + }, + { + ...js.configs.recommended, + files: ['**/*.mjs'], + languageOptions: { + ...languageOptions, + ecmaVersion: 2021 + } + } +] diff --git a/package.json b/package.json index 2ad0ceb9..b8e36740 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,8 @@ "test": "grunt test", "format": "prettier --write .", "format:check": "prettier --check .", - "lint": "eslint --ext .js,.mjs --fix .", - "lint:check": "eslint --ext .js,.mjs .", + "lint": "eslint --fix .", + "lint:check": "eslint .", "dist": "rm -rf dist/* && rollup -c", "release": "release-it" }, @@ -48,7 +48,7 @@ "devDependencies": { "@rollup/plugin-terser": "^0.4.4", "browserstack-runner": "github:browserstack/browserstack-runner#1e85e559951bdf97ffe2a7c744ee67ca83589fde", - "eslint": "^8.43.0", + "eslint": "^9.0.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-html": "^8.0.0", "eslint-plugin-markdown": "^4.0.1", diff --git a/src/api.mjs b/src/api.mjs index 3af8cb11..94de05b2 100644 --- a/src/api.mjs +++ b/src/api.mjs @@ -65,7 +65,7 @@ function init(converter, defaultAttributes) { if (name === found) { break } - } catch (e) { + } catch { // Do nothing... } } diff --git a/test/tests.js b/test/tests.js index 4b29b67d..ca1df370 100644 --- a/test/tests.js +++ b/test/tests.js @@ -251,7 +251,6 @@ QUnit.test('String primitive', function (assert) { }) QUnit.test('String object', function (assert) { - // eslint-disable-next-line no-new-wrappers Cookies.set('c', new String('v')) assert.strictEqual(Cookies.get('c'), 'v', 'should write value') }) diff --git a/test/utils.js b/test/utils.js index dcdbab76..14d6df30 100644 --- a/test/utils.js +++ b/test/utils.js @@ -53,7 +53,7 @@ ) callback(result.value, iframeDocument.cookie) done() - } catch (e) { + } catch { // Do nothing... } })