Skip to content

Add 3 new eslint-plugin rules: prefer-destructured-lookups, no-dollar-prefix, require-destroyed-cleanup#729

Merged
titouanmathis merged 2 commits into
mainfrom
feat/eslint-plugin-new-rules-2
May 20, 2026
Merged

Add 3 new eslint-plugin rules: prefer-destructured-lookups, no-dollar-prefix, require-destroyed-cleanup#729
titouanmathis merged 2 commits into
mainfrom
feat/eslint-plugin-new-rules-2

Conversation

@titouanmathis

Copy link
Copy Markdown
Contributor

New rules

prefer-destructured-lookups (warn)

When this.$refs, this.$options or this.$children members are accessed more than once inside the same method, they should be destructured into a local variable to avoid repeated lookups.

// ❌ Bad
method() {
  this.$refs.input.focus();
  this.$refs.input.value = '';
}

// ✅ Good
method() {
  const { input } = this.$refs;
  input.focus();
  input.value = '';
}

no-dollar-prefix (error)

User-defined instance methods and properties must not start with $ in Base subclasses. The $ prefix is reserved for framework-provided members ($el, $refs, $emit, etc.).

// ❌ Bad
class Foo extends Base {
  $helper() {}
}

// ✅ Good
class Foo extends Base {
  helper() {}
}

require-destroyed-cleanup (warn)

Base subclasses that call setTimeout, setInterval or requestAnimationFrame must define a destroyed() method to clear those timers and prevent memory leaks.

// ❌ Bad
class Foo extends Base {
  mounted() { this._timer = setTimeout(() => {}, 1000); }
}

// ✅ Good
class Foo extends Base {
  mounted() { this._timer = setTimeout(() => {}, 1000); }
  destroyed() { clearTimeout(this._timer); }
}

…ed-cleanup rules to eslint-plugin

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Export Size

Unchanged

@studiometa/js-toolkit

Name Size Diff
AbstractService 528 B -
addClass 226 B -
addStyle 238 B -
ALL 20.71 kB -
animate 3.27 kB -
Base 8.71 kB -
BASE 8.76 kB -
boundingRectToCircle 154 B -
cache 194 B -
camelCase 397 B -
clamp 67 B -
clamp01 87 B -
closestComponent 418 B -
collideCircleCircle 99 B -
collideCircleRect 159 B -
collidePointCircle 112 B -
collidePointRect 103 B -
collideRectRect 99 B -
createApp 893 B -
createEaseInOut 116 B -
createEaseOut 71 B -
createElement 592 B -
createLocalStorage 1.19 kB -
createLocalStorageProvider 264 B -
createMemoryStorageProvider 146 B -
createNoopProvider 96 B -
createRange 90 B -
createSessionStorage 1.23 kB -
createSessionStorageProvider 254 B -
createStorage 1.17 kB -
createUrlSearchParamsInHashProvider 413 B -
createUrlSearchParamsInHashStorage 1.21 kB -
createUrlSearchParamsProvider 386 B -
createUrlSearchParamsStorage 1.21 kB -
damp 78 B -
dashCase 372 B -
debounce 92 B -
DECORATORS 7.59 kB -
defineFeatures 322 B -
domScheduler 296 B -
DragService 1.94 kB -
ease 435 B -
easeInCirc 68 B -
easeInCubic 59 B -
easeInExpo 80 B -
easeInOutCirc 141 B -
easeInOutCubic 130 B -
easeInOutExpo 134 B -
easeInOutQuad 128 B -
easeInOutQuart 133 B -
easeInOutQuint 152 B -
easeInOutSine 151 B -
easeInQuad 63 B -
easeInQuart 61 B -
easeInQuint 62 B -
easeInSine 77 B -
easeLinear 49 B -
easeOutCirc 115 B -
easeOutCubic 103 B -
easeOutExpo 112 B -
easeOutQuad 103 B -
easeOutQuart 100 B -
easeOutQuint 103 B -
easeOutSine 121 B -
endsWith 88 B -
FRAMEWORK 13.63 kB -
getAncestorWhere 91 B -
getAncestorWhereUntil 119 B -
getClosestParent 182 B -
getComponentResolver 138 B -
getDirectChildren 201 B -
getInstanceFromElement 92 B -
getInstances 185 B -
getOffsetSizes 159 B -
hasWindow 62 B -
HELPERS 2.43 kB -
historyPush 499 B -
historyReplace 503 B -
importOnInteraction 887 B -
importOnMediaQuery 236 B -
importWhenIdle 223 B -
importWhenPrefersMotion 275 B -
importWhenVisible 912 B -
inertiaFinalValue 142 B -
isArray 70 B -
isBoolean 78 B -
isDefined 86 B -
isDev 72 B -
isDirectChild 219 B -
isEmpty 207 B -
isEmptyString 93 B -
isFunction 72 B -
isNull 72 B -
isNumber 84 B -
isObject 105 B -
isString 86 B -
keyCodes 97 B -
KeyService 854 B -
lerp 57 B -
loadElement 169 B -
loadIframe 189 B -
loadImage 188 B -
loadLink 186 B -
loadScript 197 B -
LoadService 593 B -
localStorageProvider 715 B -
logTree 510 B -
lowerCase 60 B -
map 71 B -
matrix 106 B -
mean 91 B -
memo 100 B -
memoize 189 B -
memoryStorageProvider 607 B -
MutationService 799 B -
nextFrame 162 B -
nextMicrotask 111 B -
nextTick 134 B -
noop 39 B -
noopValue 49 B -
objectToURLSearchParams 302 B -
pascalCase 374 B -
PointerService 1.07 kB -
queryComponent 485 B -
queryComponentAll 494 B -
Queue 226 B -
RafService 956 B -
random 64 B -
randomInt 77 B -
randomItem 211 B -
registerComponent 103 B -
removeClass 222 B -
removeStyle 238 B -
ResizeService 1.01 kB -
round 56 B -
saveActiveElement 56 B -
ScrollService 1.28 kB -
scrollTo 2.31 kB -
SERVICES 4.01 kB -
sessionStorageProvider 712 B -
SmartQueue 411 B -
smoothTo 473 B -
snakeCase 374 B -
spring 115 B -
startsWith 87 B -
throttle 101 B -
toggleClass 225 B -
transform 288 B -
transition 916 B -
trapFocus 363 B -
tween 1.72 kB -
untrapFocus 45 B -
upperCase 54 B -
urlSearchParamsInHashProvider 537 B -
urlSearchParamsProvider 539 B -
useDrag 1.98 kB -
useKey 871 B -
useLoad 610 B -
useMutation 829 B -
usePointer 1.09 kB -
useRaf 963 B -
useResize 1.02 kB -
useScheduler 290 B -
useScroll 1.29 kB -
UTILS 9.59 kB -
wait 79 B -
withBreakpointManager 1.42 kB -
withBreakpointObserver 1.61 kB -
withDrag 2.09 kB -
withExtraConfig 135 B -
withFreezedOptions 140 B -
withGroup 252 B -
withIntersectionObserver 260 B -
withLeadingCharacters 88 B -
withLeadingSlash 107 B -
withMountOnMediaQuery 322 B -
withMountWhenInView 286 B -
withMountWhenPrefersMotion 355 B -
withMutation 959 B -
withName 81 B -
withoutLeadingCharacters 86 B -
withoutLeadingCharactersRecursive 124 B -
withoutLeadingSlash 93 B -
withoutTrailingCharacters 98 B -
withoutTrailingCharactersRecursive 129 B -
withoutTrailingSlash 103 B -
withRelativePointer 1.23 kB -
withResponsiveOptions 2.26 kB -
withScrolledInView 2.93 kB -
withTrailingCharacters 96 B -
withTrailingSlash 120 B -
wrap 77 B -

