From cf62d0f1e6132e4843c518e34017126d208ca413 Mon Sep 17 00:00:00 2001 From: Elijah Okello Date: Tue, 13 Feb 2024 09:27:10 +0300 Subject: [PATCH 1/4] fix: fix for precommit errors --- .pre-commit-config.yaml | 6 ++++-- .eslintrc.js => eslint.config.js | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) rename .eslintrc.js => eslint.config.js (96%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 23d879f71..46e127eeb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: hooks: - id: doc8 - repo: https://github.com/adamchainz/django-upgrade - rev: 1.15.0 + rev: 1.16.0 hooks: - id: django-upgrade args: [--target-version, "3.2"] @@ -32,9 +32,11 @@ repos: args: - --trailing-comma=es5 - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.56.0 + rev: 'v9.0.0-beta.0' hooks: - id: eslint + additional_dependencies: + - eslint@9.0.0-beta.0 files: \.js?$ types: [file] args: diff --git a/.eslintrc.js b/eslint.config.js similarity index 96% rename from .eslintrc.js rename to eslint.config.js index b0c799d88..9033a1882 100644 --- a/.eslintrc.js +++ b/eslint.config.js @@ -1,5 +1,4 @@ module.exports = { - root: true, "env": { "browser": true, "es6": true, From 110431d7b26f3345d8240459f9160e5d54ac813b Mon Sep 17 00:00:00 2001 From: Elijah Okello Date: Tue, 13 Feb 2024 11:30:30 +0300 Subject: [PATCH 2/4] fix: migrated .eslintrc.js to eslint.config.js flat config --- .pre-commit-config.yaml | 4 +--- eslint.config.js | 36 +++++++++++++++++------------------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 46e127eeb..3ddbce30f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,11 +32,9 @@ repos: args: - --trailing-comma=es5 - repo: https://github.com/pre-commit/mirrors-eslint - rev: 'v9.0.0-beta.0' + rev: v9.0.0-beta.0 hooks: - id: eslint - additional_dependencies: - - eslint@9.0.0-beta.0 files: \.js?$ types: [file] args: diff --git a/eslint.config.js b/eslint.config.js index 9033a1882..28592870d 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,21 +1,19 @@ -module.exports = { - "env": { - "browser": true, - "es6": true, - node: true, +module.exports = [ + { + languageOptions:{ + ecmaVersion: 6, + sourceType: "module", + } }, - "extends": "eslint:recommended", - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "rules": { - "curly": ["error", "all"], - "dot-notation": "error", - "eqeqeq": "error", - "no-eval": "error", - "no-var": "error", - "prefer-const": "error", - "semi": "error" + { + rules: { + "curly": ["error", "all"], + "dot-notation": "error", + "eqeqeq": "error", + "no-eval": "error", + "no-var": "error", + "prefer-const": "error", + "semi": "error" + } } -}; +]; From 585b16388f317fe82508424b9a053255de8218cc Mon Sep 17 00:00:00 2001 From: Elijah Okello Date: Tue, 13 Feb 2024 16:27:24 +0300 Subject: [PATCH 3/4] fix: added dependencies and added support for globals in eslint.config.js --- .pre-commit-config.yaml | 4 ++++ eslint.config.js | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3ddbce30f..116a58560 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,6 +35,10 @@ repos: rev: v9.0.0-beta.0 hooks: - id: eslint + additional_dependencies: + - "eslint@v9.0.0-beta.0" + - "@eslint/js@v9.0.0-beta.0" + - "globals" files: \.js?$ types: [file] args: diff --git a/eslint.config.js b/eslint.config.js index 28592870d..0f7e558f4 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,8 +1,17 @@ +const js = require("@eslint/js"); +const globals = require("globals"); + module.exports = [ + js.configs.recommended, { + files: ["**/*.js"], languageOptions:{ - ecmaVersion: 6, + ecmaVersion: 2022, sourceType: "module", + globals: { + ...globals.browser, + ...globals.node + } } }, { From f6e0001e132a47f60074895bec3dfa399392e147 Mon Sep 17 00:00:00 2001 From: Elijah Okello Date: Tue, 13 Feb 2024 16:43:45 +0300 Subject: [PATCH 4/4] fix: set ecmaVersion to latest --- eslint.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.config.js b/eslint.config.js index 0f7e558f4..0b4d0e49e 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -6,7 +6,7 @@ module.exports = [ { files: ["**/*.js"], languageOptions:{ - ecmaVersion: 2022, + ecmaVersion: "latest", sourceType: "module", globals: { ...globals.browser,