typegraph-mcp 0.9.45 → 0.9.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.ts +18 -0
- package/dist/cli.js +13 -0
- package/install-oxlint-test.ts +7 -0
- package/package.json +1 -1
package/cli.ts
CHANGED
|
@@ -815,6 +815,24 @@ function patchEslintConfig(raw: string): string | null {
|
|
|
815
815
|
return raw.replace(exportArrayRe, (match) => `${match} { ignores: ["plugins/**"] },\n`);
|
|
816
816
|
}
|
|
817
817
|
|
|
818
|
+
// Matches common flat-config shape:
|
|
819
|
+
// const config = [
|
|
820
|
+
// ...
|
|
821
|
+
// ];
|
|
822
|
+
// export default config;
|
|
823
|
+
const variableArrayRe = /((?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*\[)\s*\n?/g;
|
|
824
|
+
for (const variableArrayMatch of raw.matchAll(variableArrayRe)) {
|
|
825
|
+
const [, open, variableName] = variableArrayMatch;
|
|
826
|
+
const escapedName = variableName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
827
|
+
const exportDefaultRe = new RegExp(`export\\s+default\\s+${escapedName}\\s*;?`);
|
|
828
|
+
|
|
829
|
+
if (exportDefaultRe.test(raw)) {
|
|
830
|
+
return `${raw.slice(0, variableArrayMatch.index)}${open}\n { ignores: ["plugins/**"] },\n${raw.slice(
|
|
831
|
+
(variableArrayMatch.index ?? 0) + variableArrayMatch[0].length
|
|
832
|
+
)}`;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
|
|
818
836
|
return null;
|
|
819
837
|
}
|
|
820
838
|
|
package/dist/cli.js
CHANGED
|
@@ -3874,6 +3874,19 @@ function patchEslintConfig(raw) {
|
|
|
3874
3874
|
return raw.replace(exportArrayRe, (match) => `${match} { ignores: ["plugins/**"] },
|
|
3875
3875
|
`);
|
|
3876
3876
|
}
|
|
3877
|
+
const variableArrayRe = /((?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*\[)\s*\n?/g;
|
|
3878
|
+
for (const variableArrayMatch of raw.matchAll(variableArrayRe)) {
|
|
3879
|
+
const [, open, variableName] = variableArrayMatch;
|
|
3880
|
+
const escapedName = variableName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3881
|
+
const exportDefaultRe = new RegExp(`export\\s+default\\s+${escapedName}\\s*;?`);
|
|
3882
|
+
if (exportDefaultRe.test(raw)) {
|
|
3883
|
+
return `${raw.slice(0, variableArrayMatch.index)}${open}
|
|
3884
|
+
{ ignores: ["plugins/**"] },
|
|
3885
|
+
${raw.slice(
|
|
3886
|
+
(variableArrayMatch.index ?? 0) + variableArrayMatch[0].length
|
|
3887
|
+
)}`;
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3877
3890
|
return null;
|
|
3878
3891
|
}
|
|
3879
3892
|
function patchOxlintJsonConfig(raw) {
|
package/install-oxlint-test.ts
CHANGED
|
@@ -68,16 +68,20 @@ async function main(): Promise<void> {
|
|
|
68
68
|
|
|
69
69
|
const tsconfig = fs.readFileSync(path.join(projectRoot, "tsconfig.json"), "utf-8");
|
|
70
70
|
const oxlint = fs.readFileSync(path.join(projectRoot, ".oxlintrc.json"), "utf-8");
|
|
71
|
+
const eslint = fs.readFileSync(path.join(projectRoot, "eslint.config.js"), "utf-8");
|
|
71
72
|
|
|
72
73
|
assertIncludes(tsconfig, '"$schema": "http://json.schemastore.org/tsconfig"');
|
|
73
74
|
assertIncludes(tsconfig, '"exclude": ["plugins/**"]');
|
|
74
75
|
assertIncludes(oxlint, '"ignorePatterns": [');
|
|
75
76
|
assertIncludes(oxlint, '"plugins/**"');
|
|
77
|
+
assertIncludes(eslint, 'const config = [\n { ignores: ["plugins/**"] },');
|
|
76
78
|
assert.ok(fs.existsSync(path.join(pluginRoot, "cli.ts")), "Expected installed plugin CLI");
|
|
77
79
|
|
|
78
80
|
assertIncludes(setupOutput, 'Added "plugins/**" to tsconfig.json exclude');
|
|
79
81
|
assertIncludes(setupOutput, 'Added "plugins/**" to .oxlintrc.json ignorePatterns');
|
|
82
|
+
assertIncludes(setupOutput, 'Added "plugins/**" to eslint.config.js ignores');
|
|
80
83
|
assertIncludes(setupOutput, "Oxlint ignores plugins/ (.oxlintrc.json)");
|
|
84
|
+
assertIncludes(setupOutput, "ESLint ignores plugins/ (eslint.config.js)");
|
|
81
85
|
|
|
82
86
|
const checkOutput = runTsx(
|
|
83
87
|
pluginRoot,
|
|
@@ -86,6 +90,7 @@ async function main(): Promise<void> {
|
|
|
86
90
|
testEnv
|
|
87
91
|
);
|
|
88
92
|
assertIncludes(checkOutput, "Oxlint ignores plugins/ (.oxlintrc.json)");
|
|
93
|
+
assertIncludes(checkOutput, "ESLint ignores plugins/ (eslint.config.js)");
|
|
89
94
|
assert.ok(
|
|
90
95
|
!checkOutput.includes("Lint config check (no ESLint or Oxlint config found)"),
|
|
91
96
|
`Did not expect lint config detection to be skipped:\n${checkOutput}`
|
|
@@ -97,7 +102,9 @@ async function main(): Promise<void> {
|
|
|
97
102
|
console.log(" ✓ tsconfig schema URL preserved during exclude patch");
|
|
98
103
|
console.log(" ✓ tsconfig exclude patch ignores unrelated plugins text");
|
|
99
104
|
console.log(" ✓ .oxlintrc.json patched with plugins ignore");
|
|
105
|
+
console.log(" ✓ eslint.config.js named flat-config array patched with plugins ignore");
|
|
100
106
|
console.log(" ✓ installed plugin health check recognizes Oxlint config");
|
|
107
|
+
console.log(" ✓ installed plugin health check recognizes ESLint config");
|
|
101
108
|
} finally {
|
|
102
109
|
fs.rmSync(tempRoot, { recursive: true, force: true });
|
|
103
110
|
}
|