Skip to content

Commit 31ea799

Browse files
authored
Merge pull request #1814 from authts/chore-2
bump eslint to v9
2 parents 729f955 + 1b635ba commit 31ea799

18 files changed

+603
-887
lines changed

.eslintignore

-7
This file was deleted.

.eslintrc.yml

-69
This file was deleted.

docs/oidc-client-ts.api.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ export class AccessTokenEvents {
1515
addAccessTokenExpired(cb: AccessTokenCallback): () => void;
1616
addAccessTokenExpiring(cb: AccessTokenCallback): () => void;
1717
// (undocumented)
18-
load(container: User): void;
18+
load(container: User): Promise<void>;
1919
// (undocumented)
2020
protected readonly _logger: Logger;
2121
removeAccessTokenExpired(cb: AccessTokenCallback): void;
2222
removeAccessTokenExpiring(cb: AccessTokenCallback): void;
2323
// (undocumented)
24-
unload(): void;
24+
unload(): Promise<void>;
2525
}
2626

2727
// @public (undocumented)

eslint.config.mjs

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import stylistic from "@stylistic/eslint-plugin";
2+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
3+
import testingLibrary from "eslint-plugin-testing-library";
4+
import globals from "globals";
5+
import path from "node:path";
6+
import { fileURLToPath } from "node:url";
7+
import js from "@eslint/js";
8+
import { FlatCompat } from "@eslint/eslintrc";
9+
10+
const __filename = fileURLToPath(import.meta.url);
11+
const __dirname = path.dirname(__filename);
12+
const compat = new FlatCompat({
13+
baseDirectory: __dirname,
14+
recommendedConfig: js.configs.recommended,
15+
allConfig: js.configs.all,
16+
});
17+
18+
export default [{
19+
ignores: [
20+
".yarn/",
21+
".pnp.*",
22+
"**/node_modules/",
23+
"**/dist/",
24+
"docs/pages/",
25+
"**/lib/",
26+
"**/samples/",
27+
],
28+
}, ...compat.extends("eslint:recommended", "plugin:testing-library/dom"), {
29+
plugins: {
30+
"@typescript-eslint": typescriptEslint,
31+
"@stylistic": stylistic,
32+
"testing-library": testingLibrary,
33+
},
34+
35+
languageOptions: {
36+
globals: {
37+
...globals.browser,
38+
...globals.node,
39+
},
40+
41+
ecmaVersion: 2020,
42+
sourceType: "module",
43+
},
44+
45+
rules: {
46+
"comma-dangle": ["error", "always-multiline"],
47+
"consistent-return": "error",
48+
49+
indent: ["error", 4, {
50+
SwitchCase: 1,
51+
}],
52+
53+
quotes: "error",
54+
semi: "error",
55+
"keyword-spacing": "error",
56+
"space-before-blocks": "error",
57+
58+
"no-multiple-empty-lines": ["error", {
59+
max: 1,
60+
maxBOF: 0,
61+
maxEOF: 0,
62+
}],
63+
64+
"no-multi-spaces": "error",
65+
},
66+
}, ...compat.extends(
67+
"plugin:@typescript-eslint/recommended",
68+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
69+
).map(config => ({
70+
...config,
71+
files: ["**/*.ts", "**/*.tsx"],
72+
})), {
73+
files: ["**/*.ts", "**/*.tsx"],
74+
75+
languageOptions: {
76+
parserOptions: {
77+
project: ["./tsconfig.json"],
78+
},
79+
},
80+
81+
rules: {
82+
indent: "off",
83+
semi: "off",
84+
"no-return-await": "off",
85+
86+
"@stylistic/indent": ["error", 4, {
87+
SwitchCase: 1,
88+
}],
89+
90+
"@stylistic/member-delimiter-style": "error",
91+
"@stylistic/object-curly-spacing": ["error", "always"],
92+
"@stylistic/semi": "error",
93+
94+
"@typescript-eslint/return-await": ["error", "always"],
95+
"@typescript-eslint/require-await": "off",
96+
"@typescript-eslint/no-unsafe-argument": "off",
97+
"@typescript-eslint/no-unsafe-assignment": "off",
98+
},
99+
}, {
100+
files: ["src/**/*"],
101+
102+
languageOptions: {
103+
globals: {
104+
...Object.fromEntries(Object.entries(globals.node).map(([key]) => [key, "off"])),
105+
},
106+
},
107+
}, {
108+
files: ["src/**/*.test.*", "test/**/*"],
109+
110+
languageOptions: {
111+
globals: {
112+
...globals.jest,
113+
},
114+
},
115+
116+
rules: {
117+
"@typescript-eslint/no-non-null-assertion": "off",
118+
"@typescript-eslint/unbound-method": "off",
119+
},
120+
}];

jest-environment-jsdom.cjs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
'use strict';
1+
"use strict";
22

3-
const { TextEncoder, TextDecoder } = require('util');
4-
const { default: $JSDOMEnvironment, TestEnvironment } = require('jest-environment-jsdom');
3+
const { TextEncoder, TextDecoder } = require("util");
4+
const { default: $JSDOMEnvironment, TestEnvironment } = require("jest-environment-jsdom");
55
const crypto = require("crypto");
66

7-
Object.defineProperty(exports, '__esModule', {
8-
value: true
7+
Object.defineProperty(exports, "__esModule", {
8+
value: true,
99
});
1010

1111
class JSDOMEnvironment extends $JSDOMEnvironment {

jest.config.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default {
1111
collectCoverage,
1212
coverageReporters: collectCoverage ? ["lcov"] : ["lcov", "text"],
1313
moduleNameMapper: {
14-
"^jose": "jose", // map to jose cjs module otherwise jest breaks
14+
"^jose": "jose", // map to jose cjs module otherwise jest breaks
1515
},
1616
transform: {
1717
"^.+\\.tsx?$": [

0 commit comments

Comments
 (0)