From a3165607d90418a12668601a3007d7533ba21e11 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 15:48:31 +0100 Subject: [PATCH] Bump ESLint and related deps to v8 (#1222) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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](https://github.com/eslint/eslint/compare/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] * Update ESLint deps * Drop Node v16 support in CI * Reformat with prettier --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Artur Müller --- .eslintrc | 27 +---------- .github/workflows/ci.yml | 2 +- package.json | 16 +++--- src/structs/refinements.ts | 6 +-- src/structs/utilities.ts | 6 +-- src/utils.ts | 99 +++++++++++++++++++------------------- test/index.ts | 1 - test/typings/tuple.ts | 2 +- 8 files changed, 66 insertions(+), 93 deletions(-) diff --git a/.eslintrc b/.eslintrc index 85e957da..6635d412 100644 --- a/.eslintrc +++ b/.eslintrc @@ -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", @@ -19,9 +15,6 @@ "mocha": true, "node": true }, - "settings": { - "import/extensions": [".js", ".ts"] - }, "rules": { "@typescript-eslint/no-unused-vars": [ "error", @@ -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", @@ -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", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c466ed5..ad3c0a2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/package.json b/package.json index d76b6638..79c46408 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "registry": "https://registry.npmjs.org" }, "engines": { - "node": ">=14.0.0" + "node": ">=18.0.0" }, "devDependencies": { "@babel/cli": "^7.6.3", @@ -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" }, diff --git a/src/structs/refinements.ts b/src/structs/refinements.ts index e3f7736d..a99621ee 100644 --- a/src/structs/refinements.ts +++ b/src/structs/refinements.ts @@ -7,7 +7,7 @@ import { toFailures } from '../utils' export function empty< T extends string | any[] | Map | Set, - S extends any + S extends any, >(struct: Struct): Struct { return refine(struct, 'empty', (value) => { const size = getSize(value) @@ -76,7 +76,7 @@ export function min( export function nonempty< T extends string | any[] | Map | Set, - S extends any + S extends any, >(struct: Struct): Struct { return refine(struct, 'nonempty', (value) => { const size = getSize(value) @@ -108,7 +108,7 @@ export function pattern( export function size< T extends string | number | Date | any[] | Map | Set, - S extends any + S extends any, >(struct: Struct, min: number, max: number = min): Struct { const expected = `Expected a ${struct.type}` const of = min === max ? `of \`${min}\`` : `between \`${min}\` and \`${max}\`` diff --git a/src/structs/utilities.ts b/src/structs/utilities.ts index d2162a3d..7b27da49 100644 --- a/src/structs/utilities.ts +++ b/src/structs/utilities.ts @@ -16,7 +16,7 @@ export function assign( export function assign< A extends ObjectSchema, B extends ObjectSchema, - C extends ObjectSchema + C extends ObjectSchema, >( A: Struct, A>, B: Struct, B>, @@ -26,7 +26,7 @@ export function assign< A extends ObjectSchema, B extends ObjectSchema, C extends ObjectSchema, - D extends ObjectSchema + D extends ObjectSchema, >( A: Struct, A>, B: Struct, B>, @@ -41,7 +41,7 @@ export function assign< B extends ObjectSchema, C extends ObjectSchema, D extends ObjectSchema, - E extends ObjectSchema + E extends ObjectSchema, >( A: Struct, A>, B: Struct, B>, diff --git a/src/utils.ts b/src/utils.ts index 92df9755..c6a022e0 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -236,11 +236,10 @@ export type IsMatch = T extends G ? (G extends T ? T : never) : never * Check if a type is an exact match. */ -export type IsExactMatch = (() => G extends T ? 1 : 2) extends < - G ->() => G extends U ? 1 : 2 - ? T - : never +export type IsExactMatch = + (() => G extends T ? 1 : 2) extends () => G extends U ? 1 : 2 + ? T + : never /** * Check if a type is a record type. @@ -258,14 +257,14 @@ export type IsRecord = T extends object export type IsTuple = 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. @@ -342,42 +341,42 @@ export type StructSchema = [T] extends [string | undefined | null] ? [T] extends [IsMatch] ? null : [T] extends [IsUnion] - ? EnumSchema - : T + ? EnumSchema + : T : [T] extends [number | undefined | null] - ? [T] extends [IsMatch] - ? null - : [T] extends [IsUnion] - ? EnumSchema - : T - : [T] extends [boolean] - ? [T] extends [IsExactMatch] - ? null - : T - : T extends - | bigint - | symbol - | undefined - | null - | Function - | Date - | Error - | RegExp - | Map - | WeakMap - | Set - | WeakSet - | Promise - ? null - : T extends Array - ? T extends IsTuple - ? null - : Struct - : T extends object - ? T extends IsRecord - ? null - : { [K in keyof T]: Describe } - : null + ? [T] extends [IsMatch] + ? null + : [T] extends [IsUnion] + ? EnumSchema + : T + : [T] extends [boolean] + ? [T] extends [IsExactMatch] + ? null + : T + : T extends + | bigint + | symbol + | undefined + | null + | Function + | Date + | Error + | RegExp + | Map + | WeakMap + | Set + | WeakSet + | Promise + ? null + : T extends Array + ? T extends IsTuple + ? null + : Struct + : T extends object + ? T extends IsRecord + ? null + : { [K in keyof T]: Describe } + : null /** * A schema for tuple structs. @@ -400,7 +399,7 @@ export type AnyStruct = Struct export type InferStructTuple< Tuple extends AnyStruct[], - Length extends number = Tuple['length'] + Length extends number = Tuple['length'], > = Length extends Length ? number extends Length ? Tuple @@ -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]> diff --git a/test/index.ts b/test/index.ts index c63f45a0..2d4bc819 100644 --- a/test/index.ts +++ b/test/index.ts @@ -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, diff --git a/test/typings/tuple.ts b/test/typings/tuple.ts index 4889083b..816a8540 100644 --- a/test/typings/tuple.ts +++ b/test/typings/tuple.ts @@ -49,7 +49,7 @@ test< '38', '39', '40', - '41' + '41', ] >((x) => { assert(