@codecov

codecov Bot commented May 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.78%. Comparing base (0030a99) to head (919917a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #729      +/-   ##
==========================================
+ Coverage   97.72%   97.78%   +0.06%     
==========================================
  Files         159      162       +3     
  Lines        3607     3710     +103     
  Branches     1003     1040      +37     
==========================================
+ Hits         3525     3628     +103     
  Misses         74       74              
  Partials        8        8              
Flag Coverage Δ
eslint-plugin-js-toolkit 94.18% <100.00%> (+0.91%) ⬆️
js-toolkit 97.78% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed-hq

codspeed-hq Bot commented May 20, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
❌ 10 regressed benchmarks
✅ 103 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
schedule + flush 50 read tasks 433.6 µs 358.6 µs +20.92%
all transforms 299.7 µs 340.2 µs -11.89%
combined (x, y, scale, rotate) 286.8 µs 326.2 µs -12.08%
rotate 286.6 µs 320.9 µs -10.7%
rotateX, rotateY, rotateZ 289.8 µs 327 µs -11.38%
scale 289.5 µs 324.5 µs -10.78%
scaleX, scaleY, scaleZ 297.4 µs 333.2 µs -10.74%
skew 286.1 µs 320.9 µs -10.83%
skewX, skewY 291.8 µs 329.2 µs -11.38%
translate3d (x only) 287.8 µs 325.7 µs -11.65%
create tween with bezier curve 375.9 µs 340.6 µs +10.39%
getEdges (x axis, named offsets) 21.8 µs 24.3 µs -10.28%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing feat/eslint-plugin-new-rules-2 (919917a) with main (0030a99)

Open in CodSpeed

…lugin rules

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@titouanmathis titouanmathis merged commit f524416 into main May 20, 2026
9 of 10 checks passed
@titouanmathis titouanmathis deleted the feat/eslint-plugin-new-rules-2 branch May 20, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant