Skip to content

Commit

Permalink
Bump ESLint and related deps to v8 (#1222)
Browse files Browse the repository at this point in the history
* 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] <support@github.com>

* Update ESLint deps

* Drop Node v16 support in CI

* Reformat with prettier

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Artur Müller <me@arturmuller.com>
  • Loading branch information
dependabot[bot] and arturmuller committed Mar 11, 2024
1 parent 4a812f8 commit a316560
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 93 deletions.
27 changes: 2 additions & 25 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"extends": [
"plugin:import/typescript",
"prettier",
"prettier/@typescript-eslint"
],
"plugins": ["@typescript-eslint", "import", "prettier"],
"extends": ["prettier"],
"plugins": ["@typescript-eslint", "prettier/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
Expand All @@ -19,9 +15,6 @@
"mocha": true,
"node": true
},
"settings": {
"import/extensions": [".js", ".ts"]
},
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
Expand All @@ -30,21 +23,6 @@
"constructor-super": "error",
"dot-notation": ["error", { "allowKeywords": true }],
"eqeqeq": ["error", "smart"],
"import/default": "error",
"import/export": "error",
"import/first": "error",
"import/named": "error",
"import/namespace": "error",
"import/newline-after-import": "error",
"import/no-deprecated": "error",
"import/no-extraneous-dependencies": [
"error",
{ "peerDependencies": true }
],
"import/no-mutable-exports": "error",
"import/no-named-as-default": "error",
"import/no-named-as-default-member": "error",
"import/no-unresolved": "error",
"linebreak-style": "error",
"new-parens": "error",
"no-array-constructor": "error",
Expand Down Expand Up @@ -100,7 +78,6 @@
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"prettier/prettier": "error",
"radix": "error",
"spaced-comment": ["error", "always", { "exceptions": ["-"] }],
"use-isnan": "error",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down
16 changes: 7 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"registry": "https://registry.npmjs.org"
},
"engines": {
"node": ">=14.0.0"
"node": ">=18.0.0"
},
"devDependencies": {
"@babel/cli": "^7.6.3",
Expand All @@ -30,20 +30,18 @@
"@types/lodash": "^4.14.144",
"@types/mocha": "^10.0.0",
"@types/node": "^18.7.14",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"babel-eslint": "^10.0.3",
"eslint": "^7.14.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"is-email": "^1.0.0",
"is-url": "^1.2.4",
"is-uuid": "^1.0.2",
"lodash": "^4.17.15",
"mocha": "^10.0.0",
"np": "^10.0.0",
"prettier": "^2.0.5",
"prettier": "^3.2.5",
"rollup": "^4.12.1",
"typescript": "^4.8.3"
},
Expand Down
6 changes: 3 additions & 3 deletions src/structs/refinements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { toFailures } from '../utils'

