Skip to content

Commit 800dcfa

Browse files
neotobdrebrez
andauthored
Feature/eslint 9 (#52)
Co-authored-by: Daniele Debernardi <daniele.debernardi@neolution.ch>
1 parent a92562e commit 800dcfa

File tree

11 files changed

+1978
-627
lines changed

11 files changed

+1978
-627
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc.cjs

Lines changed: 0 additions & 102 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
if: ${{ github.actor == 'dependabot[bot]' }}
1717
permissions:
1818
contents: write
19+
1920
runs-on: ubuntu-latest
2021
steps:
2122
- uses: actions/checkout@v3

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Changed
1111

1212
- Rollup and Jest configs in TypeScript
13+
- Ignore code coverage output folder
14+
- Migrate to eslint 9 flat config
1315

1416
### Removed
1517

@@ -24,7 +26,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2426
### Changed
2527

2628
- Split up `CI` workflow into two separate workflows for the comment posting to work for PRs from forks.
27-
- Ignore code coverage output folder
2829

2930
### Fixed
3031

eslint.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import neolutionEslintConfig from "@neolution-ch/eslint-config-neolution";
2+
3+
export default [
4+
...neolutionEslintConfig.configs.flat.getConfig({
5+
...neolutionEslintConfig.configs.flat.defaults.typescript,
6+
jest: true,
7+
jsdocRequireJsdoc: true,
8+
}),
9+
];

package.json

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
],
3232
"scripts": {
3333
"build": "rollup -c --configPlugin rollup-plugin-typescript2",
34-
"lint": "eslint \"**/*.{ts,tsx}\" --cache --max-warnings 0",
34+
"lint": "eslint --cache",
3535
"prepack": "yarn build",
3636
"prepare-pr": "yarn prettier . --write && yarn lint && yarn build && yarn test",
3737
"prettier-check": "prettier --check .",
@@ -46,6 +46,7 @@
4646
"uuid": "^9.0.1"
4747
},
4848
"devDependencies": {
49+
"@neolution-ch/eslint-config-neolution": "^2.1.0",
4950
"@release-it/keep-a-changelog": "^4.0.0",
5051
"@rollup/plugin-commonjs": "^24.1.0",
5152
"@rollup/plugin-node-resolve": "^15.0.2",
@@ -54,19 +55,13 @@
5455
"@types/node": "^18.16.3",
5556
"@types/rollup-plugin-peer-deps-external": "^2.2.5",
5657
"@types/uuid": "^9.0.7",
57-
"@typescript-eslint/eslint-plugin": "^5.59.2",
58-
"@typescript-eslint/parser": "^5.59.2",
5958
"concurrently": "^8.0.1",
60-
"eslint": "^8.45.0",
61-
"eslint-config-prettier": "^8.8.0",
62-
"eslint-import-resolver-typescript": "^3.5.5",
63-
"eslint-plugin-import": "^2.27.5",
64-
"eslint-plugin-jest": "^27.2.3",
65-
"eslint-plugin-jsdoc": "^46.4.4",
59+
"eslint": "^9.24.0",
6660
"jest": "^29.6.1",
6761
"jest-localstorage-mock": "^2.4.26",
62+
"jiti": "^2.4.2",
6863
"nodemon": "^2.0.22",
69-
"prettier": "^2.8.8",
64+
"prettier": "^3.5.3",
7065
"release-it": "^16.1.2",
7166
"rollup": "^3.21.4",
7267
"rollup-plugin-peer-deps-external": "^2.2.4",

rollup.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const cleanDist: Plugin = {
1717
writeBundle() {
1818
fs.rmSync("./dist/rollup.config.d.ts", { force: true });
1919
fs.rmSync("./dist/jest.config.d.ts", { force: true });
20+
fs.rmSync("./dist/eslint.config.d.ts", { force: true });
2021
},
2122
};
2223

src/lib/localStorage.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe("localStorage tests", () => {
2626
});
2727

2828
test("getLocalStorageItem expired", () => {
29-
const expirationDate = new Date(new Date().getTime() - 1);
29+
const expirationDate = new Date(Date.now() - 1);
3030
localStorage.setItem("test", JSON.stringify({ data: true, expirationDate: expirationDate.toISOString() }));
3131
expect(localStorage.length).toBe(1);
3232
expect(getLocalStorageItem("test")).toBeUndefined();

src/lib/localStorage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface LocalStorageItem<T> {
2020
*/
2121
const checkLocalStorageSupport = () => {
2222
if (typeof localStorage === "undefined") {
23-
throw new Error("localStorage not supported");
23+
throw new TypeError("localStorage not supported");
2424
}
2525
};
2626

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
},
2020
"include": ["src", "test"],
2121
"exclude": ["node_modules", "dist", "coverage"],
22-
"files": ["rollup.config.ts", "jest.config.ts"]
22+
"files": ["rollup.config.ts", "jest.config.ts", "eslint.config.ts"]
2323
}

0 commit comments

Comments
 (0)