Skip to content

Commit cf659f3

Browse files
authored
fix increased memory usage for ESLint CLI (#1251)
1 parent b2b90d3 commit cf659f3

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

.changeset/healthy-readers-study.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-eslint/eslint-plugin': patch
3+
---
4+
5+
fix increased memory usage for ESLint CLI

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"jest-snapshot-serializer-raw": "1.2.0",
4747
"json-schema-to-markdown": "1.1.1",
4848
"lint-staged": "13.0.3",
49-
"prettier": "2.7.1",
49+
"prettier": "3.0.0-alpha.4",
5050
"rimraf": "3.0.2",
5151
"ts-node": "10.9.1",
5252
"typescript": "4.8.4"

packages/plugin/src/cache.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ export class ModuleCache<T, K = any> {
1919
}
2020
const { lastSeen, result } = this.map.get(cacheKey);
2121
// check freshness
22-
if (process.hrtime(lastSeen)[0] < settings.lifetime) {
22+
if (
23+
process.env.NODE /* don't check for ESLint CLI */ ||
24+
process.hrtime(lastSeen)[0] < settings.lifetime
25+
) {
2326
return result;
2427
}
2528
}

pnpm-lock.yaml

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)