mirror of
https://github.com/darksaid98/auto-changelog.git
synced 2026-12-03 06:28:52 +00:00
refactor: enhance ESLint configuration and type safety
This commit replaces `.eslintrc.yml` with `eslint.config.mts`, and updates the ESLint setup with Noir and Flat Gitignore configs. Signed-off-by: Ardalan Amini <[email protected]>
This commit is contained in:
32 files changed
+1140
-752
No files matched your search
+18
-18
@@ -28,63 +28,63 @@ it("should cache value", () => {
|
||||
const name = "foo";
|
||||
const value = "bar";
|
||||
|
||||
const fn = jest.fn(() => value);
|
||||
const mockFunction = jest.fn(() => value);
|
||||
|
||||
const firstCallResult = cache(name, fn);
|
||||
const firstCallResult = cache(name, mockFunction);
|
||||
|
||||
expect(firstCallResult).toBe(value);
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
expect(mockFunction).toHaveBeenCalledTimes(1);
|
||||
|
||||
fn.mockClear();
|
||||
mockFunction.mockClear();
|
||||
|
||||
const secondCallResult = cache(name, fn);
|
||||
const secondCallResult = cache(name, mockFunction);
|
||||
|
||||
expect(secondCallResult).toBe(value);
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(0);
|
||||
expect(mockFunction).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it("should overwrite cache value", () => {
|
||||
const name = "foo";
|
||||
const value = "bar";
|
||||
|
||||
const fn = jest.fn(() => value);
|
||||
const mockFunction = jest.fn(() => value);
|
||||
|
||||
const firstCallResult = cache(name, fn);
|
||||
const firstCallResult = cache(name, mockFunction);
|
||||
|
||||
expect(firstCallResult).toBe(value);
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
expect(mockFunction).toHaveBeenCalledTimes(1);
|
||||
|
||||
fn.mockClear();
|
||||
mockFunction.mockClear();
|
||||
|
||||
const secondCallResult = cache(name, fn, true);
|
||||
const secondCallResult = cache(name, mockFunction, true);
|
||||
|
||||
expect(secondCallResult).toBe(value);
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
expect(mockFunction).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("should clear cache", () => {
|
||||
const name = "foo";
|
||||
const value = "bar";
|
||||
|
||||
const fn = jest.fn(() => value);
|
||||
const mockFunction = jest.fn(() => value);
|
||||
|
||||
const firstCallResult = cache(name, fn);
|
||||
const firstCallResult = cache(name, mockFunction);
|
||||
|
||||
expect(firstCallResult).toBe(value);
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
expect(mockFunction).toHaveBeenCalledTimes(1);
|
||||
|
||||
fn.mockClear();
|
||||
mockFunction.mockClear();
|
||||
|
||||
clearCache();
|
||||
|
||||
const secondCallResult = cache(name, fn);
|
||||
const secondCallResult = cache(name, mockFunction);
|
||||
|
||||
expect(secondCallResult).toBe(value);
|
||||
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
expect(mockFunction).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
import { getInput } from "@actions/core";
|
||||
import { parseSemVer } from "../../src/utils";
|
||||
import { parseSemanticVersion } from "../../src/utils";
|
||||
|
||||
it("should parse the semver version string", () => {
|
||||
const major = 1;
|
||||
@@ -41,7 +41,7 @@ it("should parse the semver version string", () => {
|
||||
return "";
|
||||
});
|
||||
|
||||
const result = parseSemVer(raw);
|
||||
const result = parseSemanticVersion(raw);
|
||||
|
||||
expect(result).toBeDefined();
|
||||
expect(result).toEqual({
|
||||
@@ -82,7 +82,7 @@ it("should parse the release name by default", () => {
|
||||
}
|
||||
});
|
||||
|
||||
const result = parseSemVer();
|
||||
const result = parseSemanticVersion();
|
||||
|
||||
expect(result).toBeDefined();
|
||||
expect(result).toEqual({
|
||||
|
||||
@@ -37,7 +37,7 @@ it("should handle null value", () => {
|
||||
});
|
||||
|
||||
it("should handle undefined value", () => {
|
||||
// eslint-disable-next-line no-undefined,@typescript-eslint/no-confusing-void-expression
|
||||
// eslint-disable-next-line no-undefined,@typescript-eslint/no-confusing-void-expression,unicorn/no-useless-undefined
|
||||
expect(trim(undefined)).toBeUndefined();
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user