Skip to content

Commit a316560

Browse files
Bump ESLint and related deps to v8 (#1222)
* Bump eslint from 7.32.0 to 8.57.0 Bumps [eslint](https://github.com/eslint/eslint) from 7.32.0 to 8.57.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](eslint/eslint@v7.32.0...v8.57.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Update ESLint deps * Drop Node v16 support in CI * Reformat with prettier --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Artur Müller <[email protected]>
1 parent 4a812f8 commit a316560

File tree

8 files changed

+66
-93
lines changed

8 files changed

+66
-93
lines changed

.eslintrc

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
{
2-
"extends": [
3-
"plugin:import/typescript",
4-
"prettier",
5-
"prettier/@typescript-eslint"
6-
],
7-
"plugins": ["@typescript-eslint", "import", "prettier"],
2+
"extends": ["prettier"],
3+
"plugins": ["@typescript-eslint", "prettier/recommended"],
84
"parser": "@typescript-eslint/parser",
95
"parserOptions": {
106
"sourceType": "module",
@@ -19,9 +15,6 @@
1915
"mocha": true,
2016
"node": true
2117
},
22-
"settings": {
23-
"import/extensions": [".js", ".ts"]
24-
},
2518
"rules": {
2619
"@typescript-eslint/no-unused-vars": [
2720
"error",
@@ -30,21 +23,6 @@
3023
"constructor-super": "error",
3124
"dot-notation": ["error", { "allowKeywords": true }],
3225
"eqeqeq": ["error", "smart"],
33-
"import/default": "error",
34-
"import/export": "error",
35-
"import/first": "error",
36-
"import/named": "error",
37-
"import/namespace": "error",
38-
"import/newline-after-import": "error",
39-
"import/no-deprecated": "error",
40-
"import/no-extraneous-dependencies": [
41-
"error",
42-
{ "peerDependencies": true }
43-
],
44-
"import/no-mutable-exports": "error",
45-
"import/no-named-as-default": "error",
46-
"import/no-named-as-default-member": "error",
47-
"import/no-unresolved": "error",
4826
"linebreak-style": "error",
4927
"new-parens": "error",
5028
"no-array-constructor": "error",
@@ -100,7 +78,6 @@
10078
"prefer-rest-params": "error",
10179
"prefer-spread": "error",
10280
"prefer-template": "error",
103-
"prettier/prettier": "error",
10481
"radix": "error",
10582
"spaced-comment": ["error", "always", { "exceptions": ["-"] }],
10683
"use-isnan": "error",

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
runs-on: ubuntu-latest
66
strategy:
77
matrix:
8-
node-version: [16.x, 18.x, 20.x]
8+
node-version: [18.x, 20.x]
99
steps:
1010
- uses: actions/checkout@v4
1111
- uses: actions/setup-node@v4

package.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"registry": "https://registry.npmjs.org"
1717
},
1818
"engines": {
19-
"node": ">=14.0.0"
19+
"node": ">=18.0.0"
2020
},
2121
"devDependencies": {
2222
"@babel/cli": "^7.6.3",
@@ -30,20 +30,18 @@
3030
"@types/lodash": "^4.14.144",
3131
"@types/mocha": "^10.0.0",
3232
"@types/node": "^18.7.14",
33-
"@typescript-eslint/eslint-plugin": "^5.43.0",
34-
"@typescript-eslint/parser": "^5.43.0",
35-
"babel-eslint": "^10.0.3",
36-
"eslint": "^7.14.0",
37-
"eslint-config-prettier": "^7.2.0",
38-
"eslint-plugin-import": "^2.22.1",
39-
"eslint-plugin-prettier": "^4.0.0",
33+
"@typescript-eslint/eslint-plugin": "^7.1.1",
34+
"@typescript-eslint/parser": "^7.1.1",
35+
"eslint": "^8.57.0",
36+
"eslint-config-prettier": "^9.1.0",
37+
"eslint-plugin-prettier": "^5.1.3",
4038
"is-email": "^1.0.0",
4139
"is-url": "^1.2.4",
4240
"is-uuid": "^1.0.2",
4341
"lodash": "^4.17.15",
4442
"mocha": "^10.0.0",
4543
"np": "^10.0.0",
46-
"prettier": "^2.0.5",
44+
"prettier": "^3.2.5",
4745
"rollup": "^4.12.1",
4846
"typescript": "^4.8.3"
4947
},

src/structs/refinements.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { toFailures } from '../utils'
77

88
export function empty<
99
T extends string | any[] | Map<any, any> | Set<any>,
10-
S extends any
10+
S extends any,
1111
>(struct: Struct<T, S>): Struct<T, S> {
1212
return refine(struct, 'empty', (value) => {
1313
const size = getSize(value)
@@ -76,7 +76,7 @@ export function min<T extends number | Date, S extends any>(
7676

7777
export function nonempty<
7878
T extends string | any[] | Map<any, any> | Set<any>,
79-
S extends any
79+
S extends any,
8080
>(struct: Struct<T, S>): Struct<T, S> {
8181
return refine(struct, 'nonempty', (value) => {
8282
const size = getSize(value)
@@ -108,7 +108,7 @@ export function pattern<T extends string, S extends any>(
108108

109109
export function size<
110110
T extends string | number | Date | any[] | Map<any, any> | Set<any>,
111-
S extends any
111+
S extends any,
112112
>(struct: Struct<T, S>, min: number, max: number = min): Struct<T, S> {
113113
const expected = `Expected a ${struct.type}`
114114
const of = min === max ? `of \`${min}\`` : `between \`${min}\` and \`${max}\``

src/structs/utilities.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function assign<A extends ObjectSchema, B extends ObjectSchema>(
1616
export function assign<
1717
A extends ObjectSchema,
1818
B extends ObjectSchema,
19-
C extends ObjectSchema
19+
C extends ObjectSchema,
2020
>(
2121
A: Struct<ObjectType<A>, A>,
2222
B: Struct<ObjectType<B>, B>,
@@ -26,7 +26,7 @@ export function assign<
2626
A extends ObjectSchema,
2727
B extends ObjectSchema,
2828
C extends ObjectSchema,
29-
D extends ObjectSchema
29+
D extends ObjectSchema,
3030
>(
3131
A: Struct<ObjectType<A>, A>,
3232
B: Struct<ObjectType<B>, B>,
@@ -41,7 +41,7 @@ export function assign<
4141
B extends ObjectSchema,
4242
C extends ObjectSchema,
4343
D extends ObjectSchema,
44-
E extends ObjectSchema
44+
E extends ObjectSchema,
4545
>(
4646
A: Struct<ObjectType<A>, A>,
4747
B: Struct<ObjectType<B>, B>,

src/utils.ts

Lines changed: 49 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,10 @@ export type IsMatch<T, G> = T extends G ? (G extends T ? T : never) : never
236236
* Check if a type is an exact match.
237237
*/
238238

239-
export type IsExactMatch<T, U> = (<G>() => G extends T ? 1 : 2) extends <
240-
G
241-
>() => G extends U ? 1 : 2
242-
? T
243-
: never
239+
export type IsExactMatch<T, U> =
240+
(<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2
241+
? T
242+
: never
244243

245244
/**
246245
* Check if a type is a record type.
@@ -258,14 +257,14 @@ export type IsRecord<T> = T extends object
258257
export type IsTuple<T> = T extends [any]
259258
? T
260259
: T extends [any, any]
261-
? T
262-
: T extends [any, any, any]
263-
? T
264-
: T extends [any, any, any, any]
265-
? T
266-
: T extends [any, any, any, any, any]
267-
? T
268-
: never
260+
? T
261+
: T extends [any, any, any]
262+
? T
263+
: T extends [any, any, any, any]
264+
? T
265+
: T extends [any, any, any, any, any]
266+
? T
267+
: never
269268

270269
/**
271270
* Check if a type is a union.
@@ -342,42 +341,42 @@ export type StructSchema<T> = [T] extends [string | undefined | null]
342341
? [T] extends [IsMatch<T, string | undefined | null>]
343342
? null
344343
: [T] extends [IsUnion<T>]
345-
? EnumSchema<T>
346-
: T
344+
? EnumSchema<T>
345+
: T
347346
: [T] extends [number | undefined | null]
348-
? [T] extends [IsMatch<T, number | undefined | null>]
349-
? null
350-
: [T] extends [IsUnion<T>]
351-
? EnumSchema<T>
352-
: T
353-
: [T] extends [boolean]
354-
? [T] extends [IsExactMatch<T, boolean>]
355-
? null
356-
: T
357-
: T extends
358-
| bigint
359-
| symbol
360-
| undefined
361-
| null
362-
| Function
363-
| Date
364-
| Error
365-
| RegExp
366-
| Map<any, any>
367-
| WeakMap<any, any>
368-
| Set<any>
369-
| WeakSet<any>
370-
| Promise<any>
371-
? null
372-
: T extends Array<infer E>
373-
? T extends IsTuple<T>
374-
? null
375-
: Struct<E>
376-
: T extends object
377-
? T extends IsRecord<T>
378-
? null
379-
: { [K in keyof T]: Describe<T[K]> }
380-
: null
347+
? [T] extends [IsMatch<T, number | undefined | null>]
348+
? null
349+
: [T] extends [IsUnion<T>]
350+
? EnumSchema<T>
351+
: T
352+
: [T] extends [boolean]
353+
? [T] extends [IsExactMatch<T, boolean>]
354+
? null
355+
: T
356+
: T extends
357+
| bigint
358+
| symbol
359+
| undefined
360+
| null
361+
| Function
362+
| Date
363+
| Error
364+
| RegExp
365+
| Map<any, any>
366+
| WeakMap<any, any>
367+
| Set<any>
368+
| WeakSet<any>
369+
| Promise<any>
370+
? null
371+
: T extends Array<infer E>
372+
? T extends IsTuple<T>
373+
? null
374+
: Struct<E>
375+
: T extends object
376+
? T extends IsRecord<T>
377+
? null
378+
: { [K in keyof T]: Describe<T[K]> }
379+
: null
381380

382381
/**
383382
* A schema for tuple structs.
@@ -400,7 +399,7 @@ export type AnyStruct = Struct<any, any>
400399

401400
export type InferStructTuple<
402401
Tuple extends AnyStruct[],
403-
Length extends number = Tuple['length']
402+
Length extends number = Tuple['length'],
404403
> = Length extends Length
405404
? number extends Length
406405
? Tuple
@@ -410,7 +409,7 @@ type _InferTuple<
410409
Tuple extends AnyStruct[],
411410
Length extends number,
412411
Accumulated extends unknown[],
413-
Index extends number = Accumulated['length']
412+
Index extends number = Accumulated['length'],
414413
> = Index extends Length
415414
? Accumulated
416415
: _InferTuple<Tuple, Length, [...Accumulated, Infer<Tuple[Index]>]>

test/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { basename, extname, resolve } from 'path'
55
import {
66
any,
77
assert as assertValue,
8-
// eslint-disable-next-line import/named
98
Context,
109
create as createValue,
1110
deprecated,

test/typings/tuple.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ test<
4949
'38',
5050
'39',
5151
'40',
52-
'41'
52+
'41',
5353
]
5454
>((x) => {
5555
assert(

0 commit comments

Comments
 (0)