Commit 7d73daa
authored
Performance & Tooling Modernization: oxlint, Native Testing, and Documentation Overhaul (#402)
* Add CLAUDE.md and AGENTS.md, replace eslint with oxfmt/oxlint
* Remove .cursor directory
* Update AGENTS.md with project info, remove c8 dependency
* Remove mocha and c8 dependencies, simplify test script
* Update oxfmt and oxlint versions
* Use Node's native test runner
* Replace new Array() with Array.from() to fix lint warnings
* Audit fixes: has() TTL check, evict() null guard, lazy default params, setWithEvicted cleanup
* Rewrite README.md for new and experienced developers
* Add docs/API.md with complete API reference
* Update CODE_STYLE_GUIDE.md with actual coding conventions
* Update TECHNICAL_DOCUMENTATION.md to reflect actual implementation
* Revert TECHNICAL_DOCUMENTATION.md changes
* Fix TECHNICAL_DOCUMENTATION.md to accurately reflect implementation
* Fix Mathematical Foundation section in TECHNICAL_DOCUMENTATION.md
- Add removeFromList definition with all 4 prev/next cases
- Expand moveToEnd formula and document 'only node' edge case
- Fix TTL validity invariant to handle expiry=0 when ttl=0
* Fix memory leak, stale data, and improve performance
- Clear prev/next pointers in delete() and evict() to prevent memory leaks
- Fix entries() and values() to not pollute LRU order (access items directly instead of calling get())
- Fix entries() and values() returning stale data with TTL (direct item access instead of get() which can delete expired items)
- Fix expiresAt() to return expiry for expired-but-not-yet-deleted items
- Optimize setWithEvicted() to avoid redundant has()+set() calls
- Remove dead code in moveToEnd() (unreachable edge case)
- Remove obsolete moveToEnd edge case test
* Update AGENTS.md with common issues and implementation notes
* Remove dead code in moveToEnd()
* Update lint script to check formatting
* Replace fmt script with fix script
* Apply formatting fixes
* Add coverage script and rename test file
* Add tests for 100% line coverage
* Add test coverage info to README
* Remove unused eslint config
* Fix Mathematical Foundation section to match implementation
* Update TypeScript definitions to match implementation
* Rebuild distribution files
* fix: rename cache variables in factory function example to avoid redeclaration
* fix: correct values() example comment to reflect input key order
* feat: add oxlint.json configuration
* feat: add .oxfmtrc.json configuration
* feat: update pre-commit hook to run fix, coverage, and stage all changes
* build: update dist files
* fix: clarify entries() and values() ordering in JSDoc
* build: update dist files
* docs: add development principles (DRY, YAGNI, SOLID, OWASP)
* refactor: extract unlink() to eliminate linked list duplication
* build: update dist files
* refactor: remove bypass parameter from set() to simplify API
* refactor: simplify set() and setWithEvicted() API by removing resetTtl parameter
* build: update dist files
* docs: sort methods and properties alphabetically in README
* docs: add badges, TypeScript example, comparison, and contributing guide
* docs: update copyright year to 2026
* docs: fix build badge URL to point to ci.yml
* docs: restore coverage badge
* docs: update package.json description to match README tagline
* docs: optimize package.json keywords for discoverability
* chore: update files array to explicitly list lru.d.ts
* docs: add contributing guide
* docs: update AGENTS.md with correct npm scripts
* docs: update AGENTS.md development workflow section
* docs: rename ESLint Configuration to Lint Configuration
* types: update set() and setWithEvicted() signatures to remove unused parameters
* docs: fix TypeScript signatures in TECHNICAL_DOCUMENTATION.md to match types/lru.d.ts
* docs: fix TTL reset invariant and expiry formula in technical documentation
- Add setWithEvicted() to resetTtl description in Core Components
- Update create() formula to show conditional TTL handling (ttl > 0 ? t_now + ttl : 0)
- Fix TTL Reset Invariant to remove incorrect bypass parameter reference
* perf: remove bypass parameter from evict() to avoid V8 deoptimization
- Simplified evict() signature by removing unused bypass parameter
- All internal callers already guarantee size > 0 before calling evict()
- Reduced code complexity and eliminated unnecessary conditional branch
- Updated TypeScript definitions and documentation
BREAKING CHANGE: evict() no longer accepts bypass parameter
* docs: fix resetTtl description and setWithEvicted return type
- Correct resetTtl description: resets TTL on set() updates, not get()
- Fix setWithEvicted return type: {key, value, expiry} only (no prev/next)
All 54 tests passing.
* build: update distribution files
* refactor: make unlink() private and update Node.js version requirement
- Convert unlink() to private field (#unlink) for true encapsulation
- Update engines.node from >=12 to >=14 to support private class fields
- All 54 tests passing
* refactor: simplify JSDoc by removing @example, @see, @SInCE, @method, @memberof
- Removed @example, @see, and @SInCE tags from all method docblocks
- Removed @method and @memberof tags (redundant for class methods)
- Kept @param, @returns, @throws, @Private, and @constructor where needed
- Updated distribution files via build
- All 54 tests passing
* test: update tests to match current API and add edge case coverage
- Remove outdated tests using removed resetTtl parameter from set()/setWithEvicted()
- Add tests for garbage collection (prev/next pointer cleanup)
- Add tests for first/last pointer consistency after deletions
- Add tests for different value types (functions, objects, arrays, null, undefined)
- Add tests for unlimited cache edge cases
- Add tests for array methods with non-existent keys
- Add test verifying get() does NOT reset TTL
- Remove object key test (not supported - keys coerced to strings)
Total: 69 tests, 14 suites, all passing
* docs: update Node.js version requirement to 14+ and fix test runner reference
- Update README.md to require Node.js ≥14 (for private class fields)
- Update docs/TECHNICAL_DOCUMENTATION.md to reference Node.js test runner instead of mocha1 parent d3ca4f3 commit 7d73daa
File tree
31 files changed
+3634
-5199
lines changed- .cursor/rules
- .husky
- benchmarks
- dist
- docs
- src
- tests/unit
- types
31 files changed
+3634
-5199
lines changedThis file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1059 | 1059 | | |
1060 | 1060 | | |
1061 | 1061 | | |
1062 | | - | |
| 1062 | + | |
1063 | 1063 | | |
1064 | 1064 | | |
1065 | 1065 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
0 commit comments