From f154b0fc5f94c03552c041382ce602feb537159b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Dom=C3=ADnguez?= Date: Wed, 18 Sep 2024 10:46:08 +0200 Subject: [PATCH] refactor: use ember-lifeline to avoid eslint error --- ember-autofocus-modifier/package.json | 1 + .../src/modifiers/autofocus.ts | 4 ++-- pnpm-lock.yaml | 24 +++++++++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/ember-autofocus-modifier/package.json b/ember-autofocus-modifier/package.json index e6558b85..ca56704c 100644 --- a/ember-autofocus-modifier/package.json +++ b/ember-autofocus-modifier/package.json @@ -55,6 +55,7 @@ "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^8.6.0", "concurrently": "^8.2.2", + "ember-lifeline": "^7.0.0", "ember-template-lint": "^5.13.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", diff --git a/ember-autofocus-modifier/src/modifiers/autofocus.ts b/ember-autofocus-modifier/src/modifiers/autofocus.ts index 727cdcdb..7097a7f8 100644 --- a/ember-autofocus-modifier/src/modifiers/autofocus.ts +++ b/ember-autofocus-modifier/src/modifiers/autofocus.ts @@ -1,5 +1,5 @@ import { modifier } from "ember-modifier"; -import { next } from "@ember/runloop"; +import { runTask } from "ember-lifeline"; const focusableElements = [ "BUTTON", @@ -68,7 +68,7 @@ const autofocus = modifier(function autofocus( element.setAttribute("tabindex", "-1"); } - next(function () { + runTask(element, function () { targetElement.focus(); }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b734f229..3c1f6e75 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -43,7 +43,7 @@ importers: version: 1.8.7 ember-modifier: specifier: ^4.1.0 - version: 4.1.0(ember-source@4.12.2) + version: 4.1.0 ember-source: specifier: 4.12.2 version: 4.12.2(@babel/core@7.23.9)(@glimmer/component@1.1.2)(@glint/template@1.4.0)(webpack@5.94.0) @@ -99,6 +99,9 @@ importers: concurrently: specifier: ^8.2.2 version: 8.2.2 + ember-lifeline: + specifier: ^7.0.0 + version: 7.0.0 ember-template-lint: specifier: ^5.13.0 version: 5.13.0 @@ -2203,7 +2206,7 @@ packages: dependencies: '@glimmer/component': 1.1.2(@babel/core@7.23.9) '@glint/template': 1.4.0 - ember-modifier: 4.1.0(ember-source@4.12.2) + ember-modifier: 4.1.0 dev: true /@glint/template@1.4.0: @@ -6683,6 +6686,20 @@ packages: - supports-color dev: true + /ember-lifeline@7.0.0: + resolution: {integrity: sha512-2l51NzgH5vjN972zgbs+32rnXnnEFKB7qsSpJF+lBI4V5TG6DMy4SfowC72ZEuAtS58OVfwITbOO+RnM21EdpA==} + engines: {node: 16.* || >= 18} + peerDependencies: + '@ember/test-helpers': '>= 1.0.0' + peerDependenciesMeta: + '@ember/test-helpers': + optional: true + dependencies: + '@embroider/addon-shim': 1.8.7 + transitivePeerDependencies: + - supports-color + dev: true + /ember-load-initializers@2.1.2(@babel/core@7.23.9): resolution: {integrity: sha512-CYR+U/wRxLbrfYN3dh+0Tb6mFaxJKfdyz+wNql6cqTrA0BBi9k6J3AaKXj273TqvEpyyXegQFFkZEiuZdYtgJw==} engines: {node: 6.* || 8.* || >= 10.*} @@ -6706,7 +6723,7 @@ packages: - supports-color dev: true - /ember-modifier@4.1.0(ember-source@4.12.2): + /ember-modifier@4.1.0: resolution: {integrity: sha512-YFCNpEYj6jdyy3EjslRb2ehNiDvaOrXTilR9+ngq+iUqSHYto2zKV0rleiA1XJQ27ELM1q8RihT29U6Lq5EyqQ==} peerDependencies: ember-source: 4.12.2 @@ -6717,7 +6734,6 @@ packages: '@embroider/addon-shim': 1.8.7 ember-cli-normalize-entity-name: 1.0.0 ember-cli-string-utils: 1.1.0 - ember-source: 4.12.2(@babel/core@7.23.9)(@glimmer/component@1.1.2)(@glint/template@1.4.0)(webpack@5.94.0) transitivePeerDependencies: - supports-color