export function empty<
T extends string | any[] | Map<any, any> | Set<any>,
S extends any
S extends any,
>(struct: Struct<T, S>): Struct<T, S> {
return refine(struct, 'empty', (value) => {
const size = getSize(value)
Expand Down Expand Up @@ -76,7 +76,7 @@ export function min<T extends number | Date, S extends any>(

export function nonempty<
T extends string | any[] | Map<any, any> | Set<any>,
S extends any
S extends any,
>(struct: Struct<T, S>): Struct<T, S> {
return refine(struct, 'nonempty', (value) => {
const size = getSize(value)
Expand Down Expand Up @@ -108,7 +108,7 @@ export function pattern<T extends string, S extends any>(

export function size<
T extends string | number | Date | any[] | Map<any, any> | Set<any>,
S extends any
S extends any,
>(struct: Struct<T, S>, min: number, max: number = min): Struct<T, S> {
const expected = `Expected a ${struct.type}`
const of = min === max ? `of \`${min}\`` : `between \`${min}\` and \`${max}\``
Expand Down
6 changes: 3 additions & 3 deletions src/structs/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function assign<A extends ObjectSchema, B extends ObjectSchema>(
export function assign<
A extends ObjectSchema,
B extends ObjectSchema,
C extends ObjectSchema
C extends ObjectSchema,
>(
A: Struct<ObjectType<A>, A>,
B: Struct<ObjectType<B>, B>,
Expand All @@ -26,7 +26,7 @@ export function assign<
A extends ObjectSchema,
B extends ObjectSchema,
C extends ObjectSchema,
D extends ObjectSchema
D extends ObjectSchema,
>(
A: Struct<ObjectType<A>, A>,
B: Struct<ObjectType<B>, B>,
Expand All @@ -41,7 +41,7 @@ export function assign<
B extends ObjectSchema,
C extends ObjectSchema,
D extends ObjectSchema,
E extends ObjectSchema
E extends ObjectSchema,
>(
A: Struct<ObjectType<A>, A>,
B: Struct<ObjectType<B>, B>,
Expand Down
99 changes: 49 additions & 50 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,10 @@ export type IsMatch<T, G> = T extends G ? (G extends T ? T : never) : never
* Check if a type is an exact match.
*/

export type IsExactMatch<T, U> = (<G>() => G extends T ? 1 : 2) extends <
G
>() => G extends U ? 1 : 2
? T
: never
export type IsExactMatch<T, U> =
(<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2
? T
: never

/**
* Check if a type is a record type.
Expand All @@ -258,14 +257,14 @@ export type IsRecord<T> = T extends object
export type IsTuple<T> = T extends [any]
? T
: T extends [any, any]
? T
: T extends [any, any, any]
? T
: T extends [any, any, any, any]
? T
: T extends [any, any, any, any, any]
? T
: never
? T
: T extends [any, any, any]
? T
: T extends [any, any, any, any]
? T
: T extends [any, any, any, any, any]
? T
: never

/**
* Check if a type is a union.
Expand Down Expand Up @@ -342,42 +341,42 @@ export type StructSchema<T> = [T] extends [string | undefined | null]
? [T] extends [IsMatch<T, string | undefined | null>]
? null
: [T] extends [IsUnion<T>]
? EnumSchema<T>
: T
? EnumSchema<T>
: T
: [T] extends [number | undefined | null]
? [T] extends [IsMatch<T, number | undefined | null>]
? null
: [T] extends [IsUnion<T>]
? EnumSchema<T>
: T
: [T] extends [boolean]
? [T] extends [IsExactMatch<T, boolean>]
? null
: T
: T extends
| bigint
| symbol
| undefined
| null
| Function
| Date
| Error
| RegExp
| Map<any, any>
| WeakMap<any, any>
| Set<any>
| WeakSet<any>
| Promise<any>
? null
: T extends Array<infer E>
? T extends IsTuple<T>
? null
: Struct<E>
: T extends object
? T extends IsRecord<T>
? null
: { [K in keyof T]: Describe<T[K]> }
: null
? [T] extends [IsMatch<T, number | undefined | null>]
? null
: [T] extends [IsUnion<T>]
? EnumSchema<T>
: T
: [T] extends [boolean]
? [T] extends [IsExactMatch<T, boolean>]
? null
: T
: T extends
| bigint
| symbol
| undefined
| null
| Function
| Date
| Error
| RegExp
| Map<any, any>
| WeakMap<any, any>
| Set<any>
| WeakSet<any>
| Promise<any>
? null
: T extends Array<infer E>
? T extends IsTuple<T>
? null
: Struct<E>
: T extends object
? T extends IsRecord<T>
? null
: { [K in keyof T]: Describe<T[K]> }
: null

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

export type InferStructTuple<
Tuple extends AnyStruct[],
Length extends number = Tuple['length']
Length extends number = Tuple['length'],
> = Length extends Length
? number extends Length
? Tuple
Expand All @@ -410,7 +409,7 @@ type _InferTuple<
Tuple extends AnyStruct[],
Length extends number,
Accumulated extends unknown[],
Index extends number = Accumulated['length']
Index extends number = Accumulated['length'],
> = Index extends Length
? Accumulated
: _InferTuple<Tuple, Length, [...Accumulated, Infer<Tuple[Index]>]>
1 change: 0 additions & 1 deletion test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { basename, extname, resolve } from 'path'
import {
any,
assert as assertValue,
// eslint-disable-next-line import/named
Context,
create as createValue,
deprecated,
Expand Down
2 changes: 1 addition & 1 deletion test/typings/tuple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test<
'38',
'39',
'40',
'41'
'41',
]
>((x) => {
assert(
Expand Down

0 comments on commit a316560

Please sign in to comment.