Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

102 changes: 0 additions & 102 deletions .eslintrc.cjs

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- migrated to eslint 9 flat config

### dependabot: \#49 Bump cross-spawn from 7.0.3 to 7.0.6

## [1.2.0] - 2025-01-13
Expand Down
3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import neolutionEslintConfig from "@neolution-ch/eslint-config-neolution";

export default [...neolutionEslintConfig.configs.flat.typescript, { rules: { "unicorn/no-null": "off" } }];
Comment thread
drebrez marked this conversation as resolved.
Outdated
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
],
"scripts": {
"build": "rollup -c",
"lint": "eslint \"**/*.{ts,tsx}\" --cache --max-warnings 0",
"lint": "eslint --cache",
"prepack": "yarn build",
"prepare-pr": "yarn prettier . --write && yarn lint && yarn build && yarn test",
"prettier-check": "prettier --check .",
Expand All @@ -43,6 +43,7 @@
"storybook": "start-storybook -p 6006"
},
"dependencies": {
"@neolution-ch/eslint-config-neolution": "https://pkg.pr.new/neolution-ch/eslint-config-neolution/@neolution-ch/eslint-config-neolution@b64d3d8",
"date-fns": "^2.30.0",
"uuid": "^9.0.1"
},
Expand All @@ -60,17 +61,13 @@
"@typescript-eslint/parser": "^5.59.2",
"concurrently": "^8.0.1",
"cross-env": "^7.0.3",
"eslint": "^8.45.0",
"eslint-config-prettier": "^8.8.0",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-import": "^2.27.5",
"eslint": "^9.18.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jsdoc": "^46.4.4",
"eslint-plugin-storybook": "^0.6.12",
"jest": "^29.6.1",
"jest-localstorage-mock": "^2.4.26",
"nodemon": "^2.0.22",
"prettier": "^2.8.8",
"prettier": "^3.4.2",
"release-it": "^16.1.2",
"rollup": "^3.21.4",
"rollup-plugin-peer-deps-external": "^2.2.4",
Expand Down
5 changes: 1 addition & 4 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import commonjs from "@rollup/plugin-commonjs";
import nodeResolve from "@rollup/plugin-node-resolve";
import { default as nodeResolve } from "@rollup/plugin-node-resolve";
import external from "rollup-plugin-peer-deps-external";
import terser from "@rollup/plugin-terser";
import typescript from "rollup-plugin-typescript2";
Expand Down Expand Up @@ -35,7 +35,6 @@ export default [
name: "JavaScriptUtilities",
sourcemap: true,
exports: "named",
sourcemap: true,
interop: "auto",
},
plugins,
Expand All @@ -48,7 +47,6 @@ export default [
name: "JavaScriptUtilities",
sourcemap: true,
exports: "named",
sourcemap: true,
},
plugins,
},
Expand All @@ -60,7 +58,6 @@ export default [
name: "JavaScriptUtilities",
sourcemap: true,
exports: "named",
sourcemap: true,
},
plugins,
},
Expand Down
4 changes: 2 additions & 2 deletions src/lib/enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type StandardEnum<T> = {
* @returns A string containing the name of the enum
*/
export function getEnumNameFromValue<T>(enumVariable: StandardEnum<T>, enumValue: T): string {
return Object.keys(enumVariable)[Object.values(enumVariable).findIndex((x) => x === enumValue)];
return Object.keys(enumVariable)[Object.values(enumVariable).indexOf(enumValue)];
}

/**
Expand All @@ -23,7 +23,7 @@ export function getEnumNameFromValue<T>(enumVariable: StandardEnum<T>, enumValue
* @returns A string containing the value of the enum
*/
export function getEnumValueFromName<T>(enumVariable: StandardEnum<T>, enumName: string): T {
const value = Object.values(enumVariable)[Object.keys(enumVariable).findIndex((x) => x === enumName)] as string;
const value = Object.values(enumVariable)[Object.keys(enumVariable).indexOf(enumName)] as string;
return (isEnumString(enumVariable) ? value : Number.parseInt(value)) as T;
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/localStorage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("localStorage tests", () => {
});

test("getLocalStorageItem expired", () => {
const expirationDate = new Date(new Date().getTime() - 1);
const expirationDate = new Date(Date.now() - 1);
localStorage.setItem("test", JSON.stringify({ data: true, expirationDate: expirationDate.toISOString() }));
expect(localStorage.length).toBe(1);
expect(getLocalStorageItem("test")).toBeUndefined();
Expand Down
2 changes: 1 addition & 1 deletion src/lib/localStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface LocalStorageItem<T> {
*/
const checkLocalStorageSupport = () => {
if (typeof localStorage === "undefined") {
throw new Error("localStorage not supported");
throw new TypeError("localStorage not supported");
}
};

Expand Down
Loading