Feature Request Checklist
Overview
Right now, the node_modules/.cache/flint.json data for a file with a report looks something like:
"packages/plugin-flint/src/rules/duplicateTests.test.ts": {
"dependencies": [
"packages/plugin-flint/src/rules/duplicateTests.ts",
"packages/plugin-flint/src/rules/ruleTester.ts",
"tsconfig.json"
],
"reports": [
{
"about": {
"id": "forInArrays",
"preset": "logical"
},
"message": {
"primary": "For-in loops over arrays have surprising behavior that often leads to bugs.",
"secondary": [
"A for-in loop (`for (const i in o)`) iterates over all enumerable properties of an object, including those that are not array indices.",
"This can lead to unexpected behavior when used with arrays, as it may include properties that are not part of the array's numeric indices.",
"It also returns the index key (`i`) as a string, which is not the expected numeric type for array indices."
],
"suggestions": [
"Use a construct more suited for arrays, such as a for-of loop (`for (const i of o)`)."
]
},
"range": {
"begin": {
"column": 0,
"line": 60,
"raw": 1449
},
"end": {
"column": 22,
"line": 60,
"raw": 1471
}
}
}
],
"timestamp": 1752268964662
},
Note the "about" and "message" properties. They store a bunch of metadata about the rule. We could get a much smaller cache size if we just stored the rule ID, message ID string, and any interpolated message data. Roughly:
"packages/plugin-flint/src/rules/duplicateTests.test.ts": {
"dependencies": [
"packages/plugin-flint/src/rules/duplicateTests.ts",
"packages/plugin-flint/src/rules/ruleTester.ts",
"tsconfig.json"
],
"reports": [
{
"message": {
"id": "forIn"
},
"range": {
"begin": {
"column": 0,
"line": 60,
"raw": 1449
},
"end": {
"column": 22,
"line": 60,
"raw": 1471
}
},
"rule": {
"plugin": "ts",
"rule": "forInArrays"
}
}
],
"timestamp": 1752268964662
}
Additional Info
❤️🔥
Feature Request Checklist
mainbranch of the repository.Overview
Right now, the
node_modules/.cache/flint.jsondata for a file with a report looks something like:Note the
"about"and"message"properties. They store a bunch of metadata about the rule. We could get a much smaller cache size if we just stored the rule ID, message ID string, and any interpolated message data. Roughly:Additional Info
❤️🔥