@open-turo/eslint-config-typescript 18.0.12 → 18.1.0-pr-440.292.1.1
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/.nvmrc +1 -1
- package/.pre-commit-config.yaml +1 -1
- package/README.md +13 -2
- package/index.cjs +52 -4
- package/pack/open-turo-eslint-config-typescript-18.1.0-pr-440.292.1.1.tgz +0 -0
- package/package.json +2 -1
- package/test/__snapshots__/test.spec.js.snap +6100 -0
- package/test/test.spec.js +36 -0
- package/pack/open-turo-eslint-config-typescript-18.0.12.tgz +0 -0
package/test/test.spec.js
CHANGED
|
@@ -57,4 +57,40 @@ describe("validate config", () => {
|
|
|
57
57
|
expect(calculatedConfig.rules).toMatchSnapshot();
|
|
58
58
|
},
|
|
59
59
|
);
|
|
60
|
+
|
|
61
|
+
test.each(["index.mjs", "index.cjs"])(
|
|
62
|
+
`the flat config with vitest is correct for %s`,
|
|
63
|
+
async (configFile) => {
|
|
64
|
+
const ESLint = await loadESLint({
|
|
65
|
+
useFlatConfig: true,
|
|
66
|
+
});
|
|
67
|
+
const { default: config } = await import(`../${configFile}`);
|
|
68
|
+
const linter = new ESLint({
|
|
69
|
+
baseConfig: config({ testFramework: "vitest" }),
|
|
70
|
+
overrideConfig: [
|
|
71
|
+
{
|
|
72
|
+
files: [testFileName],
|
|
73
|
+
languageOptions: {
|
|
74
|
+
parserOptions,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
});
|
|
79
|
+
const messages = await linter.lintText(code, {
|
|
80
|
+
filePath: testFileName,
|
|
81
|
+
});
|
|
82
|
+
expect(messages[0].messages).toEqual([]);
|
|
83
|
+
expect(messages[0].errorCount).toEqual(0);
|
|
84
|
+
const calculatedConfig =
|
|
85
|
+
await linter.calculateConfigForFile("./test/sample.ts");
|
|
86
|
+
expect(calculatedConfig.rules).toMatchSnapshot();
|
|
87
|
+
},
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
test("throws error for invalid testFramework", async () => {
|
|
91
|
+
const { default: config } = await import("../index.cjs");
|
|
92
|
+
expect(() => config({ testFramework: "invalid" })).toThrow(
|
|
93
|
+
'Invalid testFramework option: "invalid". Valid values are "jest" or "vitest".',
|
|
94
|
+
);
|
|
95
|
+
});
|
|
60
96
|
});
|
|
Binary file
|