From 4f51bc3bf8022cba7fd9d2b4185999455ba2292d Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 13 Feb 2023 16:24:57 +1030 Subject: [PATCH 1/8] feat: add package.json exports for public packages --- packages/eslint-plugin-tslint/package.json | 9 +- packages/eslint-plugin/package.json | 2 +- .../eslint-plugin/src/rules/await-thenable.ts | 2 +- .../eslint-plugin/src/rules/dot-notation.ts | 2 +- .../src/rules/no-confusing-void-expression.ts | 2 +- .../src/rules/no-dynamic-delete.ts | 2 +- .../src/rules/no-floating-promises.ts | 2 +- .../src/rules/no-implied-eval.ts | 2 +- .../src/rules/no-meaningless-void-operator.ts | 2 +- .../src/rules/no-misused-promises.ts | 2 +- .../rules/no-redundant-type-constituents.ts | 2 +- .../no-unnecessary-boolean-literal-compare.ts | 2 +- .../src/rules/no-unnecessary-condition.ts | 2 +- .../src/rules/no-unnecessary-qualifier.ts | 2 +- .../rules/no-unnecessary-type-arguments.ts | 2 +- .../rules/no-unnecessary-type-assertion.ts | 2 +- .../src/rules/no-unsafe-assignment.ts | 2 +- .../eslint-plugin/src/rules/no-unsafe-call.ts | 2 +- .../src/rules/no-unsafe-member-access.ts | 2 +- .../src/rules/no-unsafe-return.ts | 2 +- .../non-nullable-type-assertion-style.ts | 2 +- .../src/rules/prefer-nullish-coalescing.ts | 2 +- .../src/rules/prefer-readonly.ts | 2 +- .../src/rules/prefer-regexp-exec.ts | 2 +- .../eslint-plugin/src/rules/require-await.ts | 2 +- .../eslint-plugin/src/rules/return-await.ts | 2 +- .../src/rules/strict-boolean-expressions.ts | 2 +- .../src/rules/switch-exhaustiveness-check.ts | 2 +- .../eslint-plugin/src/rules/unbound-method.ts | 2 +- packages/experimental-utils/CHANGELOG.md | 1046 ----------------- packages/experimental-utils/LICENSE | 21 - packages/experimental-utils/README.md | 22 - packages/experimental-utils/jest.config.js | 8 - packages/experimental-utils/package.json | 54 - packages/experimental-utils/project.json | 15 - packages/experimental-utils/src/index.ts | 8 - .../tests/consoleWarning.test.ts | 10 - .../experimental-utils/tsconfig.build.json | 15 - packages/experimental-utils/tsconfig.json | 13 - packages/parser/package.json | 23 +- packages/scope-manager/package.json | 39 +- packages/type-utils/package.json | 41 +- .../type-utils/src/containsAllTypesByName.ts | 2 +- packages/type-utils/src/getContextualType.ts | 2 +- packages/type-utils/src/isTypeReadonly.ts | 2 +- packages/type-utils/src/isUnsafeAssignment.ts | 2 +- packages/type-utils/src/predicates.ts | 2 +- packages/type-utils/src/typeFlagUtils.ts | 2 +- packages/types/package.json | 38 +- packages/typescript-estree/package.json | 25 +- .../typescript-estree/src/convert-comments.ts | 2 +- packages/utils/package.json | 55 +- packages/visitor-keys/package.json | 39 +- tools/postinstall.ts | 10 +- tsconfig.base.json | 4 +- yarn.lock | 15 +- 56 files changed, 213 insertions(+), 1367 deletions(-) delete mode 100644 packages/experimental-utils/CHANGELOG.md delete mode 100644 packages/experimental-utils/LICENSE delete mode 100644 packages/experimental-utils/README.md delete mode 100644 packages/experimental-utils/jest.config.js delete mode 100644 packages/experimental-utils/package.json delete mode 100644 packages/experimental-utils/project.json delete mode 100644 packages/experimental-utils/src/index.ts delete mode 100644 packages/experimental-utils/tests/consoleWarning.test.ts delete mode 100644 packages/experimental-utils/tsconfig.build.json delete mode 100644 packages/experimental-utils/tsconfig.json diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index be9c8bb88575..e07880ff6f77 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,8 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", "version": "5.51.0", - "main": "dist/index.js", - "typings": "src/index.ts", "description": "ESLint plugin that wraps a TSLint configuration and lints the whole source using TSLint", "keywords": [ "eslint", @@ -10,6 +8,13 @@ "eslint-plugin", "tslint" ], + "type": "commonjs", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "require": "./dist/index.js" + } + }, "engines": { "node": "^14.18.0 || ^16.0.0 || >=18.0.0" }, diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 781ee37a54ee..c8a2a2cb3409 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -53,7 +53,7 @@ "natural-compare-lite": "^1.4.0", "regexpp": "^3.2.0", "semver": "^7.3.7", - "ts-api-tools": "^0.0.15" + "ts-api-utils": "^0.0.21" }, "devDependencies": { "@types/debug": "*", diff --git a/packages/eslint-plugin/src/rules/await-thenable.ts b/packages/eslint-plugin/src/rules/await-thenable.ts index 336789905220..940ddb756629 100644 --- a/packages/eslint-plugin/src/rules/await-thenable.ts +++ b/packages/eslint-plugin/src/rules/await-thenable.ts @@ -1,4 +1,4 @@ -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/dot-notation.ts b/packages/eslint-plugin/src/rules/dot-notation.ts index df6a502115dc..ad69d93d83ff 100644 --- a/packages/eslint-plugin/src/rules/dot-notation.ts +++ b/packages/eslint-plugin/src/rules/dot-notation.ts @@ -1,5 +1,5 @@ import type { TSESTree } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import type { diff --git a/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts b/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts index 77bdb724ef9e..0567ea810b96 100644 --- a/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts +++ b/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts @@ -1,6 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/no-dynamic-delete.ts b/packages/eslint-plugin/src/rules/no-dynamic-delete.ts index 325508ff9b60..6cf68bf2764b 100644 --- a/packages/eslint-plugin/src/rules/no-dynamic-delete.ts +++ b/packages/eslint-plugin/src/rules/no-dynamic-delete.ts @@ -1,6 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/no-floating-promises.ts b/packages/eslint-plugin/src/rules/no-floating-promises.ts index 21006caf1373..126b0a0188ad 100644 --- a/packages/eslint-plugin/src/rules/no-floating-promises.ts +++ b/packages/eslint-plugin/src/rules/no-floating-promises.ts @@ -1,6 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/no-implied-eval.ts b/packages/eslint-plugin/src/rules/no-implied-eval.ts index f14742a3c7a4..b0a97efb69c3 100644 --- a/packages/eslint-plugin/src/rules/no-implied-eval.ts +++ b/packages/eslint-plugin/src/rules/no-implied-eval.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts b/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts index 7cfb1822fc72..528344ea6996 100644 --- a/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts +++ b/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts @@ -1,6 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { ESLintUtils } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/no-misused-promises.ts b/packages/eslint-plugin/src/rules/no-misused-promises.ts index 21f325396031..b26f638743a4 100644 --- a/packages/eslint-plugin/src/rules/no-misused-promises.ts +++ b/packages/eslint-plugin/src/rules/no-misused-promises.ts @@ -1,6 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts b/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts index ae5af074b0b2..b19186fc8cdc 100644 --- a/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts +++ b/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts @@ -1,5 +1,5 @@ import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-boolean-literal-compare.ts b/packages/eslint-plugin/src/rules/no-unnecessary-boolean-literal-compare.ts index 36cdd33f7ef7..c88ac20675b4 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-boolean-literal-compare.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-boolean-literal-compare.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts index e9de767edb90..b060ba86cd60 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import { diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts index 56c491e05b01..34675bc4f8e8 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts index 2508b0ddaf7d..beeea4597178 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts @@ -1,5 +1,5 @@ import type { TSESTree } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts index 6dc0cefabdcf..c484fe633f03 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts b/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts index c3e3d432f363..ec7660d4f22f 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import type * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/no-unsafe-call.ts b/packages/eslint-plugin/src/rules/no-unsafe-call.ts index 9b2c08cb10e8..6bee12156940 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-call.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-call.ts @@ -1,5 +1,5 @@ import type { TSESTree } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as util from '../util'; import { getThisExpression } from '../util'; diff --git a/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts b/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts index cc8f57bb4f3d..ca9174b99be1 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as util from '../util'; import { getThisExpression } from '../util'; diff --git a/packages/eslint-plugin/src/rules/no-unsafe-return.ts b/packages/eslint-plugin/src/rules/no-unsafe-return.ts index dc10a68b73b7..033aec99c9aa 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-return.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-return.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as util from '../util'; import { getThisExpression } from '../util'; diff --git a/packages/eslint-plugin/src/rules/non-nullable-type-assertion-style.ts b/packages/eslint-plugin/src/rules/non-nullable-type-assertion-style.ts index bda463dd7d98..70b256455246 100644 --- a/packages/eslint-plugin/src/rules/non-nullable-type-assertion-style.ts +++ b/packages/eslint-plugin/src/rules/non-nullable-type-assertion-style.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts b/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts index af72186360ca..d4078a87e063 100644 --- a/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts +++ b/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts @@ -1,6 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index 931fae7f6e01..5a22a3f95d71 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES, ASTUtils } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts index df72cfda39a1..4d5b858dc2ce 100644 --- a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts +++ b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import type * as ts from 'typescript'; import { diff --git a/packages/eslint-plugin/src/rules/require-await.ts b/packages/eslint-plugin/src/rules/require-await.ts index 96d1f741e8dd..c70af4e99723 100644 --- a/packages/eslint-plugin/src/rules/require-await.ts +++ b/packages/eslint-plugin/src/rules/require-await.ts @@ -1,6 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import type * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/return-await.ts b/packages/eslint-plugin/src/rules/return-await.ts index ce71a6bf5062..8bf64156ce66 100644 --- a/packages/eslint-plugin/src/rules/return-await.ts +++ b/packages/eslint-plugin/src/rules/return-await.ts @@ -1,6 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts index 6425ea8bbfb9..105e30305d4b 100644 --- a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts +++ b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts @@ -3,7 +3,7 @@ import type { TSESTree, } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/switch-exhaustiveness-check.ts b/packages/eslint-plugin/src/rules/switch-exhaustiveness-check.ts index 4a5e1f7bf53d..6f85e4818ea1 100644 --- a/packages/eslint-plugin/src/rules/switch-exhaustiveness-check.ts +++ b/packages/eslint-plugin/src/rules/switch-exhaustiveness-check.ts @@ -1,5 +1,5 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import { diff --git a/packages/eslint-plugin/src/rules/unbound-method.ts b/packages/eslint-plugin/src/rules/unbound-method.ts index 1e44957ed811..966664d9d6a6 100644 --- a/packages/eslint-plugin/src/rules/unbound-method.ts +++ b/packages/eslint-plugin/src/rules/unbound-method.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md deleted file mode 100644 index ddc32b003c5b..000000000000 --- a/packages/experimental-utils/CHANGELOG.md +++ /dev/null @@ -1,1046 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [5.51.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.50.0...v5.51.0) (2023-02-06) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.50.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.49.0...v5.50.0) (2023-01-31) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.49.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.2...v5.49.0) (2023-01-23) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [5.48.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.1...v5.48.2) (2023-01-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [5.48.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.0...v5.48.1) (2023-01-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.48.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.47.1...v5.48.0) (2023-01-02) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.47.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.47.0...v5.47.1) (2022-12-26) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.47.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.1...v5.47.0) (2022-12-19) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## 5.30.1 (2022-07-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) - -### Features - -- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) - -# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) - -### Features - -- rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) - -## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) - -### Features - -- **experimental-utils:** move isTypeReadonly from eslint-plugin to experimental-utils ([#3658](https://github.com/typescript-eslint/typescript-eslint/issues/3658)) ([a9eb0b9](https://github.com/typescript-eslint/typescript-eslint/commit/a9eb0b9eb2db291ea36065ec34f84bf5c5504b43)) - -## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) - -### Bug Fixes - -- **experimental-utils:** support immutable members ([#3844](https://github.com/typescript-eslint/typescript-eslint/issues/3844)) ([3d33a77](https://github.com/typescript-eslint/typescript-eslint/commit/3d33a77c57e5b752edf6f35ed152038bdb230b79)) - -# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) - -### Bug Fixes - -- **experimental-utils:** export RuleCreator interfaces ([#4199](https://github.com/typescript-eslint/typescript-eslint/issues/4199)) ([7821e4c](https://github.com/typescript-eslint/typescript-eslint/commit/7821e4c515ca2f11a14dcfa94dc77370da0287c5)) -- **experimental-utils:** fix types for eslint-utils ([#4173](https://github.com/typescript-eslint/typescript-eslint/issues/4173)) ([7079de2](https://github.com/typescript-eslint/typescript-eslint/commit/7079de26877a2313a7019845d4c33d0fc4d4b4a9)) - -# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) - -### Features - -- add RuleCreator.withoutDocs ([#4136](https://github.com/typescript-eslint/typescript-eslint/issues/4136)) ([87cfc6a](https://github.com/typescript-eslint/typescript-eslint/commit/87cfc6ad3e3312d7b6f98a592fb37e69d5d6880a)) -- **experimental-utils:** add default [] for RuleModule TOptions generic ([#4135](https://github.com/typescript-eslint/typescript-eslint/issues/4135)) ([62b8098](https://github.com/typescript-eslint/typescript-eslint/commit/62b8098fa7d361954c170ee6c190e47e95194b13)) - -## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) - -### Bug Fixes - -- **experimental-utils:** add `name` property to test case interface ([#4067](https://github.com/typescript-eslint/typescript-eslint/issues/4067)) ([f3021c9](https://github.com/typescript-eslint/typescript-eslint/commit/f3021c94460e8d06e4169335bcc1a23854531f2a)) - -### Features - -- **experimental-utils:** extract `isTokenOfTypeWithConditions` out of `ast-utils`' `predicates` ([#3977](https://github.com/typescript-eslint/typescript-eslint/issues/3977)) ([5229597](https://github.com/typescript-eslint/typescript-eslint/commit/5229597d9bfc998852c4b4fb421859e8f3d3d688)) - -# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) - -### Features - -- **experimental-utils:** extract `ast-utils`' `predicates`' helpers ([#3976](https://github.com/typescript-eslint/typescript-eslint/issues/3976)) ([154ec9a](https://github.com/typescript-eslint/typescript-eslint/commit/154ec9aea8e81732cafe36af97c4822f1591b077)) - -# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) - -### Bug Fixes - -- **experimental-utils:** fix `isSetter`'s return type ([#3975](https://github.com/typescript-eslint/typescript-eslint/issues/3975)) ([d256856](https://github.com/typescript-eslint/typescript-eslint/commit/d2568561d0417fdfbdfd964ad942f9d00434af73)) - -### Features - -- **ast-spec:** bring `Node` objects in line with ESTree ([#3771](https://github.com/typescript-eslint/typescript-eslint/issues/3771)) ([dd14064](https://github.com/typescript-eslint/typescript-eslint/commit/dd140643b457aa515cc21fcda2b3cd4acc2a1c5c)) -- align class property representation with ESTree ([#3806](https://github.com/typescript-eslint/typescript-eslint/issues/3806)) ([22fa5c0](https://github.com/typescript-eslint/typescript-eslint/commit/22fa5c0c4705ed2898f00b7cacc5dd642d859275)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#3077](https://github.com/typescript-eslint/typescript-eslint/issues/3077) -- remove `meta.docs.category` from rules ([#3800](https://github.com/typescript-eslint/typescript-eslint/issues/3800)) ([71c9370](https://github.com/typescript-eslint/typescript-eslint/commit/71c93706e55f5f92a1285102b93c6ab1950c6df4)) -- remove `TSParenthesizedType` ([#3340](https://github.com/typescript-eslint/typescript-eslint/issues/3340)) ([c8ee432](https://github.com/typescript-eslint/typescript-eslint/commit/c8ee43269faea4c04ec02eaa2b81a0aa6eec5d3e)), closes [#3136](https://github.com/typescript-eslint/typescript-eslint/issues/3136) -- support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) -- **experimental-utils:** extract `isNodeOfTypes` out of `ast-utils`' `predicates` ([#3836](https://github.com/typescript-eslint/typescript-eslint/issues/3836)) ([0cc509b](https://github.com/typescript-eslint/typescript-eslint/commit/0cc509b61df248cfb4b42fe64ec800f3cac69c69)) -- **experimental-utils:** remove `getComments` from `ESLint` `SourceCode` types ([#3766](https://github.com/typescript-eslint/typescript-eslint/issues/3766)) ([165a507](https://github.com/typescript-eslint/typescript-eslint/commit/165a507970d8e4a0ed12abdd5f0d892f7de83ffe)) - -# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) - -### Bug Fixes - -- **experimental-utils:** add `getPhysicalFilename()` to `RuleContext` ([#3934](https://github.com/typescript-eslint/typescript-eslint/issues/3934)) ([ee5dfd4](https://github.com/typescript-eslint/typescript-eslint/commit/ee5dfd4989ab465d65ba3424e36b7f0964558191)) -- **experimental-utils:** require fix in suggestions ([#3949](https://github.com/typescript-eslint/typescript-eslint/issues/3949)) ([f022fb1](https://github.com/typescript-eslint/typescript-eslint/commit/f022fb14c71dad25be2314252eb751964f34fcb8)) - -### Features - -- **experimental-utils:** extract `isNodeOfTypeWithConditions` out of `ast-utils`' `predicates` ([#3837](https://github.com/typescript-eslint/typescript-eslint/issues/3837)) ([214f898](https://github.com/typescript-eslint/typescript-eslint/commit/214f898178ba593146d06a444487d32ec3363854)) - -# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) - -### Bug Fixes - -- **experimental-utils:** add missing signature for `isParenthesized` ([#3887](https://github.com/typescript-eslint/typescript-eslint/issues/3887)) ([806eaac](https://github.com/typescript-eslint/typescript-eslint/commit/806eaac6af5325664634690e9ebd7ffaed276549)) - -## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) - -### Bug Fixes - -- **utils:** support immutable arrays in `ReportFixFunction` ([#3830](https://github.com/typescript-eslint/typescript-eslint/issues/3830)) ([8218055](https://github.com/typescript-eslint/typescript-eslint/commit/8218055d6dfd94c9e6c8645848f981d9d51ce08c)) - -### Features - -- **experimental-utils:** extract `isNodeOfType` out of `ast-utils`' `predicates` ([#3677](https://github.com/typescript-eslint/typescript-eslint/issues/3677)) ([4bfa437](https://github.com/typescript-eslint/typescript-eslint/commit/4bfa4375aff8f65057d4aa116e435803cbc6b464)) - -# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) - -### Features - -- **experimental-utils:** add literal types to `global` option ([#3634](https://github.com/typescript-eslint/typescript-eslint/issues/3634)) ([820965c](https://github.com/typescript-eslint/typescript-eslint/commit/820965c41c58be918770ff6bbae313c0cfc75d3c)) - -## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) - -### Bug Fixes - -- **experimental-utils:** simplify `eslint-utils`' `findVariable`'s signature in `ast-utils` ([#3574](https://github.com/typescript-eslint/typescript-eslint/issues/3574)) ([3ef5267](https://github.com/typescript-eslint/typescript-eslint/commit/3ef5267b850e1ffb7115e263e89a98c455fd2532)) - -### Features - -- **ast-spec:** make `BaseNode` & `BaseToken` more type-safe ([#3560](https://github.com/typescript-eslint/typescript-eslint/issues/3560)) ([a6c5604](https://github.com/typescript-eslint/typescript-eslint/commit/a6c5604b65b6330d047aa016fc46b8a597a6ae58)) - -## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) - -### Bug Fixes - -- **experimental-utils:** expand `RuleTester` config properties ([#3557](https://github.com/typescript-eslint/typescript-eslint/issues/3557)) ([ffbb3cf](https://github.com/typescript-eslint/typescript-eslint/commit/ffbb3cff18bc78467e70e794f9b1f0e79be4aff7)) -- **experimental-utils:** fix `eslint-utils`' negative predicates' return types ([#3462](https://github.com/typescript-eslint/typescript-eslint/issues/3462)) ([1e6016b](https://github.com/typescript-eslint/typescript-eslint/commit/1e6016b356ae40e4636a3cbe41fa02b6a61403ee)) -- **experimental-utils:** fix `eslint-utils`' negative predicates' return types in `ast-utils` ([#3461](https://github.com/typescript-eslint/typescript-eslint/issues/3461)) ([614b0a3](https://github.com/typescript-eslint/typescript-eslint/commit/614b0a38b4163eb4667cce7a415d534222d15dd3)) -- **experimental-utils:** make keys for `ReferenceTracker` options optional ([#3531](https://github.com/typescript-eslint/typescript-eslint/issues/3531)) ([a7fd7bb](https://github.com/typescript-eslint/typescript-eslint/commit/a7fd7bb25584cb3f72f0339025dc76efa6cccceb)) - -### Features - -- **experimental-utils:** add `only` property to `RuleTester` types ([#3555](https://github.com/typescript-eslint/typescript-eslint/issues/3555)) ([2a36e3e](https://github.com/typescript-eslint/typescript-eslint/commit/2a36e3e737f935cc6b967befb022d10a83c8bc9b)) -- **experimental-utils:** expose ReferenceTracker.ESM ([#3532](https://github.com/typescript-eslint/typescript-eslint/issues/3532)) ([4ac67c4](https://github.com/typescript-eslint/typescript-eslint/commit/4ac67c4c9401c5ce0e947a6409efbc11afe1eb3b)) -- **experimental-utils:** use mergable interface for `settings` property ([#3556](https://github.com/typescript-eslint/typescript-eslint/issues/3556)) ([abfc19b](https://github.com/typescript-eslint/typescript-eslint/commit/abfc19bf9364d881bdf594ee166a1deb23240630)) - -# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) - -### Bug Fixes - -- **typescript-estree:** allow providing more one than one existing program in config ([#3508](https://github.com/typescript-eslint/typescript-eslint/issues/3508)) ([4f1806e](https://github.com/typescript-eslint/typescript-eslint/commit/4f1806e548affb7265da360d1fc8d033e25de325)) - -## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) - -### Bug Fixes - -- **experimental-utils:** fix `isAwaitKeyword` predicate in ast-utils ([#3290](https://github.com/typescript-eslint/typescript-eslint/issues/3290)) ([c15da67](https://github.com/typescript-eslint/typescript-eslint/commit/c15da67b939b615ed063291cde12c55c0d6d236e)) - -# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) - -### Features - -- **experimental-utils:** Include `getCwd()` in `RuleContext` type ([#3308](https://github.com/typescript-eslint/typescript-eslint/issues/3308)) ([2b75c11](https://github.com/typescript-eslint/typescript-eslint/commit/2b75c11d69bee88ca0cb77d7efd32b8d0387e6b3)) -- refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) - -## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) - -### Features - -- **eslint-plugin:** [no-unused-vars] fork the base rule ([#2768](https://github.com/typescript-eslint/typescript-eslint/issues/2768)) ([a8227a6](https://github.com/typescript-eslint/typescript-eslint/commit/a8227a6185dd24de4bfc7d766931643871155021)), closes [#2782](https://github.com/typescript-eslint/typescript-eslint/issues/2782) [#2714](https://github.com/typescript-eslint/typescript-eslint/issues/2714) [#2648](https://github.com/typescript-eslint/typescript-eslint/issues/2648) - -## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) - -### Features - -- **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) - -## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) - -### Bug Fixes - -- **experimental-utils:** treat RuleTester arrays as readonly ([#2601](https://github.com/typescript-eslint/typescript-eslint/issues/2601)) ([8025777](https://github.com/typescript-eslint/typescript-eslint/commit/80257776b78bd2b2b4389d6bd530b009a75fb520)) - -# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) - -### Bug Fixes - -- **eslint-plugin:** [no-use-before-define] false positive for function type arguments ([#2554](https://github.com/typescript-eslint/typescript-eslint/issues/2554)) ([189162d](https://github.com/typescript-eslint/typescript-eslint/commit/189162d46ecb116c420232937a7f86df913f4e79)), closes [#2527](https://github.com/typescript-eslint/typescript-eslint/issues/2527) - -# [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.1...v4.0.0) (2020-08-31) - -## [Please see the release notes for v4.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0) - -### Features - -- consume new scope analysis package ([#2039](https://github.com/typescript-eslint/typescript-eslint/issues/2039)) ([3be125d](https://github.com/typescript-eslint/typescript-eslint/commit/3be125d9bdbee1984ac6037874edf619213bd3d0)) -- support ESTree optional chaining representation ([#2308](https://github.com/typescript-eslint/typescript-eslint/issues/2308)) ([e9d2ab6](https://github.com/typescript-eslint/typescript-eslint/commit/e9d2ab638b6767700b52797e74b814ea059beaae)) - -## [3.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.0...v3.10.1) (2020-08-25) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [3.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.1...v3.10.0) (2020-08-24) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [3.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.0...v3.9.1) (2020-08-17) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [3.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.8.0...v3.9.0) (2020-08-10) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) - -### Features - -- add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) -- split types into their own package ([#2229](https://github.com/typescript-eslint/typescript-eslint/issues/2229)) ([5f45918](https://github.com/typescript-eslint/typescript-eslint/commit/5f4591886f3438329fbf2229b03ac66174334a24)) - -# [3.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.3.0...v3.4.0) (2020-06-22) - -### Bug Fixes - -- **experimental-utils:** correct types for TS versions older than 3.8 ([#2217](https://github.com/typescript-eslint/typescript-eslint/issues/2217)) ([5e4dda2](https://github.com/typescript-eslint/typescript-eslint/commit/5e4dda264a7d6a6a1626848e7599faea1ac34922)) -- **experimental-utils:** getParserServices takes a readonly context ([#2235](https://github.com/typescript-eslint/typescript-eslint/issues/2235)) ([26da8de](https://github.com/typescript-eslint/typescript-eslint/commit/26da8de7fcde9eddec63212d79af781c4bb22991)) - -# [3.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.2.0...v3.3.0) (2020-06-15) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [3.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.1.0...v3.2.0) (2020-06-08) - -### Bug Fixes - -- **eslint-plugin:** [prefer-optional-chain] handling first member expression ([#2156](https://github.com/typescript-eslint/typescript-eslint/issues/2156)) ([de18660](https://github.com/typescript-eslint/typescript-eslint/commit/de18660a8cf8f7033798646d8c5b0938d1accb12)) - -# [3.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.2...v3.1.0) (2020-06-01) - -### Bug Fixes - -- **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) - -### Features - -- **eslint-plugin:** [explicit-module-boundary-types] improve accuracy and coverage ([#2135](https://github.com/typescript-eslint/typescript-eslint/issues/2135)) ([caaa859](https://github.com/typescript-eslint/typescript-eslint/commit/caaa8599284d02ab3341e282cad35a52d0fb86c7)) - -## [3.0.2](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.1...v3.0.2) (2020-05-27) - -### Bug Fixes - -- regression for eslint v6 ([#2105](https://github.com/typescript-eslint/typescript-eslint/issues/2105)) ([31fc503](https://github.com/typescript-eslint/typescript-eslint/commit/31fc5039ed919e1515fda673c186d5c83eb5beb3)) - -## [3.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.0...v3.0.1) (2020-05-25) - -### Bug Fixes - -- **experimental-utils:** export `CLIEngine` & `ESLint` ([#2083](https://github.com/typescript-eslint/typescript-eslint/issues/2083)) ([014341b](https://github.com/typescript-eslint/typescript-eslint/commit/014341bb23261f609fc2a6fe7fece191466a084a)) - -# [3.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.34.0...v3.0.0) (2020-05-21) - -## [Please see the release notes for v3.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v3.0.0) - -### Bug Fixes - -- **experimental-utils:** add back SourceCode.isSpaceBetweenTokens ([ae82ea4](https://github.com/typescript-eslint/typescript-eslint/commit/ae82ea4a85a4ca332ebe6104e96c59dba30411be)) -- **typescript-estree:** remove now defunct `Import` node type ([f199cbd](https://github.com/typescript-eslint/typescript-eslint/commit/f199cbdbbd892b5ba03bfff66f463f3d9c92ee9b)) - -### Features - -- **experimental-utils:** upgrade eslint types for v7 ([#2023](https://github.com/typescript-eslint/typescript-eslint/issues/2023)) ([06869c9](https://github.com/typescript-eslint/typescript-eslint/commit/06869c9656fa37936126666845aee40aad546ebd)) -- drop support for node v8 ([#1997](https://github.com/typescript-eslint/typescript-eslint/issues/1997)) ([b6c3b7b](https://github.com/typescript-eslint/typescript-eslint/commit/b6c3b7b84b8d199fa75a46432febd4a364a63217)) -- upgrade to ESLint v7 ([#2022](https://github.com/typescript-eslint/typescript-eslint/issues/2022)) ([208de71](https://github.com/typescript-eslint/typescript-eslint/commit/208de71059746bf38e94bd460346ffb2698a3e12)) -- **eslint-plugin:** [ban-types] rework default options ([#848](https://github.com/typescript-eslint/typescript-eslint/issues/848)) ([8e31d5d](https://github.com/typescript-eslint/typescript-eslint/commit/8e31d5dbe9fe5227fdbefcecfd50ce5dd51360c3)) -- **typescript-estree:** always return parserServices ([#716](https://github.com/typescript-eslint/typescript-eslint/issues/716)) ([5b23443](https://github.com/typescript-eslint/typescript-eslint/commit/5b23443c48f3f62424db3e742243f3568080b946)) - -# [2.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.33.0...v2.34.0) (2020-05-18) - -### Features - -- **experimental-utils:** add `suggestion` property for rule modules ([#2033](https://github.com/typescript-eslint/typescript-eslint/issues/2033)) ([f42a5b0](https://github.com/typescript-eslint/typescript-eslint/commit/f42a5b09ebfa173f418a99c552b0cbe221567194)) - -# [2.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.32.0...v2.33.0) (2020-05-12) - -### Bug Fixes - -- **experimental-utils:** remove accidental dep on json-schema ([#2010](https://github.com/typescript-eslint/typescript-eslint/issues/2010)) ([1875fba](https://github.com/typescript-eslint/typescript-eslint/commit/1875fbad41f2a3dda8f610f5dcd180c6205b73d3)) - -# [2.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.31.0...v2.32.0) (2020-05-11) - -### Features - -- bump dependencies and align AST ([#2007](https://github.com/typescript-eslint/typescript-eslint/issues/2007)) ([18668b7](https://github.com/typescript-eslint/typescript-eslint/commit/18668b78fd7d1e5281af7fc26c76e0ca53297f69)) - -# [2.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.30.0...v2.31.0) (2020-05-04) - -### Features - -- **experimental-utils:** expose our RuleTester extension ([#1948](https://github.com/typescript-eslint/typescript-eslint/issues/1948)) ([2dd1638](https://github.com/typescript-eslint/typescript-eslint/commit/2dd1638aaa2658ba99b2341861146b586f489121)) - -# [2.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.29.0...v2.30.0) (2020-04-27) - -### Features - -- **experimental-utils:** allow rule options to be a readonly tuple ([#1924](https://github.com/typescript-eslint/typescript-eslint/issues/1924)) ([4ef6788](https://github.com/typescript-eslint/typescript-eslint/commit/4ef67884962b6aac61cc895aaa3ba16aa892ecf4)) - -# [2.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.28.0...v2.29.0) (2020-04-20) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.27.0...v2.28.0) (2020-04-13) - -### Features - -- **eslint-plugin:** add rule `prefer-reduce-type-parameter` ([#1707](https://github.com/typescript-eslint/typescript-eslint/issues/1707)) ([c92d240](https://github.com/typescript-eslint/typescript-eslint/commit/c92d240e49113779053eac32038382b282812afc)) - -# [2.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.26.0...v2.27.0) (2020-04-06) - -### Features - -- **experimental-utils:** add types for suggestions from CLIEngine ([#1844](https://github.com/typescript-eslint/typescript-eslint/issues/1844)) ([7c11bd6](https://github.com/typescript-eslint/typescript-eslint/commit/7c11bd66f2d0e5ea9d3943e6b8c66e6ddff50862)) -- **experimental-utils:** update eslint types to match v6.8 ([#1846](https://github.com/typescript-eslint/typescript-eslint/issues/1846)) ([16ce74d](https://github.com/typescript-eslint/typescript-eslint/commit/16ce74d247781ac890dc0baa30c384f97e581b6b)) - -# [2.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.25.0...v2.26.0) (2020-03-30) - -### Features - -- **typescript-estree:** add option to ignore certain folders from glob resolution ([#1802](https://github.com/typescript-eslint/typescript-eslint/issues/1802)) ([1e29e69](https://github.com/typescript-eslint/typescript-eslint/commit/1e29e69b289d61107a7de67592beae331ba50222)) - -# [2.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.24.0...v2.25.0) (2020-03-23) - -### Features - -- **experimental-utils:** expose ast utility functions ([#1670](https://github.com/typescript-eslint/typescript-eslint/issues/1670)) ([3eb5d45](https://github.com/typescript-eslint/typescript-eslint/commit/3eb5d4525e95c8ab990f55588b8d830a02ce5a9c)) - -# [2.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.23.0...v2.24.0) (2020-03-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.22.0...v2.23.0) (2020-03-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.21.0...v2.22.0) (2020-03-02) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.20.0...v2.21.0) (2020-02-24) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.2...v2.20.0) (2020-02-17) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [2.19.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.1...v2.19.2) (2020-02-10) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [2.19.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.0...v2.19.1) (2020-02-10) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.18.0...v2.19.0) (2020-02-03) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) - -### Bug Fixes - -- improve token types and add missing type guards ([#1497](https://github.com/typescript-eslint/typescript-eslint/issues/1497)) ([ce41d7d](https://github.com/typescript-eslint/typescript-eslint/commit/ce41d7de33bcb7ccf96c03ac1438304c5a49ff54)) -- **experimental-utils:** widen type of `settings` property ([#1527](https://github.com/typescript-eslint/typescript-eslint/issues/1527)) ([b515e47](https://github.com/typescript-eslint/typescript-eslint/commit/b515e47af2bc914c7ebcfa4be813409dcd86b1c3)) - -### Features - -- **experimental-utils:** make RuleMetaData.docs optional ([#1462](https://github.com/typescript-eslint/typescript-eslint/issues/1462)) ([cde97ac](https://github.com/typescript-eslint/typescript-eslint/commit/cde97aca24df5a0f28f37006ed130ebc217fb2ad)) -- **parser:** clean up scope-analysis types ([#1481](https://github.com/typescript-eslint/typescript-eslint/issues/1481)) ([4a727fa](https://github.com/typescript-eslint/typescript-eslint/commit/4a727fa083d749dba9eaf39322856f5f69c28cd8)) - -# [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) - -### Features - -- **experimental-utils:** expose getParserServices from utils ([#1448](https://github.com/typescript-eslint/typescript-eslint/issues/1448)) ([982c8bc](https://github.com/typescript-eslint/typescript-eslint/commit/982c8bc)) - -# [2.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.15.0...v2.16.0) (2020-01-13) - -### Features - -- **typescript-estree:** add parserOption to turn on debug logs ([#1413](https://github.com/typescript-eslint/typescript-eslint/issues/1413)) ([25092fd](https://github.com/typescript-eslint/typescript-eslint/commit/25092fd)) -- **typescript-estree:** add strict type mapping to esTreeNodeToTSNodeMap ([#1382](https://github.com/typescript-eslint/typescript-eslint/issues/1382)) ([d3d70a3](https://github.com/typescript-eslint/typescript-eslint/commit/d3d70a3)) - -# [2.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.14.0...v2.15.0) (2020-01-06) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.13.0...v2.14.0) (2019-12-30) - -### Features - -- add internal eslint plugin for repo-specific lint rules ([#1373](https://github.com/typescript-eslint/typescript-eslint/issues/1373)) ([3a15413](https://github.com/typescript-eslint/typescript-eslint/commit/3a15413)) - -# [2.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.12.0...v2.13.0) (2019-12-23) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.11.0...v2.12.0) (2019-12-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.10.0...v2.11.0) (2019-12-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.9.0...v2.10.0) (2019-12-02) - -### Features - -- **eslint-plugin:** [no-non-null-assert] add suggestion fixer ([#1260](https://github.com/typescript-eslint/typescript-eslint/issues/1260)) ([e350a21](https://github.com/typescript-eslint/typescript-eslint/commit/e350a21)) -- **experimental-utils:** add isSpaceBetween declaration to Sou… ([#1268](https://github.com/typescript-eslint/typescript-eslint/issues/1268)) ([f83f04b](https://github.com/typescript-eslint/typescript-eslint/commit/f83f04b)) - -# [2.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.8.0...v2.9.0) (2019-11-25) - -### Features - -- suggestion types, suggestions for no-explicit-any ([#1250](https://github.com/typescript-eslint/typescript-eslint/issues/1250)) ([b16a4b6](https://github.com/typescript-eslint/typescript-eslint/commit/b16a4b6)) -- **eslint-plugin:** add prefer-nullish-coalescing ([#1069](https://github.com/typescript-eslint/typescript-eslint/issues/1069)) ([a9cd399](https://github.com/typescript-eslint/typescript-eslint/commit/a9cd399)) -- **eslint-plugin:** add rule prefer-optional-chain ([#1213](https://github.com/typescript-eslint/typescript-eslint/issues/1213)) ([ad7e1a7](https://github.com/typescript-eslint/typescript-eslint/commit/ad7e1a7)) - -# [2.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.7.0...v2.8.0) (2019-11-18) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) - -### Bug Fixes - -- support long running "watch" lint sessions ([#973](https://github.com/typescript-eslint/typescript-eslint/issues/973)) ([854620e](https://github.com/typescript-eslint/typescript-eslint/commit/854620e)) - -### Features - -- **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) - -## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) - -### Bug Fixes - -- **experimental-utils:** remove Rule.meta.extraDescription ([#1036](https://github.com/typescript-eslint/typescript-eslint/issues/1036)) ([192e23d](https://github.com/typescript-eslint/typescript-eslint/commit/192e23d)) - -## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) - -### Bug Fixes - -- **eslint-plugin:** add `Literal` to `RuleListener` types ([#824](https://github.com/typescript-eslint/typescript-eslint/issues/824)) ([3c902a1](https://github.com/typescript-eslint/typescript-eslint/commit/3c902a1)) -- **utils:** add ES2019 as valid `ecmaVersion` ([#746](https://github.com/typescript-eslint/typescript-eslint/issues/746)) ([d11fbbe](https://github.com/typescript-eslint/typescript-eslint/commit/d11fbbe)) - -### Features - -- explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) - -- feat(eslint-plugin)!: recommended-requiring-type-checking config (#846) ([d3470c9](https://github.com/typescript-eslint/typescript-eslint/commit/d3470c9)), closes [#846](https://github.com/typescript-eslint/typescript-eslint/issues/846) -- feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) -- feat(eslint-plugin)!: add rule `consistent-type-assertions` (#731) ([92e98de](https://github.com/typescript-eslint/typescript-eslint/commit/92e98de)), closes [#731](https://github.com/typescript-eslint/typescript-eslint/issues/731) - -### BREAKING CHANGES - -- removed some rules from recommended config -- recommended config changes are considered breaking -- Merges both no-angle-bracket-type-assertion and no-object-literal-type-assertion into one rule -- Node 6 is no longer supported - -# [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) - -### Bug Fixes - -- Correct `@types/json-schema` dependency ([#675](https://github.com/typescript-eslint/typescript-eslint/issues/675)) ([a5398ce](https://github.com/typescript-eslint/typescript-eslint/commit/a5398ce)) -- **utils:** move `typescript` from peer dep to dev dep ([#712](https://github.com/typescript-eslint/typescript-eslint/issues/712)) ([f949355](https://github.com/typescript-eslint/typescript-eslint/commit/f949355)) -- **utils:** RuleTester should not require a parser ([#713](https://github.com/typescript-eslint/typescript-eslint/issues/713)) ([158a417](https://github.com/typescript-eslint/typescript-eslint/commit/158a417)) - -### Features - -- **eslint-plugin:** add new rule no-misused-promises ([#612](https://github.com/typescript-eslint/typescript-eslint/issues/612)) ([28a131d](https://github.com/typescript-eslint/typescript-eslint/commit/28a131d)) - -# [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) - -### Bug Fixes - -- **eslint-plugin:** Remove duplicated code ([#611](https://github.com/typescript-eslint/typescript-eslint/issues/611)) ([c4df4ff](https://github.com/typescript-eslint/typescript-eslint/commit/c4df4ff)) - -### Features - -- **eslint-plugin:** add `consistent-type-definitions` rule ([#463](https://github.com/typescript-eslint/typescript-eslint/issues/463)) ([ec87d06](https://github.com/typescript-eslint/typescript-eslint/commit/ec87d06)) - -## [1.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.1...v1.10.2) (2019-06-10) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [1.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.0...v1.10.1) (2019-06-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [1.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.9.0...v1.10.0) (2019-06-09) - -### Bug Fixes - -- **experimental-utils:** add `endLine` and `endColumn` ([#517](https://github.com/typescript-eslint/typescript-eslint/issues/517)) ([d9e5f15](https://github.com/typescript-eslint/typescript-eslint/commit/d9e5f15)) -- **experimental-utils:** Avoid typescript import at runtime ([#584](https://github.com/typescript-eslint/typescript-eslint/issues/584)) ([fac5c7d](https://github.com/typescript-eslint/typescript-eslint/commit/fac5c7d)), closes [/github.com/typescript-eslint/typescript-eslint/pull/425#issuecomment-498162293](https://github.com//github.com/typescript-eslint/typescript-eslint/pull/425/issues/issuecomment-498162293) - -### Features - -- make utils/TSESLint export typed classes instead of just types ([#526](https://github.com/typescript-eslint/typescript-eslint/issues/526)) ([370ac72](https://github.com/typescript-eslint/typescript-eslint/commit/370ac72)) -- support TypeScript versions >=3.2.1 <3.6.0 ([#597](https://github.com/typescript-eslint/typescript-eslint/issues/597)) ([5d2b962](https://github.com/typescript-eslint/typescript-eslint/commit/5d2b962)) - -# [1.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.8.0...v1.9.0) (2019-05-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [1.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.7.0...v1.8.0) (2019-05-10) - -### Features - -- Move shared types into their own package ([#425](https://github.com/typescript-eslint/typescript-eslint/issues/425)) ([a7a03ce](https://github.com/typescript-eslint/typescript-eslint/commit/a7a03ce)) diff --git a/packages/experimental-utils/LICENSE b/packages/experimental-utils/LICENSE deleted file mode 100644 index a1164108d4d6..000000000000 --- a/packages/experimental-utils/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 typescript-eslint and other contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/packages/experimental-utils/README.md b/packages/experimental-utils/README.md deleted file mode 100644 index a285229f6389..000000000000 --- a/packages/experimental-utils/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# `@typescript-eslint/experimental-utils` - -Utilities for working with TypeScript + ESLint together. - -[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/experimental-utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/experimental-utils) -[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/experimental-utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/experimental-utils) - -## Note - -**This package is purely a re-export of `@typescript-eslint/utils`.** -You should switch to importing from that non-experimental package instead. - -```diff -- import { RuleCreator } from '@typescript-eslint/experimental-utils'; -+ import { RuleCreator } from '@typescript-eslint/utils'; -``` - -> ⚠ A future major version of this old package will `console.warn` to ask you to switch. - -## Contributing - -[See the contributing guide here](https://typescript-eslint.io). diff --git a/packages/experimental-utils/jest.config.js b/packages/experimental-utils/jest.config.js deleted file mode 100644 index 5f1ea3f4bcb0..000000000000 --- a/packages/experimental-utils/jest.config.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; - -// @ts-check -/** @type {import('@jest/types').Config.InitialOptions} */ -module.exports = { - ...require('../../jest.config.base.js'), - testRegex: './tests/.+\\.test\\.ts$', -}; diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json deleted file mode 100644 index 2ed9d1792987..000000000000 --- a/packages/experimental-utils/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@typescript-eslint/experimental-utils", - "version": "5.51.0", - "description": "(Experimental) Utilities for working with TypeScript + ESLint together", - "keywords": [ - "eslint", - "typescript", - "estree" - ], - "engines": { - "node": "^14.18.0 || ^16.0.0 || >=18.0.0" - }, - "files": [ - "dist", - "_ts3.4", - "package.json", - "README.md", - "LICENSE" - ], - "repository": { - "type": "git", - "url": "https://github.com/typescript-eslint/typescript-eslint.git", - "directory": "packages/experimental-utils" - }, - "bugs": { - "url": "https://github.com/typescript-eslint/typescript-eslint/issues" - }, - "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "scripts": { - "build": "tsc -b tsconfig.build.json", - "postbuild": "downlevel-dts dist _ts3.4/dist", - "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "nx lint", - "test": "jest", - "typecheck": "tsc -p tsconfig.json --noEmit" - }, - "dependencies": { - "@typescript-eslint/utils": "5.51.0" - }, - "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" - }, - "devDependencies": { - "typescript": "*" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } -} diff --git a/packages/experimental-utils/project.json b/packages/experimental-utils/project.json deleted file mode 100644 index 74410fed05a9..000000000000 --- a/packages/experimental-utils/project.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "experimental-utils", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "type": "library", - "implicitDependencies": [], - "targets": { - "lint": { - "executor": "@nrwl/linter:eslint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": ["packages/experimental-utils/**/*.ts"] - } - } - } -} diff --git a/packages/experimental-utils/src/index.ts b/packages/experimental-utils/src/index.ts deleted file mode 100644 index c5cd3fec24e5..000000000000 --- a/packages/experimental-utils/src/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* eslint-disable no-console */ -console.warn( - 'This package is purely a re-export of `@typescript-eslint/utils`.', -); -console.warn( - 'You should switch to importing from that non-experimental package instead.', -); -export * from '@typescript-eslint/utils'; diff --git a/packages/experimental-utils/tests/consoleWarning.test.ts b/packages/experimental-utils/tests/consoleWarning.test.ts deleted file mode 100644 index 08b13f74fce5..000000000000 --- a/packages/experimental-utils/tests/consoleWarning.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -describe('importing', () => { - it('should console a warning', () => { - const warn = jest.spyOn(console, 'warn').mockImplementation(() => {}); - require('../src/index'); - expect(warn).toHaveBeenCalledTimes(2); - expect(warn).toHaveBeenLastCalledWith( - 'You should switch to importing from that non-experimental package instead.', - ); - }); -}); diff --git a/packages/experimental-utils/tsconfig.build.json b/packages/experimental-utils/tsconfig.build.json deleted file mode 100644 index e5c1077c5e5c..000000000000 --- a/packages/experimental-utils/tsconfig.build.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "composite": true, - "outDir": "./dist", - "rootDir": "./src", - "resolveJsonModule": true - }, - "include": ["src", "typings"], - "references": [ - { "path": "../scope-manager/tsconfig.build.json" }, - { "path": "../types/tsconfig.build.json" }, - { "path": "../typescript-estree/tsconfig.build.json" } - ] -} diff --git a/packages/experimental-utils/tsconfig.json b/packages/experimental-utils/tsconfig.json deleted file mode 100644 index 20ea2496c6b0..000000000000 --- a/packages/experimental-utils/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "./tsconfig.build.json", - "compilerOptions": { - "composite": false, - "rootDir": "." - }, - "include": ["src", "typings", "tests", "tools"], - "references": [ - { "path": "../scope-manager/tsconfig.build.json" }, - { "path": "../types/tsconfig.build.json" }, - { "path": "../typescript-estree/tsconfig.build.json" } - ] -} diff --git a/packages/parser/package.json b/packages/parser/package.json index 13981a2feeee..dfd9b4b099d6 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -2,14 +2,26 @@ "name": "@typescript-eslint/parser", "version": "5.51.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", - "main": "dist/index.js", - "types": "dist/index.d.ts", "files": [ "dist", "_ts3.4", "README.md", "LICENSE" ], + "type": "commonjs", + "typesVersions": { + "<3.8": { + ".": [ + "_ts3.4/dist/index.d.ts" + ] + } + }, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "require": "./dist/index.js" + } + }, "engines": { "node": "^14.18.0 || ^16.0.0 || >=18.0.0" }, @@ -64,12 +76,5 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" - }, - "typesVersions": { - "<3.8": { - "*": [ - "_ts3.4/*" - ] - } } } diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index b273be553b01..085c110bdb77 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -2,20 +2,29 @@ "name": "@typescript-eslint/scope-manager", "version": "5.51.0", "description": "TypeScript scope analyser for ESLint", - "keywords": [ - "eslint", - "typescript", - "estree" - ], - "engines": { - "node": "^14.18.0 || ^16.0.0 || >=18.0.0" - }, "files": [ "dist", "package.json", "README.md", "LICENSE" ], + "type": "commonjs", + "typesVersions": { + "<3.8": { + ".": [ + "_ts3.4/dist/index.d.ts" + ] + } + }, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "require": "./dist/index.js" + } + }, + "engines": { + "node": "^14.18.0 || ^16.0.0 || >=18.0.0" + }, "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", @@ -25,8 +34,11 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "keywords": [ + "eslint", + "typescript", + "estree" + ], "scripts": { "build": "nx build", "clean": "nx clean", @@ -55,12 +67,5 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" - }, - "typesVersions": { - "<3.8": { - "*": [ - "_ts3.4/*" - ] - } } } diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index fd9faac647df..2221f90ceb65 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -2,14 +2,6 @@ "name": "@typescript-eslint/type-utils", "version": "5.51.0", "description": "Type utilities for working with TypeScript + ESLint together", - "keywords": [ - "eslint", - "typescript", - "estree" - ], - "engines": { - "node": "^14.18.0 || ^16.0.0 || >=18.0.0" - }, "files": [ "dist", "_ts3.4", @@ -17,6 +9,23 @@ "README.md", "LICENSE" ], + "type": "commonjs", + "typesVersions": { + "<3.8": { + ".": [ + "_ts3.4/dist/index.d.ts" + ] + } + }, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "require": "./dist/index.js" + } + }, + "engines": { + "node": "^14.18.0 || ^16.0.0 || >=18.0.0" + }, "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", @@ -26,8 +35,11 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "keywords": [ + "eslint", + "typescript", + "estree" + ], "scripts": { "build": "tsc -b tsconfig.build.json", "postbuild": "downlevel-dts dist _ts3.4/dist", @@ -42,7 +54,7 @@ "@typescript-eslint/typescript-estree": "5.51.0", "@typescript-eslint/utils": "5.51.0", "debug": "^4.3.4", - "ts-api-tools": "^0.0.15" + "ts-api-utils": "^0.0.21" }, "devDependencies": { "@typescript-eslint/parser": "5.51.0", @@ -59,12 +71,5 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" - }, - "typesVersions": { - "<3.8": { - "*": [ - "_ts3.4/*" - ] - } } } diff --git a/packages/type-utils/src/containsAllTypesByName.ts b/packages/type-utils/src/containsAllTypesByName.ts index 715686fe3f78..b35e91e12297 100644 --- a/packages/type-utils/src/containsAllTypesByName.ts +++ b/packages/type-utils/src/containsAllTypesByName.ts @@ -1,4 +1,4 @@ -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import { isTypeFlagSet } from './typeFlagUtils'; diff --git a/packages/type-utils/src/getContextualType.ts b/packages/type-utils/src/getContextualType.ts index b19ceb936bde..373729ad1dca 100644 --- a/packages/type-utils/src/getContextualType.ts +++ b/packages/type-utils/src/getContextualType.ts @@ -1,4 +1,4 @@ -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; /** diff --git a/packages/type-utils/src/isTypeReadonly.ts b/packages/type-utils/src/isTypeReadonly.ts index 649a38f40a23..825aa38b7c58 100644 --- a/packages/type-utils/src/isTypeReadonly.ts +++ b/packages/type-utils/src/isTypeReadonly.ts @@ -1,5 +1,5 @@ import { ESLintUtils } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import { getTypeOfPropertyOfType } from './propertyTypes'; diff --git a/packages/type-utils/src/isUnsafeAssignment.ts b/packages/type-utils/src/isUnsafeAssignment.ts index e14370da7a93..be92fcaace1f 100644 --- a/packages/type-utils/src/isUnsafeAssignment.ts +++ b/packages/type-utils/src/isUnsafeAssignment.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import type * as ts from 'typescript'; import { isTypeAnyType, isTypeUnknownType } from './predicates'; diff --git a/packages/type-utils/src/predicates.ts b/packages/type-utils/src/predicates.ts index 281ad0a188a3..fa4524e7808e 100644 --- a/packages/type-utils/src/predicates.ts +++ b/packages/type-utils/src/predicates.ts @@ -1,5 +1,5 @@ import debug from 'debug'; -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import { getTypeArguments } from './getTypeArguments'; diff --git a/packages/type-utils/src/typeFlagUtils.ts b/packages/type-utils/src/typeFlagUtils.ts index 018c2f4de738..7e2003f6fe21 100644 --- a/packages/type-utils/src/typeFlagUtils.ts +++ b/packages/type-utils/src/typeFlagUtils.ts @@ -1,4 +1,4 @@ -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; /** diff --git a/packages/types/package.json b/packages/types/package.json index 003bfdd69ead..505fffc189bd 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -2,14 +2,6 @@ "name": "@typescript-eslint/types", "version": "5.51.0", "description": "Types for the TypeScript-ESTree AST spec", - "keywords": [ - "eslint", - "typescript", - "estree" - ], - "engines": { - "node": "^14.18.0 || ^16.0.0 || >=18.0.0" - }, "files": [ "dist", "_ts3.4", @@ -17,6 +9,16 @@ "README.md", "LICENSE" ], + "type": "commonjs", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "require": "./dist/index.js" + } + }, + "engines": { + "node": "^14.18.0 || ^16.0.0 || >=18.0.0" + }, "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", @@ -26,8 +28,11 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "keywords": [ + "eslint", + "typescript", + "estree" + ], "scripts": { "prebuild": "yarn tsx ./tools/copy-ast-spec.ts", "build": "tsc -b tsconfig.build.json", @@ -66,18 +71,11 @@ } } }, + "devDependencies": { + "typescript": "*" + }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" - }, - "typesVersions": { - "<3.8": { - "*": [ - "_ts3.4/*" - ] - } - }, - "devDependencies": { - "typescript": "*" } } diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index c9b2183cab0d..36008f93cc90 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -2,14 +2,26 @@ "name": "@typescript-eslint/typescript-estree", "version": "5.51.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", - "main": "dist/index.js", - "types": "dist/index.d.ts", "files": [ "dist", "_ts3.4", "README.md", "LICENSE" ], + "type": "commonjs", + "typesVersions": { + "<3.8": { + ".": [ + "_ts3.4/dist/index.d.ts" + ] + } + }, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "require": "./dist/index.js" + } + }, "engines": { "node": "^14.18.0 || ^16.0.0 || >=18.0.0" }, @@ -48,7 +60,7 @@ "globby": "^11.1.0", "is-glob": "^4.0.3", "semver": "^7.3.7", - "ts-api-tools": "^0.0.15" + "ts-api-utils": "^0.0.21" }, "devDependencies": { "@babel/code-frame": "*", @@ -73,12 +85,5 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" - }, - "typesVersions": { - "<3.8": { - "*": [ - "_ts3.4/*" - ] - } } } diff --git a/packages/typescript-estree/src/convert-comments.ts b/packages/typescript-estree/src/convert-comments.ts index 0ffcd226bb09..dec2d5bcaa51 100644 --- a/packages/typescript-estree/src/convert-comments.ts +++ b/packages/typescript-estree/src/convert-comments.ts @@ -1,4 +1,4 @@ -import * as tools from 'ts-api-tools'; +import * as tools from 'ts-api-utils'; import * as ts from 'typescript'; import { getLocFor } from './node-utils'; diff --git a/packages/utils/package.json b/packages/utils/package.json index 03834aa07a38..1fa7790f3212 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -2,14 +2,6 @@ "name": "@typescript-eslint/utils", "version": "5.51.0", "description": "Utilities for working with TypeScript + ESLint together", - "keywords": [ - "eslint", - "typescript", - "estree" - ], - "engines": { - "node": "^14.18.0 || ^16.0.0 || >=18.0.0" - }, "files": [ "dist", "_ts3.4", @@ -17,6 +9,39 @@ "README.md", "LICENSE" ], + "type": "commonjs", + "typesVersions": { + "<3.8": { + ".": [ + "_ts3.4/dist/index.d.ts" + ] + } + }, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "require": "./dist/index.js" + }, + "./ASTUtils": { + "types": "./dist/ast-utils/index.d.ts", + "require": "./dist/ast-utils/index.js" + }, + "./ESLintUtils": { + "types": "./dist/eslint-utils/index.d.ts", + "require": "./dist/eslint-utils/index.js" + }, + "./JSONSchema": { + "types": "./dist/json-schema/index.d.ts", + "require": "./dist/json-schema/index.js" + }, + "./TSESLint": { + "types": "./dist/ts-eslint/index.d.ts", + "require": "./dist/ts-eslint/index.js" + } + }, + "engines": { + "node": "^14.18.0 || ^16.0.0 || >=18.0.0" + }, "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", @@ -26,8 +51,11 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "keywords": [ + "eslint", + "typescript", + "estree" + ], "scripts": { "build": "tsc -b tsconfig.build.json", "postbuild": "downlevel-dts dist _ts3.4/dist", @@ -58,12 +86,5 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" - }, - "typesVersions": { - "<3.8": { - "*": [ - "_ts3.4/*" - ] - } } } diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index d4e7a2f0f16e..2c8b6487fbff 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -2,14 +2,6 @@ "name": "@typescript-eslint/visitor-keys", "version": "5.51.0", "description": "Visitor keys used to help traverse the TypeScript-ESTree AST", - "keywords": [ - "eslint", - "typescript", - "estree" - ], - "engines": { - "node": "^14.18.0 || ^16.0.0 || >=18.0.0" - }, "files": [ "dist", "_ts3.4", @@ -17,6 +9,23 @@ "README.md", "LICENSE" ], + "type": "commonjs", + "typesVersions": { + "<3.8": { + ".": [ + "_ts3.4/dist/index.d.ts" + ] + } + }, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "require": "./dist/index.js" + } + }, + "engines": { + "node": "^14.18.0 || ^16.0.0 || >=18.0.0" + }, "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", @@ -26,8 +35,11 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "keywords": [ + "eslint", + "typescript", + "estree" + ], "scripts": { "build": "tsc -b tsconfig.build.json", "postbuild": "downlevel-dts dist _ts3.4/dist", @@ -48,12 +60,5 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" - }, - "typesVersions": { - "<3.8": { - "*": [ - "_ts3.4/*" - ] - } } } diff --git a/tools/postinstall.ts b/tools/postinstall.ts index badd3f0137a1..59a5506ab427 100644 --- a/tools/postinstall.ts +++ b/tools/postinstall.ts @@ -21,11 +21,13 @@ void (async function (): Promise { // Install git hooks await $`yarn husky install`; - // Clean any caches that may be invalid now - await $`yarn clean`; + if (!process.env.SKIP_POSTINSTALL_BUILD) { + // Clean any caches that may be invalid now + await $`yarn clean`; - // Build all the packages ready for use - await $`yarn build`; + // Build all the packages ready for use + await $`yarn build`; + } })(); async function $(cmd: TemplateStringsArray): Promise { diff --git a/tsconfig.base.json b/tsconfig.base.json index 4116456c2196..ae1ea7a55764 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -5,9 +5,9 @@ "allowUnusedLabels": false, "declaration": true, "declarationMap": true, - "esModuleInterop": true, + "esModuleInterop": false, "module": "commonjs", - "moduleResolution": "node", + "moduleResolution": "node16", "noImplicitReturns": true, "pretty": true, "skipLibCheck": true, diff --git a/yarn.lock b/yarn.lock index caba75cfc763..8ce0c8d22a4b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4343,6 +4343,13 @@ dependencies: "@types/yargs-parser" "*" +"@typescript-eslint/experimental-utils@^5.0.0": + version "5.51.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.51.0.tgz#936124843a9221863f027a08063b737578838bea" + integrity sha512-8/3+ZyBENl2aog1/QB3S39ptkZ2oRhDB+sJt15UWXBE3skgwL1C8BN9RjpOyhTejwR2hVrvqEjcYcNY6qtZ7nw== + dependencies: + "@typescript-eslint/utils" "5.51.0" + "@webassemblyjs/ast@1.11.1": version "1.11.1" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.1.tgz#2bfd767eae1a6996f432ff7e8d7fc75679c0b6a7" @@ -13659,10 +13666,10 @@ trough@^1.0.0: resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.5.tgz#b8b639cefad7d0bb2abd37d433ff8293efa5f406" integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA== -ts-api-tools@^0.0.15: - version "0.0.15" - resolved "https://registry.yarnpkg.com/ts-api-tools/-/ts-api-tools-0.0.15.tgz#d16750e0fdf7816a9b91da6af9db5b5167bfca80" - integrity sha512-aNaUSL3j1IvX2xRahC86OHLLhtuEEKful+HfgZs1TcYr2ZcukrENRxDIP1mjXdMojnfr2VflHqsFaaTp1m/bLw== +ts-api-utils@^0.0.21: + version "0.0.21" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-0.0.21.tgz#d5e58e3200f848123a89f3987d6ee9b613642d01" + integrity sha512-Dr9RHp5+4jLF+2wARhwQO1Z/6BFVsKigZhascnbsbyzSEDKO9qGlN7RgsquqHwP0lHiQmLJFYiGCLXTmcDC9Wg== ts-essentials@^2.0.3: version "2.0.12" From 40ff15faa9b7792a5e311043a0f4a85d766a958d Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 13 Feb 2023 18:00:44 +1030 Subject: [PATCH 2/8] fixes --- package.json | 19 ++++--- .../util/parsers/typescript-estree-import.ts | 1 - packages/eslint-plugin-tslint/package.json | 29 ++++++---- .../eslint-plugin-tslint/tests/tsconfig.json | 5 -- .../eslint-plugin-tslint/tsconfig.build.json | 3 + packages/eslint-plugin-tslint/tsconfig.json | 6 +- packages/eslint-plugin/index.d.ts | 9 ++- packages/eslint-plugin/package.json | 34 +++++++---- packages/eslint-plugin/rules.d.ts | 16 ++++++ .../eslint-plugin/src/rules/dot-notation.ts | 1 - .../rules/explicit-function-return-type.ts | 2 +- .../src/rules/prefer-ts-expect-error.ts | 5 +- packages/eslint-plugin/src/util/astUtils.ts | 2 +- .../src/util/collectUnusedVariables.ts | 3 +- packages/eslint-plugin/tests/RuleTester.ts | 8 ++- .../rules/no-unnecessary-condition.test.ts | 2 +- .../rules/promise-function-async.test.ts | 4 +- packages/eslint-plugin/tsconfig.json | 2 +- .../eslint-plugin/typings/eslint-rules.d.ts | 4 +- packages/parser/package.json | 3 + packages/parser/tests/lib/parser.ts | 4 +- .../parser/tests/tools/ts-error-serializer.ts | 2 +- packages/scope-manager/package.json | 7 +++ packages/type-utils/package.json | 3 + packages/types/package.json | 3 + packages/typescript-estree/package.json | 15 +++++ packages/typescript-estree/src/index.ts | 1 + packages/utils/package.json | 19 +++++-- .../eslint-utils/rule-tester/RuleTester.ts | 4 +- packages/visitor-keys/package.json | 7 +++ packages/website-eslint/jsconfig.json | 18 ++++++ packages/website-eslint/package.json | 19 +++++-- packages/website-eslint/rollup.config.js | 1 + packages/website-eslint/src/linter/linter.js | 18 ++++-- packages/website-eslint/types/index.d.ts | 13 ----- packages/website-eslint/typings/eslint.d.ts | 7 +++ .../website/src/components/editor/config.ts | 2 +- .../src/components/editor/loadSandbox.ts | 2 +- .../src/components/linter/CompilerHost.ts | 3 +- .../src/components/linter/WebLinter.ts | 12 +++- .../website/src/components/linter/config.ts | 2 +- patches/ts-api-utils+0.0.21.patch | 13 +++++ tools/dummypkg/README.md | 3 + tools/dummypkg/index.d.ts | 1 + tools/dummypkg/index.js | 1 + tools/dummypkg/package.json | 6 ++ tsconfig.base.json | 4 +- yarn.lock | 57 +++++++++---------- 48 files changed, 275 insertions(+), 130 deletions(-) delete mode 100644 packages/eslint-plugin-tslint/tests/tsconfig.json create mode 100644 packages/eslint-plugin/rules.d.ts create mode 100644 packages/website-eslint/jsconfig.json delete mode 100644 packages/website-eslint/types/index.d.ts create mode 100644 packages/website-eslint/typings/eslint.d.ts create mode 100644 patches/ts-api-utils+0.0.21.patch create mode 100644 tools/dummypkg/README.md create mode 100644 tools/dummypkg/index.d.ts create mode 100644 tools/dummypkg/index.js create mode 100644 tools/dummypkg/package.json diff --git a/package.json b/package.json index f764612c05a3..cd3edce0e4a3 100644 --- a/package.json +++ b/package.json @@ -123,13 +123,16 @@ "jest-snapshot": "^29", "jest-util": "^29", "pretty-format": "^29", - "@swc/core-android-arm-eabi": "npm:dummypkg-a@1.0.0", - "@swc/core-android-arm64": "npm:dummypkg-a@1.0.0", - "@swc/core-freebsd-x64": "npm:dummypkg-a@1.0.0", - "@swc/core-linux-arm-gnueabihf": "npm:dummypkg-a@1.0.0", - "@swc/core-linux-arm64-gnu": "npm:dummypkg-a@1.0.0", - "@swc/core-linux-arm64-musl": "npm:dummypkg-a@1.0.0", - "@swc/core-win32-arm64-msvc": "npm:dummypkg-a@1.0.0", - "@swc/core-win32-ia32-msvc": "npm:dummypkg-a@1.0.0" + "@swc/core-android-arm-eabi": "file:./tools/dummypkg", + "@swc/core-android-arm64": "file:./tools/dummypkg", + "@swc/core-freebsd-x64": "file:./tools/dummypkg", + "@swc/core-linux-arm-gnueabihf": "file:./tools/dummypkg", + "@swc/core-linux-arm64-gnu": "file:./tools/dummypkg", + "@swc/core-linux-arm64-musl": "file:./tools/dummypkg", + "@swc/core-win32-arm64-msvc": "file:./tools/dummypkg", + "@swc/core-win32-ia32-msvc": "file:./tools/dummypkg", + "@types/eslint": "file:./tools/dummypkg", + "@types/eslint-scope": "file:./tools/dummypkg", + "@types/estree": "file:./tools/dummypkg" } } diff --git a/packages/ast-spec/tests/util/parsers/typescript-estree-import.ts b/packages/ast-spec/tests/util/parsers/typescript-estree-import.ts index c04f3d12ae23..e4efe29db099 100644 --- a/packages/ast-spec/tests/util/parsers/typescript-estree-import.ts +++ b/packages/ast-spec/tests/util/parsers/typescript-estree-import.ts @@ -14,5 +14,4 @@ */ // We need to ignore this lint error regarding it being missing from the package.json, see above. -// eslint-disable-next-line import/no-extraneous-dependencies export { parse } from '@typescript-eslint/typescript-estree'; diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index e07880ff6f77..769376effb71 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -2,28 +2,25 @@ "name": "@typescript-eslint/eslint-plugin-tslint", "version": "5.51.0", "description": "ESLint plugin that wraps a TSLint configuration and lints the whole source using TSLint", - "keywords": [ - "eslint", - "eslintplugin", - "eslint-plugin", - "tslint" + "files": [ + "dist", + "package.json", + "README.md", + "LICENSE" ], "type": "commonjs", "exports": { ".": { "types": "./dist/index.d.ts", "require": "./dist/index.js" + }, + "./package.json": { + "require": "./package.json" } }, "engines": { "node": "^14.18.0 || ^16.0.0 || >=18.0.0" }, - "files": [ - "dist", - "package.json", - "README.md", - "LICENSE" - ], "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", @@ -33,6 +30,12 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "license": "MIT", + "keywords": [ + "eslint", + "eslintplugin", + "eslint-plugin", + "tslint" + ], "scripts": { "build": "tsc -b tsconfig.build.json", "clean": "tsc -b tsconfig.build.json --clean", @@ -54,5 +57,9 @@ "devDependencies": { "@types/lodash": "*", "@typescript-eslint/parser": "5.51.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } } diff --git a/packages/eslint-plugin-tslint/tests/tsconfig.json b/packages/eslint-plugin-tslint/tests/tsconfig.json deleted file mode 100644 index aee0ec940fcd..000000000000 --- a/packages/eslint-plugin-tslint/tests/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "strict": true - } -} diff --git a/packages/eslint-plugin-tslint/tsconfig.build.json b/packages/eslint-plugin-tslint/tsconfig.build.json index ce8f56e72947..1eb8c0821e29 100644 --- a/packages/eslint-plugin-tslint/tsconfig.build.json +++ b/packages/eslint-plugin-tslint/tsconfig.build.json @@ -1,6 +1,9 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + // specifically disable declarations for the plugin + "declaration": false, + "declarationMap": false, "outDir": "./dist", "rootDir": "./src", "resolveJsonModule": true diff --git a/packages/eslint-plugin-tslint/tsconfig.json b/packages/eslint-plugin-tslint/tsconfig.json index b2f22d5b95db..8d332b589a2c 100644 --- a/packages/eslint-plugin-tslint/tsconfig.json +++ b/packages/eslint-plugin-tslint/tsconfig.json @@ -5,6 +5,10 @@ "rootDir": "." }, "include": ["src", "tests"], - "exclude": ["tests/test-project", "tests/test-tslint-rules-directory"], + "exclude": [ + "tests/fixture-project", + "tests/test-project", + "tests/test-tslint-rules-directory" + ], "references": [{ "path": "../utils/tsconfig.build.json" }] } diff --git a/packages/eslint-plugin/index.d.ts b/packages/eslint-plugin/index.d.ts index 53a17f6fc333..7b4715f81f74 100644 --- a/packages/eslint-plugin/index.d.ts +++ b/packages/eslint-plugin/index.d.ts @@ -1,4 +1,9 @@ import type { TSESLint } from '@typescript-eslint/utils'; -export const rules: Record>; -export const configs: Record; +import type rules from './rules'; + +declare const cjsExport: { + configs: Record; + rules: typeof rules; +}; +export = cjsExport; diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index c8a2a2cb3409..6ce2b25ee5d3 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -2,15 +2,6 @@ "name": "@typescript-eslint/eslint-plugin", "version": "5.51.0", "description": "TypeScript plugin for ESLint", - "keywords": [ - "eslint", - "eslintplugin", - "eslint-plugin", - "typescript" - ], - "engines": { - "node": "^14.18.0 || ^16.0.0 || >=18.0.0" - }, "files": [ "dist", "docs", @@ -19,6 +10,23 @@ "README.md", "LICENSE" ], + "type": "commonjs", + "exports": { + ".": { + "types": "./index.d.ts", + "require": "./dist/index.js" + }, + "./package.json": { + "require": "./package.json" + }, + "./use-at-your-own-risk/rules": { + "types": "./rules.d.ts", + "require": "./dist/rules/index.js" + } + }, + "engines": { + "node": "^14.18.0 || ^16.0.0 || >=18.0.0" + }, "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", @@ -28,8 +36,12 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "license": "MIT", - "main": "dist/index.js", - "types": "index.d.ts", + "keywords": [ + "eslint", + "eslintplugin", + "eslint-plugin", + "typescript" + ], "scripts": { "build": "tsc -b tsconfig.build.json", "check-docs": "jest tests/docs.test.ts --runTestsByPath --silent --runInBand", diff --git a/packages/eslint-plugin/rules.d.ts b/packages/eslint-plugin/rules.d.ts new file mode 100644 index 000000000000..0b154ba78d6e --- /dev/null +++ b/packages/eslint-plugin/rules.d.ts @@ -0,0 +1,16 @@ +/* +We purposely don't generate types for our plugin because: +1) there's no real reason that anyone should do a typed import of our rules, +2) it would require us to change our code so there aren't as many inferred types + +This type declaration exists as a hacky way to add a type to the export for our +internal packages that require it +*/ + +import type { RuleModule } from '@typescript-eslint/utils/ts-eslint'; + +export interface TypeScriptESLintRules { + [ruleName: string]: RuleModule; +} +declare const rules: TypeScriptESLintRules; +export = rules; diff --git a/packages/eslint-plugin/src/rules/dot-notation.ts b/packages/eslint-plugin/src/rules/dot-notation.ts index ad69d93d83ff..400598b4f970 100644 --- a/packages/eslint-plugin/src/rules/dot-notation.ts +++ b/packages/eslint-plugin/src/rules/dot-notation.ts @@ -77,7 +77,6 @@ export default createRule({ (options.allowIndexSignaturePropertyAccess ?? false) || tools.isCompilerOptionEnabled( services.program.getCompilerOptions(), - // @ts-expect-error - TS is refining the type to never for some reason 'noPropertyAccessFromIndexSignature', ); diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index 254c48a0965c..97905879dd71 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -167,7 +167,7 @@ export default util.createRule({ | TSESTree.FunctionExpression | TSESTree.FunctionDeclaration, ): boolean { - return node.parent!.type === AST_NODE_TYPES.CallExpression; + return node.parent.type === AST_NODE_TYPES.CallExpression; } return { diff --git a/packages/eslint-plugin/src/rules/prefer-ts-expect-error.ts b/packages/eslint-plugin/src/rules/prefer-ts-expect-error.ts index 55b5d2c56eb2..8ef1c7ad9273 100644 --- a/packages/eslint-plugin/src/rules/prefer-ts-expect-error.ts +++ b/packages/eslint-plugin/src/rules/prefer-ts-expect-error.ts @@ -1,9 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_TOKEN_TYPES } from '@typescript-eslint/utils'; -import type { - RuleFix, - RuleFixer, -} from '@typescript-eslint/utils/dist/ts-eslint'; +import type { RuleFix, RuleFixer } from '@typescript-eslint/utils/ts-eslint'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/util/astUtils.ts b/packages/eslint-plugin/src/util/astUtils.ts index 9140443390c4..a4bf10251cd3 100644 --- a/packages/eslint-plugin/src/util/astUtils.ts +++ b/packages/eslint-plugin/src/util/astUtils.ts @@ -4,7 +4,7 @@ import * as ts from 'typescript'; import { escapeRegExp } from './escapeRegExp'; // deeply re-export, for convenience -export * from '@typescript-eslint/utils/dist/ast-utils'; +export * from '@typescript-eslint/utils/ast-utils'; // The following is copied from `eslint`'s source code since it doesn't exist in eslint@5. // https://github.com/eslint/eslint/blob/145aec1ab9052fbca96a44d04927c595951b1536/lib/rules/utils/ast-utils.js#L1751-L1779 diff --git a/packages/eslint-plugin/src/util/collectUnusedVariables.ts b/packages/eslint-plugin/src/util/collectUnusedVariables.ts index 97b6386063d4..a0ad2676a01b 100644 --- a/packages/eslint-plugin/src/util/collectUnusedVariables.ts +++ b/packages/eslint-plugin/src/util/collectUnusedVariables.ts @@ -1,5 +1,4 @@ -import { ImplicitLibVariable } from '@typescript-eslint/scope-manager'; -import { Visitor } from '@typescript-eslint/scope-manager/dist/referencer/Visitor'; +import { ImplicitLibVariable, Visitor } from '@typescript-eslint/scope-manager'; import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES, diff --git a/packages/eslint-plugin/tests/RuleTester.ts b/packages/eslint-plugin/tests/RuleTester.ts index 7c46b9a12f52..efeaa7077346 100644 --- a/packages/eslint-plugin/tests/RuleTester.ts +++ b/packages/eslint-plugin/tests/RuleTester.ts @@ -5,11 +5,13 @@ function getFixturesRootDir(): string { return path.join(__dirname, 'fixtures'); } -const { batchedSingleLineTests, RuleTester, noFormat } = ESLintUtils; +const { batchedSingleLineTests } = ESLintUtils; export { + RuleTester, RunTests, ValidTestCase, InvalidTestCase, -} from '@typescript-eslint/utils/dist/eslint-utils/rule-tester/RuleTester'; + noFormat, +} from '@typescript-eslint/utils/eslint-utils/rule-tester'; -export { batchedSingleLineTests, getFixturesRootDir, noFormat, RuleTester }; +export { batchedSingleLineTests, getFixturesRootDir }; diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts index 96cad00c908b..325960802d35 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts @@ -1,7 +1,7 @@ import type { InvalidTestCase, TestCaseError, -} from '@typescript-eslint/utils/dist/ts-eslint'; +} from '@typescript-eslint/utils/ts-eslint'; import * as path from 'path'; import type { diff --git a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts index ccf99b6afcbb..d69b3b27c82b 100644 --- a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts +++ b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts @@ -1,7 +1,5 @@ -import { noFormat } from '@typescript-eslint/utils/src/eslint-utils'; - import rule from '../../src/rules/promise-function-async'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir, noFormat, RuleTester } from '../RuleTester'; const rootDir = getFixturesRootDir(); const messageId = 'missingAsync'; diff --git a/packages/eslint-plugin/tsconfig.json b/packages/eslint-plugin/tsconfig.json index 7801773b539b..fa20841493ff 100644 --- a/packages/eslint-plugin/tsconfig.json +++ b/packages/eslint-plugin/tsconfig.json @@ -4,7 +4,7 @@ "composite": false, "rootDir": "." }, - "include": ["src", "typings", "tests", "tools", "index.d.ts"], + "include": ["src", "typings", "tests", "tools", "index.d.ts", "rules.d.ts"], "references": [ { "path": "../utils/tsconfig.build.json" }, { "path": "../parser/tsconfig.build.json" }, diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index cf85fd44ac26..346b72a7b263 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -143,7 +143,7 @@ declare module 'eslint/lib/rules/indent' { declare module 'eslint/lib/rules/key-spacing' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; - import type { RuleFunction } from '@typescript-eslint/utils/dist/ts-eslint'; + import type { RuleFunction } from '@typescript-eslint/utils/ts-eslint'; type Options = [ { @@ -195,7 +195,7 @@ declare module 'eslint/lib/rules/key-spacing' { declare module 'eslint/lib/rules/keyword-spacing' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; - import type { RuleFunction } from '@typescript-eslint/utils/dist/ts-eslint'; + import type { RuleFunction } from '@typescript-eslint/utils/ts-eslint'; type Options = [ { diff --git a/packages/parser/package.json b/packages/parser/package.json index dfd9b4b099d6..0b6be945670d 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -20,6 +20,9 @@ ".": { "types": "./dist/index.d.ts", "require": "./dist/index.js" + }, + "./package.json": { + "require": "./package.json" } }, "engines": { diff --git a/packages/parser/tests/lib/parser.ts b/packages/parser/tests/lib/parser.ts index e554c4bfde7c..3098152b095d 100644 --- a/packages/parser/tests/lib/parser.ts +++ b/packages/parser/tests/lib/parser.ts @@ -1,6 +1,6 @@ -import * as scopeManager from '@typescript-eslint/scope-manager/dist/analyze'; +import * as scopeManager from '@typescript-eslint/scope-manager'; import type { ParserOptions } from '@typescript-eslint/types'; -import * as typescriptESTree from '@typescript-eslint/typescript-estree/dist/parser'; +import * as typescriptESTree from '@typescript-eslint/typescript-estree'; import { parse, parseForESLint } from '../../src/parser'; diff --git a/packages/parser/tests/tools/ts-error-serializer.ts b/packages/parser/tests/tools/ts-error-serializer.ts index 6d24367a5264..5267898b5260 100644 --- a/packages/parser/tests/tools/ts-error-serializer.ts +++ b/packages/parser/tests/tools/ts-error-serializer.ts @@ -1,4 +1,4 @@ -import { TSError } from '@typescript-eslint/typescript-estree/dist/node-utils'; +import { TSError } from '@typescript-eslint/typescript-estree'; import type { Plugin } from 'pretty-format'; export const serializer: Plugin = { diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index 085c110bdb77..bf4ccd8d7728 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -20,6 +20,13 @@ ".": { "types": "./dist/index.d.ts", "require": "./dist/index.js" + }, + "./package.json": { + "require": "./package.json" + }, + "./use-at-your-own-risk/analyze": { + "types": "./dist/analyze.d.ts", + "require": "./dist/analyze.js" } }, "engines": { diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index 2221f90ceb65..d1151354b085 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -21,6 +21,9 @@ ".": { "types": "./dist/index.d.ts", "require": "./dist/index.js" + }, + "./package.json": { + "require": "./package.json" } }, "engines": { diff --git a/packages/types/package.json b/packages/types/package.json index 505fffc189bd..f73dad0fa345 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -14,6 +14,9 @@ ".": { "types": "./dist/index.d.ts", "require": "./dist/index.js" + }, + "./package.json": { + "require": "./package.json" } }, "engines": { diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 36008f93cc90..7a3e6f9d0b64 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -20,6 +20,21 @@ ".": { "types": "./dist/index.d.ts", "require": "./dist/index.js" + }, + "./package.json": { + "require": "./package.json" + }, + "./use-at-your-own-risk/ast-converter": { + "types": "./dist/ast-converter.d.ts", + "require": "./dist/ast-converter.js" + }, + "./use-at-your-own-risk/parseSettings": { + "types": "./dist/parseSettings/index.d.ts", + "require": "./dist/parseSettings/index.js" + }, + "./use-at-your-own-risk/getScriptKind": { + "types": "./dist/create-program/getScriptKind.d.ts", + "require": "./dist/create-program/getScriptKind.js" } }, "engines": { diff --git a/packages/typescript-estree/src/index.ts b/packages/typescript-estree/src/index.ts index 498082385a27..d0edaded24b6 100644 --- a/packages/typescript-estree/src/index.ts +++ b/packages/typescript-estree/src/index.ts @@ -20,6 +20,7 @@ export { createProgramFromConfigFile as createProgram } from './create-program/u export * from './create-program/getScriptKind'; export { typescriptVersionIsAtLeast } from './version-check'; export * from './getModifiers'; +export { TSError } from './node-utils'; // note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access diff --git a/packages/utils/package.json b/packages/utils/package.json index 1fa7790f3212..3bb9481a0b80 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -22,21 +22,28 @@ "types": "./dist/index.d.ts", "require": "./dist/index.js" }, - "./ASTUtils": { + "./ast-utils": { "types": "./dist/ast-utils/index.d.ts", "require": "./dist/ast-utils/index.js" }, - "./ESLintUtils": { + "./eslint-utils": { "types": "./dist/eslint-utils/index.d.ts", "require": "./dist/eslint-utils/index.js" }, - "./JSONSchema": { - "types": "./dist/json-schema/index.d.ts", - "require": "./dist/json-schema/index.js" + "./eslint-utils/rule-tester": { + "types": "./dist/eslint-utils/rule-tester/RuleTester.d.ts", + "require": "./dist/eslint-utils/rule-tester/RuleTester.js" }, - "./TSESLint": { + "./json-schema": { + "types": "./dist/json-schema.d.ts", + "require": "./dist/json-schema.js" + }, + "./ts-eslint": { "types": "./dist/ts-eslint/index.d.ts", "require": "./dist/ts-eslint/index.js" + }, + "./package.json": { + "require": "./package.json" } }, "engines": { diff --git a/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts b/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts index 7350de3a9758..84e521f325af 100644 --- a/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts +++ b/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts @@ -1,4 +1,4 @@ -import type * as TSESLintParserType from '@typescript-eslint/parser'; +import type * as TSESTreeType from '@typescript-eslint/typescript-estree'; import assert from 'assert'; import { version as eslintVersion } from 'eslint/package.json'; import * as path from 'path'; @@ -112,7 +112,7 @@ class RuleTester extends BaseRuleTester.RuleTester { try { // instead of creating a hard dependency, just use a soft require // a bit weird, but if they're using this tooling, it'll be installed - const parser = require(TS_ESLINT_PARSER) as typeof TSESLintParserType; + const parser = require(TS_ESLINT_PARSER) as typeof TSESTreeType; parser.clearCaches(); } catch { // ignored on purpose diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index 2c8b6487fbff..2f97dd25fe01 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -21,6 +21,13 @@ ".": { "types": "./dist/index.d.ts", "require": "./dist/index.js" + }, + "./package.json": { + "require": "./package.json" + }, + "./use-at-your-own-risk/visitor-keys": { + "types": "./dist/visitor-keys.d.ts", + "require": "./dist/visitor-keys.js" } }, "engines": { diff --git a/packages/website-eslint/jsconfig.json b/packages/website-eslint/jsconfig.json new file mode 100644 index 000000000000..74a4571db9a9 --- /dev/null +++ b/packages/website-eslint/jsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "composite": false, + "outDir": "./dist", + "rootDir": ".", + "resolveJsonModule": true + }, + "include": ["src", "typings", "tests", "tools"], + "references": [ + { "path": "../parser/tsconfig.build.json" }, + { "path": "../scope-manager/tsconfig.build.json" }, + { "path": "../types/tsconfig.build.json" }, + { "path": "../typescript-estree/tsconfig.build.json" }, + { "path": "../utils/tsconfig.build.json" }, + { "path": "../visitor-keys/tsconfig.build.json" } + ] +} diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json index 0823e67231a0..e2c72f190271 100644 --- a/packages/website-eslint/package.json +++ b/packages/website-eslint/package.json @@ -3,17 +3,24 @@ "version": "5.51.0", "private": true, "description": "ESLint which works in browsers.", - "engines": { - "node": "^14.18.0 || ^16.0.0 || >=18.0.0" - }, - "types": "types/index.d.ts", - "main": "dist/index.js", "files": [ "dist" ], + "type": "commonjs", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "require": "./dist/index.js" + } + }, + "engines": { + "node": "^14.18.0 || ^16.0.0 || >=18.0.0" + }, "scripts": { "build": "rollup --config=rollup.config.js", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore" + "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", + "lint": "nx lint", + "typecheck": "tsc -p jsconfig.json --noEmit" }, "dependencies": { "@typescript-eslint/types": "5.51.0", diff --git a/packages/website-eslint/rollup.config.js b/packages/website-eslint/rollup.config.js index 825b60cec254..1cadea121b3a 100644 --- a/packages/website-eslint/rollup.config.js +++ b/packages/website-eslint/rollup.config.js @@ -113,6 +113,7 @@ module.exports = { }), resolve({ browser: true, + exportConditions: ['require'], preferBuiltins: false, }), commonjs(), diff --git a/packages/website-eslint/src/linter/linter.js b/packages/website-eslint/src/linter/linter.js index fede1540f98c..9264674487a9 100644 --- a/packages/website-eslint/src/linter/linter.js +++ b/packages/website-eslint/src/linter/linter.js @@ -1,6 +1,14 @@ +/* +NOTE - this file intentionally uses deep `/use-at-your-own-risk` imports into our packages. +This is so that rollup can properly tree-shake and only include the necessary code. +This saves us having to mock unnecessary things and reduces our bundle size. +*/ +// @ts-check + import 'vs/language/typescript/tsWorker'; + +import rules from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/rules'; import { Linter } from 'eslint'; -import rules from '@typescript-eslint/eslint-plugin/dist/rules'; export function createLinter() { const linter = new Linter(); @@ -10,7 +18,7 @@ export function createLinter() { return linter; } -export { analyze } from '@typescript-eslint/scope-manager/dist/analyze'; -export { visitorKeys } from '@typescript-eslint/visitor-keys/dist/visitor-keys'; -export { astConverter } from '@typescript-eslint/typescript-estree/dist/ast-converter'; -export { getScriptKind } from '@typescript-eslint/typescript-estree/dist/create-program/getScriptKind'; +export { analyze } from '@typescript-eslint/scope-manager/use-at-your-own-risk/analyze'; +export { visitorKeys } from '@typescript-eslint/visitor-keys/use-at-your-own-risk/visitor-keys'; +export { astConverter } from '@typescript-eslint/typescript-estree/use-at-your-own-risk/ast-converter'; +export { getScriptKind } from '@typescript-eslint/typescript-estree/use-at-your-own-risk/getScriptKind'; diff --git a/packages/website-eslint/types/index.d.ts b/packages/website-eslint/types/index.d.ts deleted file mode 100644 index 7673f6d10a27..000000000000 --- a/packages/website-eslint/types/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { TSESLint } from '@typescript-eslint/utils'; - -import { analyze } from '@typescript-eslint/scope-manager/dist/analyze'; -import { astConverter } from '@typescript-eslint/typescript-estree/dist/ast-converter'; -import { getScriptKind } from '@typescript-eslint/typescript-estree/dist/create-program/getScriptKind'; - -export interface LintUtils { - createLinter: () => TSESLint.Linter; - analyze: typeof analyze; - visitorKeys: TSESLint.SourceCode.VisitorKeys; - astConverter: typeof astConverter; - getScriptKind: typeof getScriptKind; -} diff --git a/packages/website-eslint/typings/eslint.d.ts b/packages/website-eslint/typings/eslint.d.ts new file mode 100644 index 000000000000..b4be2f26a880 --- /dev/null +++ b/packages/website-eslint/typings/eslint.d.ts @@ -0,0 +1,7 @@ +// if we don't declare this, then TS in VSCode will use its "helpfully fetched" +// types and report errors in the IDE +declare module 'eslint' { + export class Linter { + defineRule(name: string, rule: unknown): void; + } +} diff --git a/packages/website/src/components/editor/config.ts b/packages/website/src/components/editor/config.ts index 2428a5502699..aee01fb11f07 100644 --- a/packages/website/src/components/editor/config.ts +++ b/packages/website/src/components/editor/config.ts @@ -1,4 +1,4 @@ -import type { JSONSchema4 } from '@typescript-eslint/utils/dist/json-schema'; +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import type Monaco from 'monaco-editor'; import { getTypescriptOptions } from '../config/utils'; diff --git a/packages/website/src/components/editor/loadSandbox.ts b/packages/website/src/components/editor/loadSandbox.ts index c92c806e4c13..db722666a729 100644 --- a/packages/website/src/components/editor/loadSandbox.ts +++ b/packages/website/src/components/editor/loadSandbox.ts @@ -1,9 +1,9 @@ -import type { LintUtils } from '@typescript-eslint/website-eslint'; import type MonacoType from 'monaco-editor'; import type * as TSType from 'typescript'; import type * as SandboxFactory from '../../vendor/sandbox'; import type * as TsWorker from '../../vendor/tsWorker'; +import type { LintUtils } from '../linter/WebLinter'; type Monaco = typeof MonacoType; type TS = typeof TSType; diff --git a/packages/website/src/components/linter/CompilerHost.ts b/packages/website/src/components/linter/CompilerHost.ts index addbff4de35e..22fd9fa83c67 100644 --- a/packages/website/src/components/linter/CompilerHost.ts +++ b/packages/website/src/components/linter/CompilerHost.ts @@ -1,6 +1,7 @@ -import type { LintUtils } from '@typescript-eslint/website-eslint'; import type { CompilerHost, SourceFile, System } from 'typescript'; +import type { LintUtils } from './WebLinter'; + /** * Creates an in-memory CompilerHost -which is essentially an extra wrapper to System * which works with TypeScript objects - returns both a compiler host, and a way to add new SourceFile diff --git a/packages/website/src/components/linter/WebLinter.ts b/packages/website/src/components/linter/WebLinter.ts index 3ffd4da2c09d..eb7c18e450c6 100644 --- a/packages/website/src/components/linter/WebLinter.ts +++ b/packages/website/src/components/linter/WebLinter.ts @@ -1,8 +1,10 @@ import { createVirtualCompilerHost } from '@site/src/components/linter/CompilerHost'; import { parseSettings } from '@site/src/components/linter/config'; +import type { analyze } from '@typescript-eslint/scope-manager'; import type { ParserOptions } from '@typescript-eslint/types'; +import type { astConverter } from '@typescript-eslint/typescript-estree/use-at-your-own-risk/ast-converter'; +import type { getScriptKind } from '@typescript-eslint/typescript-estree/use-at-your-own-risk/getScriptKind'; import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; -import type { LintUtils } from '@typescript-eslint/website-eslint'; import type { CompilerHost, CompilerOptions, @@ -12,6 +14,14 @@ import type { const PARSER_NAME = '@typescript-eslint/parser'; +export interface LintUtils { + createLinter: () => TSESLint.Linter; + analyze: typeof analyze; + visitorKeys: TSESLint.SourceCode.VisitorKeys; + astConverter: typeof astConverter; + getScriptKind: typeof getScriptKind; +} + export class WebLinter { private readonly host: CompilerHost; diff --git a/packages/website/src/components/linter/config.ts b/packages/website/src/components/linter/config.ts index 896cb25f30be..5869e7b8b0fd 100644 --- a/packages/website/src/components/linter/config.ts +++ b/packages/website/src/components/linter/config.ts @@ -1,4 +1,4 @@ -import type { ParseSettings } from '@typescript-eslint/typescript-estree/dist/parseSettings'; +import type { ParseSettings } from '@typescript-eslint/typescript-estree/use-at-your-own-risk/parseSettings'; export const parseSettings: ParseSettings = { code: '', diff --git a/patches/ts-api-utils+0.0.21.patch b/patches/ts-api-utils+0.0.21.patch new file mode 100644 index 000000000000..e7ed2ef0bdf8 --- /dev/null +++ b/patches/ts-api-utils+0.0.21.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/ts-api-utils/package.json b/node_modules/ts-api-utils/package.json +index 41ee37c..e4279d1 100644 +--- a/node_modules/ts-api-utils/package.json ++++ b/node_modules/ts-api-utils/package.json +@@ -8,7 +8,7 @@ + }, + "license": "MIT", + "author": "Josh Goldberg ", +- "type": "module", ++ "type": "commonjs", + "exports": { + ".": { + "types": "./lib/index.d.ts", diff --git a/tools/dummypkg/README.md b/tools/dummypkg/README.md new file mode 100644 index 000000000000..a1e349304774 --- /dev/null +++ b/tools/dummypkg/README.md @@ -0,0 +1,3 @@ +# dummy-pkg + +This exists as a way for us to shim-out npm packages that we don't want to install in our repo. diff --git a/tools/dummypkg/index.d.ts b/tools/dummypkg/index.d.ts new file mode 100644 index 000000000000..cb0ff5c3b541 --- /dev/null +++ b/tools/dummypkg/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/dummypkg/index.js b/tools/dummypkg/index.js new file mode 100644 index 000000000000..5a0e9a5b8214 --- /dev/null +++ b/tools/dummypkg/index.js @@ -0,0 +1 @@ +exports.value = 'a'; diff --git a/tools/dummypkg/package.json b/tools/dummypkg/package.json new file mode 100644 index 000000000000..4c5cdcf87378 --- /dev/null +++ b/tools/dummypkg/package.json @@ -0,0 +1,6 @@ +{ + "name": "dummypkg", + "version": "1.0.0", + "main": "./index.js", + "types": "./index.d.ts" +} diff --git a/tsconfig.base.json b/tsconfig.base.json index ae1ea7a55764..fd7ed6a809f3 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -5,8 +5,8 @@ "allowUnusedLabels": false, "declaration": true, "declarationMap": true, - "esModuleInterop": false, - "module": "commonjs", + "esModuleInterop": true, + "module": "Node16", "moduleResolution": "node16", "noImplicitReturns": true, "pretty": true, diff --git a/yarn.lock b/yarn.lock index 8ce0c8d22a4b..f882409b439b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3784,10 +3784,11 @@ "@svgr/plugin-jsx" "^6.2.1" "@svgr/plugin-svgo" "^6.2.0" -"@swc/core-android-arm-eabi@1.3.4", "@swc/core-android-arm-eabi@npm:dummypkg-a@1.0.0", "@swc/core-android-arm64@1.3.4", "@swc/core-android-arm64@npm:dummypkg-a@1.0.0", "@swc/core-freebsd-x64@1.3.4", "@swc/core-freebsd-x64@npm:dummypkg-a@1.0.0", "@swc/core-linux-arm-gnueabihf@1.3.4", "@swc/core-linux-arm-gnueabihf@npm:dummypkg-a@1.0.0", "@swc/core-linux-arm64-gnu@1.3.4", "@swc/core-linux-arm64-gnu@npm:dummypkg-a@1.0.0", "@swc/core-linux-arm64-musl@1.3.4", "@swc/core-linux-arm64-musl@npm:dummypkg-a@1.0.0", "@swc/core-win32-arm64-msvc@1.3.4", "@swc/core-win32-arm64-msvc@npm:dummypkg-a@1.0.0", "@swc/core-win32-ia32-msvc@1.3.4", "@swc/core-win32-ia32-msvc@npm:dummypkg-a@1.0.0": +"@swc/core-android-arm-eabi@1.3.4", "@swc/core-android-arm-eabi@file:./tools/dummypkg": + version "1.0.0" + +"@swc/core-android-arm64@1.3.4", "@swc/core-android-arm64@file:./tools/dummypkg": version "1.0.0" - resolved "https://registry.yarnpkg.com/dummypkg-a/-/dummypkg-a-1.0.0.tgz#02868251461af84d70603446ef5908b72c5c8435" - integrity sha512-V9qLfUzVlmSW/ayzlchss1XjAqWXqHmJtzGwnfg/jsnloIUyLKR5a0Djfdgj/Jv3yoNAljIUaelTVjptxtTyGA== "@swc/core-darwin-arm64@1.3.4": version "1.3.4" @@ -3799,6 +3800,18 @@ resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.3.4.tgz#4742a7f83de9f6ba50801e9f6500b538856853ea" integrity sha512-A6KMZsUJ3j5TVxAizbv+UEjCNvMgWBm9jw4R3biaw8kbgu3XUWHdkiheXO+c2kjjjgwr1jhkHcLgRjffwpLYFA== +"@swc/core-freebsd-x64@1.3.4", "@swc/core-freebsd-x64@file:./tools/dummypkg": + version "1.0.0" + +"@swc/core-linux-arm-gnueabihf@1.3.4", "@swc/core-linux-arm-gnueabihf@file:./tools/dummypkg": + version "1.0.0" + +"@swc/core-linux-arm64-gnu@1.3.4", "@swc/core-linux-arm64-gnu@file:./tools/dummypkg": + version "1.0.0" + +"@swc/core-linux-arm64-musl@1.3.4", "@swc/core-linux-arm64-musl@file:./tools/dummypkg": + version "1.0.0" + "@swc/core-linux-x64-gnu@1.3.4": version "1.3.4" resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.4.tgz#1cc63f9a86074cac7454796ccbe3836ac7f6451b" @@ -3809,6 +3822,12 @@ resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.4.tgz#f65abb7e149ad3f20ca98c933331aa98c190cd9f" integrity sha512-stVnU7KXQxSbh67UiIVxZsgjkRSXApPTEU3CYnwsdH7G+ynfO1WocSatzjIKpJfhcY2Nss8/33yDaOKZXVhbIA== +"@swc/core-win32-arm64-msvc@1.3.4", "@swc/core-win32-arm64-msvc@file:./tools/dummypkg": + version "1.0.0" + +"@swc/core-win32-ia32-msvc@1.3.4", "@swc/core-win32-ia32-msvc@file:./tools/dummypkg": + version "1.0.0" + "@swc/core-win32-x64-msvc@1.3.4": version "1.3.4" resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.4.tgz#7bf6cd6f5c3197d7d807b273d12dd666e23b238e" @@ -3958,41 +3977,19 @@ dependencies: "@types/ms" "*" -"@types/eslint-scope@^3.7.3": - version "3.7.3" - resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.3.tgz#125b88504b61e3c8bc6f870882003253005c3224" - integrity sha512-PB3ldyrcnAicT35TWPs5IcwKD8S333HMaa2VVv4+wdvebJkjWuW/xESoB8IwRcog8HYVYamb1g/R31Qv5Bx03g== - dependencies: - "@types/eslint" "*" - "@types/estree" "*" +"@types/eslint-scope@^3.7.3", "@types/eslint-scope@file:./tools/dummypkg": + version "1.0.0" "@types/eslint-visitor-keys@*", "@types/eslint-visitor-keys@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== -"@types/eslint@*": - version "7.28.2" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-7.28.2.tgz#0ff2947cdd305897c52d5372294e8c76f351db68" - integrity sha512-KubbADPkfoU75KgKeKLsFHXnU4ipH7wYg0TRT33NK3N3yiu7jlFAAoygIWBV+KbuHx/G+AvuGX6DllnK35gfJA== - dependencies: - "@types/estree" "*" - "@types/json-schema" "*" +"@types/eslint@file:./tools/dummypkg": + version "1.0.0" -"@types/estree@*", "@types/estree@^1.0.0": +"@types/estree@*", "@types/estree@0.0.39", "@types/estree@^0.0.51", "@types/estree@^1.0.0", "@types/estree@file:./tools/dummypkg": version "1.0.0" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.0.tgz#5fb2e536c1ae9bf35366eed879e827fa59ca41c2" - integrity sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ== - -"@types/estree@0.0.39": - version "0.0.39" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" - integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== - -"@types/estree@^0.0.51": - version "0.0.51" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.51.tgz#cfd70924a25a3fd32b218e5e420e6897e1ac4f40" - integrity sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ== "@types/express-serve-static-core@*", "@types/express-serve-static-core@^4.17.18": version "4.17.28" From 99b6dbe715f542542bea017be98dab4747c37252 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 13 Feb 2023 18:24:41 +1030 Subject: [PATCH 3/8] fix test --- .../src/rules/plugin-test-formatting.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts index f9d36b29de95..53f3ded9f837 100644 --- a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts +++ b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts @@ -528,7 +528,7 @@ export default createRule({ } const typeString = checker.typeToString(type); - if (/^RunTests\b/.test(typeString)) { + if (/^(TSESLint\.)?RunTests\b/.test(typeString)) { checkedObjects.add(node); for (const prop of node.properties) { @@ -558,12 +558,12 @@ export default createRule({ return; } - if (/^ValidTestCase\b/.test(typeString)) { + if (/^(TSESLint\.)?ValidTestCase\b/.test(typeString)) { checkInvalidTest(node); return; } - if (/^InvalidTestCase\b/.test(typeString)) { + if (/^(TSESLint\.)?InvalidTestCase\b/.test(typeString)) { checkInvalidTest(node); for (const testProp of node.properties) { if ( From 6c7b452b2423769ac0e1015f565c0b8ee99c8c80 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 13 Feb 2023 18:49:49 +1030 Subject: [PATCH 4/8] fix test --- package.json | 1 + .../tests/fixtures/consistent-type-exports.ts | 4 + .../tests/fixtures/tsconfig.json | 1 + .../rules/consistent-type-exports.test.ts | 118 ++++++++---------- 4 files changed, 59 insertions(+), 65 deletions(-) create mode 100644 packages/eslint-plugin/tests/fixtures/consistent-type-exports.ts diff --git a/package.json b/package.json index cd3edce0e4a3..3e4137bf55e4 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "armano2", "Jed Fox" ], + "type": "commonjs", "license": "BSD-2-Clause", "repository": "typescript-eslint/typescript-eslint", "bugs": { diff --git a/packages/eslint-plugin/tests/fixtures/consistent-type-exports.ts b/packages/eslint-plugin/tests/fixtures/consistent-type-exports.ts new file mode 100644 index 000000000000..0c883cbef773 --- /dev/null +++ b/packages/eslint-plugin/tests/fixtures/consistent-type-exports.ts @@ -0,0 +1,4 @@ +export type Type1 = 1; +export type Type2 = 1; +export const value1 = 2; +export const value2 = 2; diff --git a/packages/eslint-plugin/tests/fixtures/tsconfig.json b/packages/eslint-plugin/tests/fixtures/tsconfig.json index 7ff53268e423..b0096e33bc0a 100644 --- a/packages/eslint-plugin/tests/fixtures/tsconfig.json +++ b/packages/eslint-plugin/tests/fixtures/tsconfig.json @@ -10,6 +10,7 @@ }, "include": [ "file.ts", + "consistent-type-exports.ts", "react.tsx" ] } diff --git a/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts b/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts index e5f7bfbc2d30..5ab0edf84f1b 100644 --- a/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts @@ -15,10 +15,12 @@ const ruleTester = new RuleTester({ ruleTester.run('consistent-type-exports', rule, { valid: [ + // unknown module should be ignored "export { Foo } from 'foo';", - "export type { AnalyzeOptions } from '@typescript-eslint/scope-manager';", - "export { BlockScope } from '@typescript-eslint/utils';", - "export type { BlockScope } from '@typescript-eslint/utils';", + + "export type { Type1 } from './consistent-type-exports';", + "export { value1 } from './consistent-type-exports';", + "export type { value1 } from './consistent-type-exports';", ` const variable = 1; class Class {} @@ -53,9 +55,8 @@ export { NonTypeNS }; ], invalid: [ { - code: "export { AnalyzeOptions } from '@typescript-eslint/scope-manager';", - output: - "export type { AnalyzeOptions } from '@typescript-eslint/scope-manager';", + code: "export { Type1 } from './consistent-type-exports';", + output: "export type { Type1 } from './consistent-type-exports';", errors: [ { messageId: 'typeOverValue', @@ -65,10 +66,10 @@ export { NonTypeNS }; ], }, { - code: "export { AnalyzeOptions, BlockScope } from '@typescript-eslint/scope-manager';", + code: "export { Type1, value1 } from './consistent-type-exports';", output: - `export type { AnalyzeOptions } from '@typescript-eslint/scope-manager';\n` + - `export { BlockScope } from '@typescript-eslint/scope-manager';`, + `export type { Type1 } from './consistent-type-exports';\n` + + `export { value1 } from './consistent-type-exports';`, errors: [ { messageId: 'singleExportIsType', @@ -79,15 +80,11 @@ export { NonTypeNS }; }, { code: ` -export { - AnalyzeOptions, - BlockScope, - CatchScope, -} from '@typescript-eslint/scope-manager'; +export { Type1, value1, value2 } from './consistent-type-exports'; `, output: ` -export type { AnalyzeOptions } from '@typescript-eslint/scope-manager'; -export { BlockScope, CatchScope } from '@typescript-eslint/scope-manager'; +export type { Type1 } from './consistent-type-exports'; +export { value1, value2 } from './consistent-type-exports'; `, errors: [ { @@ -99,16 +96,11 @@ export { BlockScope, CatchScope } from '@typescript-eslint/scope-manager'; }, { code: ` -export { - AnalyzeOptions, - BlockScope, - Definition, - CatchScope, -} from '@typescript-eslint/scope-manager'; +export { Type1, value1, Type2, value2 } from './consistent-type-exports'; `, output: ` -export type { AnalyzeOptions, Definition } from '@typescript-eslint/scope-manager'; -export { BlockScope, CatchScope } from '@typescript-eslint/scope-manager'; +export type { Type1, Type2 } from './consistent-type-exports'; +export { value1, value2 } from './consistent-type-exports'; `, errors: [ { @@ -119,9 +111,8 @@ export { BlockScope, CatchScope } from '@typescript-eslint/scope-manager'; ], }, { - code: "export { Definition as Foo } from '@typescript-eslint/scope-manager';", - output: - "export type { Definition as Foo } from '@typescript-eslint/scope-manager';", + code: "export { Type2 as Foo } from './consistent-type-exports';", + output: "export type { Type2 as Foo } from './consistent-type-exports';", errors: [ { messageId: 'typeOverValue', @@ -132,14 +123,11 @@ export { BlockScope, CatchScope } from '@typescript-eslint/scope-manager'; }, { code: ` -export { - Definition as Foo, - BlockScope, -} from '@typescript-eslint/scope-manager'; +export { Type2 as Foo, value1 } from './consistent-type-exports'; `, output: ` -export type { Definition as Foo } from '@typescript-eslint/scope-manager'; -export { BlockScope } from '@typescript-eslint/scope-manager'; +export type { Type2 as Foo } from './consistent-type-exports'; +export { value1 } from './consistent-type-exports'; `, errors: [ { @@ -152,14 +140,14 @@ export { BlockScope } from '@typescript-eslint/scope-manager'; { code: ` export { - Definition as Foo, - BlockScope as BScope, - CatchScope as CScope, -} from '@typescript-eslint/scope-manager'; + Type2 as Foo, + value1 as BScope, + value2 as CScope, +} from './consistent-type-exports'; `, output: ` -export type { Definition as Foo } from '@typescript-eslint/scope-manager'; -export { BlockScope as BScope, CatchScope as CScope } from '@typescript-eslint/scope-manager'; +export type { Type2 as Foo } from './consistent-type-exports'; +export { value1 as BScope, value2 as CScope } from './consistent-type-exports'; `, errors: [ { @@ -171,12 +159,12 @@ export { BlockScope as BScope, CatchScope as CScope } from '@typescript-eslint/s }, { code: ` -import { Definition } from '@typescript-eslint/scope-manager'; -export { Definition }; +import { Type2 } from './consistent-type-exports'; +export { Type2 }; `, output: ` -import { Definition } from '@typescript-eslint/scope-manager'; -export type { Definition }; +import { Type2 } from './consistent-type-exports'; +export type { Type2 }; `, errors: [ { @@ -188,13 +176,13 @@ export type { Definition }; }, { code: ` -import { CatchScope, Definition } from '@typescript-eslint/scope-manager'; -export { CatchScope, Definition }; +import { value2, Type2 } from './consistent-type-exports'; +export { value2, Type2 }; `, output: ` -import { CatchScope, Definition } from '@typescript-eslint/scope-manager'; -export type { Definition }; -export { CatchScope }; +import { value2, Type2 } from './consistent-type-exports'; +export type { Type2 }; +export { value2 }; `, errors: [ { @@ -367,15 +355,15 @@ export type { T, T }; { code: ` export { - AnalyzeOptions, - Definition as Foo, - type BlockScope as BScope, - CatchScope as CScope, -} from '@typescript-eslint/scope-manager'; + Type1, + Type2 as Foo, + type value1 as BScope, + value2 as CScope, +} from './consistent-type-exports'; `, output: ` -export type { AnalyzeOptions, Definition as Foo, BlockScope as BScope } from '@typescript-eslint/scope-manager'; -export { CatchScope as CScope } from '@typescript-eslint/scope-manager'; +export type { Type1, Type2 as Foo, value1 as BScope } from './consistent-type-exports'; +export { value2 as CScope } from './consistent-type-exports'; `, dependencyConstraints: { typescript: '4.5', @@ -392,19 +380,19 @@ export { CatchScope as CScope } from '@typescript-eslint/scope-manager'; { code: ` export { - AnalyzeOptions, - Definition as Foo, - type BlockScope as BScope, - CatchScope as CScope, -} from '@typescript-eslint/scope-manager'; + Type1, + Type2 as Foo, + type value1 as BScope, + value2 as CScope, +} from './consistent-type-exports'; `, output: ` export { - type AnalyzeOptions, - type Definition as Foo, - type BlockScope as BScope, - CatchScope as CScope, -} from '@typescript-eslint/scope-manager'; + type Type1, + type Type2 as Foo, + type value1 as BScope, + value2 as CScope, +} from './consistent-type-exports'; `, dependencyConstraints: { typescript: '4.5', From 8ef12c905b66eec6810bb98d477b6be9c6547350 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 14 Feb 2023 16:24:52 +1030 Subject: [PATCH 5/8] remove chalk --- packages/eslint-plugin/package.json | 2 -- packages/eslint-plugin/tools/generate-configs.ts | 9 ++++++++- yarn.lock | 5 ----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 6ce2b25ee5d3..9cef37c9c9a0 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -73,9 +73,7 @@ "@types/marked": "*", "@types/natural-compare-lite": "^1.4.0", "@types/prettier": "*", - "chalk": "^5.0.1", "cross-fetch": "^3.1.5", - "grapheme-splitter": "^1.0.4", "json-schema": "*", "markdown-table": "^3.0.2", "marked": "^4.0.15", diff --git a/packages/eslint-plugin/tools/generate-configs.ts b/packages/eslint-plugin/tools/generate-configs.ts index 30132f9b0f06..19f89ca789d5 100644 --- a/packages/eslint-plugin/tools/generate-configs.ts +++ b/packages/eslint-plugin/tools/generate-configs.ts @@ -1,11 +1,18 @@ import type { TSESLint } from '@typescript-eslint/utils'; -import chalk from 'chalk'; import fs from 'fs'; import path from 'path'; import { format, resolveConfig } from 'prettier'; import rules from '../src/rules'; +// no need for us to bring in an entire dependency for a few simple terminal colors +const chalk = { + dim: (val: string): string => `\x1B[2m${val}\x1B[22m`, + green: (val: string): string => `\x1B[32m${val}\x1B[39m`, + red: (val: string): string => `\x1B[31m${val}\x1B[39m`, + yellow: (val: string): string => `\x1B[33m${val}\x1B[39m`, +}; + function addAutoGeneratedComment(code: string): string { return [ '// THIS CODE WAS AUTOMATICALLY GENERATED', diff --git a/yarn.lock b/yarn.lock index f882409b439b..6785d5a3b457 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5372,11 +5372,6 @@ chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.0.1.tgz#ca57d71e82bb534a296df63bbacc4a1c22b2a4b6" - integrity sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w== - char-regex@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" From 3cd115a4842f87ed21c95a199133cd09881f5651 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 14 Feb 2023 18:02:50 +1030 Subject: [PATCH 6/8] fix lint --- .eslintignore | 26 ++-- .eslintrc.js | 119 ++++++++++-------- nx.json | 6 +- packages/website-eslint/package.json | 1 + packages/website-eslint/project.json | 14 ++- .../website-eslint/rollup-plugin/replace.js | 4 +- packages/website-eslint/src/mock/assert.js | 2 + packages/website-eslint/src/mock/empty.js | 1 + packages/website-eslint/src/mock/is-glob.js | 1 + packages/website-eslint/src/mock/path.js | 39 +++--- packages/website-eslint/src/mock/semver.js | 3 +- .../website-eslint/src/mock/typescript.js | 1 + packages/website-eslint/src/mock/util.js | 1 + packages/website/project.json | 5 +- packages/website/src/pages/index.tsx | 2 +- .../src/theme/CodeBlock/Content/String.tsx | 2 +- .../src/vendor/ds/createDesignSystem.d.ts | 3 +- packages/website/src/vendor/playground.d.ts | 3 +- packages/website/src/vendor/sandbox.d.ts | 4 +- packages/website/src/vendor/tsWorker.d.ts | 2 +- 20 files changed, 146 insertions(+), 93 deletions(-) diff --git a/.eslintignore b/.eslintignore index 1e5cc6e0083b..c2afa7014849 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,18 +1,16 @@ -node_modules -dist -jest.config.js -fixtures -coverage -__snapshots__ -.docusaurus -build - +**/node_modules +**/dist +**/jest.config.js +**/fixtures +**/coverage +**/__snapshots__ +**/.docusaurus +**/build packages/eslint-plugin-tslint/tests +# Files copied as part of the build +packages/types/src/generated/**/*.ts +packages/website-eslint/typings/eslint.d.ts +# TODO - enable linting for JS files (need to also add them to the project.json) packages/website/**/*.js packages/website/**/*.d.ts -packages/website-eslint/**/*.js -packages/website-eslint/**/*.d.ts - -# Files copied as part of the build -packages/types/src/generated/**/*.ts diff --git a/.eslintrc.js b/.eslintrc.js index 99f3f5d3e41d..1d97b17b299d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -18,38 +18,11 @@ module.exports = { 'eslint:recommended', 'plugin:eslint-plugin/recommended', 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/recommended-requiring-type-checking', ], parserOptions: { sourceType: 'module', - project: [ - './tsconfig.eslint.json', - './packages/*/tsconfig.json', - './tests/integration/tsconfig.json', - /** - * We are currently in the process of transitioning to nx's out of the box structure and - * so need to manually specify converted packages' tsconfig.build.json and tsconfig.spec.json - * files here for now in addition to the tsconfig.json glob pattern. - * - * TODO(#4665): Clean this up once all packages have been transitioned. - */ - './packages/scope-manager/tsconfig.build.json', - './packages/scope-manager/tsconfig.spec.json', - ], - allowAutomaticSingleRunInference: true, - tsconfigRootDir: __dirname, - warnOnUnsupportedTypeScriptVersion: false, - EXPERIMENTAL_useSourceOfProjectReferenceRedirect: false, - cacheLifetime: { - // we pretty well never create/change tsconfig structure - so need to ever evict the cache - // in the rare case that we do - just need to manually restart their IDE. - glob: 'Infinity', - }, }, rules: { - // make sure we're not leveraging any deprecated APIs - 'deprecation/deprecation': 'error', - // // our plugin :D // @@ -69,8 +42,6 @@ module.exports = { 'error', { prefer: 'type-imports', disallowTypeAnnotations: true }, ], - '@typescript-eslint/explicit-function-return-type': 'error', - '@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/no-empty-function': [ 'error', { allow: ['arrowFunctions'] }, @@ -79,33 +50,13 @@ module.exports = { '@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/no-var-requires': 'off', '@typescript-eslint/prefer-for-of': 'error', - '@typescript-eslint/prefer-nullish-coalescing': 'error', - '@typescript-eslint/prefer-optional-chain': 'error', '@typescript-eslint/unbound-method': 'off', '@typescript-eslint/prefer-as-const': 'error', - '@typescript-eslint/restrict-template-expressions': [ - 'error', - { - allowNumber: true, - allowBoolean: true, - allowAny: true, - allowNullish: true, - allowRegExp: true, - }, - ], '@typescript-eslint/no-unused-vars': [ 'warn', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }, ], - // - // Internal repo rules - // - - '@typescript-eslint/internal/no-poorly-typed-ts-props': 'error', - '@typescript-eslint/internal/no-typescript-default-import': 'error', - '@typescript-eslint/internal/prefer-ast-types-enum': 'error', - // // eslint-base // @@ -202,6 +153,76 @@ module.exports = { 'one-var': ['error', 'never'], }, overrides: [ + // only turn on type-aware linting for TS files + { + files: ['*.ts', '*.tsx'], + extends: [ + 'plugin:@typescript-eslint/recommended-requiring-type-checking', + ], + parserOptions: { + project: [ + './tsconfig.eslint.json', + './packages/*/tsconfig.json', + './tests/integration/tsconfig.json', + /** + * We are currently in the process of transitioning to nx's out of the box structure and + * so need to manually specify converted packages' tsconfig.build.json and tsconfig.spec.json + * files here for now in addition to the tsconfig.json glob pattern. + * + * TODO(#4665): Clean this up once all packages have been transitioned. + */ + './packages/scope-manager/tsconfig.build.json', + './packages/scope-manager/tsconfig.spec.json', + ], + allowAutomaticSingleRunInference: true, + tsconfigRootDir: __dirname, + warnOnUnsupportedTypeScriptVersion: false, + EXPERIMENTAL_useSourceOfProjectReferenceRedirect: false, + cacheLifetime: { + // we pretty well never create/change tsconfig structure - so need to ever evict the cache + // in the rare case that we do - just need to manually restart their IDE. + glob: 'Infinity', + }, + }, + rules: { + // make sure we're not leveraging any deprecated APIs + 'deprecation/deprecation': 'error', + + // + // our plugin :D + // + '@typescript-eslint/prefer-nullish-coalescing': 'error', + '@typescript-eslint/prefer-optional-chain': 'error', + '@typescript-eslint/restrict-template-expressions': [ + 'error', + { + allowNumber: true, + allowBoolean: true, + allowAny: true, + allowNullish: true, + allowRegExp: true, + }, + ], + '@typescript-eslint/explicit-function-return-type': 'error', + '@typescript-eslint/explicit-module-boundary-types': 'off', + // we don't use classes enough in our codebase to warrant the numerous false positive against the TS API types etc + '@typescript-eslint/unbound-method': 'off', + + // + // Internal repo rules + // + + '@typescript-eslint/internal/no-poorly-typed-ts-props': 'error', + '@typescript-eslint/internal/no-typescript-default-import': 'error', + '@typescript-eslint/internal/prefer-ast-types-enum': 'error', + }, + }, + { + files: ['*.js'], + parserOptions: { + project: null, + }, + }, // all test files { files: [ diff --git a/nx.json b/nx.json index 731dc56a3c7a..7808036ede49 100644 --- a/nx.json +++ b/nx.json @@ -24,11 +24,7 @@ "outputs": ["{projectRoot}/coverage"] }, "lint": { - "inputs": [ - "default", - "{workspaceRoot}/.eslintrc.js", - "{workspaceRoot}/.eslintignore" - ] + "inputs": ["default", "{workspaceRoot}/.eslintrc.js"] } }, "namedInputs": { diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json index e2c72f190271..d20d1e97d4b0 100644 --- a/packages/website-eslint/package.json +++ b/packages/website-eslint/package.json @@ -37,6 +37,7 @@ "@typescript-eslint/typescript-estree": "5.51.0", "@typescript-eslint/visitor-keys": "5.51.0", "eslint": "*", + "magic-string": "0.25.9", "rollup": "^2.75.4", "rollup-plugin-terser": "^7.0.2", "semver": "^7.3.7" diff --git a/packages/website-eslint/project.json b/packages/website-eslint/project.json index 862c5b948f1f..5bf55d3c884e 100644 --- a/packages/website-eslint/project.json +++ b/packages/website-eslint/project.json @@ -2,5 +2,17 @@ "name": "website-eslint", "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": [ + "packages/website-eslint/**/*.ts", + "packages/website-eslint/**/*.js" + ] + } + } + } } diff --git a/packages/website-eslint/rollup-plugin/replace.js b/packages/website-eslint/rollup-plugin/replace.js index b8f3143c9050..559367c34a26 100644 --- a/packages/website-eslint/rollup-plugin/replace.js +++ b/packages/website-eslint/rollup-plugin/replace.js @@ -9,6 +9,7 @@ function toAbsolute(id) { function log(opts, message, type = 'info') { if (opts.verbose) { + // eslint-disable-next-line no-console console.log('rollup-plugin-replace > [' + type + ']', message); } } @@ -74,7 +75,8 @@ module.exports = (options = {}) => { } let match = item.test.exec(code); - let start, end; + let start; + let end; while (match) { hasReplacements = true; start = match.index; diff --git a/packages/website-eslint/src/mock/assert.js b/packages/website-eslint/src/mock/assert.js index 70cbf7a4fbce..59c25b054c17 100644 --- a/packages/website-eslint/src/mock/assert.js +++ b/packages/website-eslint/src/mock/assert.js @@ -81,6 +81,7 @@ function assert(value, message) { } } assert.equal = function equal(actual, expected, message) { + // eslint-disable-next-line eqeqeq -- intentional loose equal if (actual != expected) { fail(actual, expected, message, '==', equal); } @@ -96,6 +97,7 @@ assert.notStrictEqual = function notStrictEqual(actual, expected, message) { } }; assert.notEqual = function notEqual(actual, expected, message) { + // eslint-disable-next-line eqeqeq -- intentional loose equal if (actual == expected) { fail(actual, expected, message, '!=', notEqual); } diff --git a/packages/website-eslint/src/mock/empty.js b/packages/website-eslint/src/mock/empty.js index ff8b4c56321a..11e15179595a 100644 --- a/packages/website-eslint/src/mock/empty.js +++ b/packages/website-eslint/src/mock/empty.js @@ -1 +1,2 @@ +// eslint-disable-next-line import/no-default-export export default {}; diff --git a/packages/website-eslint/src/mock/is-glob.js b/packages/website-eslint/src/mock/is-glob.js index e35771f6460f..f8338ae73ebd 100644 --- a/packages/website-eslint/src/mock/is-glob.js +++ b/packages/website-eslint/src/mock/is-glob.js @@ -1,3 +1,4 @@ +// eslint-disable-next-line import/no-default-export export default function isGlob() { // the website config is static and doesn't use glob config return false; diff --git a/packages/website-eslint/src/mock/path.js b/packages/website-eslint/src/mock/path.js index a93a1a650d1a..4f72e5538727 100644 --- a/packages/website-eslint/src/mock/path.js +++ b/packages/website-eslint/src/mock/path.js @@ -52,7 +52,7 @@ function normalizeArray(parts, allowAboveRoot) { // Split a filename into [root, dir, basename, ext], unix version // 'root' is just a slash, or nothing. const splitPathRe = - /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/; const splitPath = function (filename) { return splitPathRe.exec(filename).slice(1); }; @@ -60,8 +60,8 @@ const splitPath = function (filename) { // path.resolve([from ...], to) // posix version export function resolve() { - let resolvedPath = '', - resolvedAbsolute = false; + let resolvedPath = ''; + let resolvedAbsolute = false; for (let i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { const path = i >= 0 ? arguments[i] : '/'; @@ -94,8 +94,8 @@ export function resolve() { // path.normalize(path) // posix version export function normalize(path) { - let isPathAbsolute = isAbsolute(path), - trailingSlash = path.endsWith('/'); + let isPathAbsolute = isAbsolute(path); + let trailingSlash = path.endsWith('/'); // Normalize the path path = normalizeArray( @@ -124,7 +124,7 @@ export function isAbsolute(path) { export function join() { const paths = Array.prototype.slice.call(arguments, 0); return normalize( - filter(paths, function (p, index) { + filter(paths, function (p) { if (typeof p !== 'string') { throw new TypeError('Arguments to path.join must be strings'); } @@ -142,15 +142,21 @@ export function relative(from, to) { function trim(arr) { let start = 0; for (; start < arr.length; start++) { - if (arr[start] !== '') break; + if (arr[start] !== '') { + break; + } } var end = arr.length - 1; for (; end >= 0; end--) { - if (arr[end] !== '') break; + if (arr[end] !== '') { + break; + } } - if (start > end) return []; + if (start > end) { + return []; + } return arr.slice(start, end - start + 1); } @@ -166,7 +172,7 @@ export function relative(from, to) { } } - const outputParts = []; + let outputParts = []; for (let i = samePartsLength; i < fromParts.length; i++) { outputParts.push('..'); } @@ -176,8 +182,8 @@ export function relative(from, to) { return outputParts.join('/'); } -export var sep = '/'; -export var delimiter = ':'; +export const sep = '/'; +export const delimiter = ':'; export function dirname(path) { const result = splitPath(path); @@ -210,6 +216,7 @@ export function extname(path) { return splitPath(path)[3]; } +// eslint-disable-next-line import/no-default-export export default { extname: extname, basename: basename, @@ -224,10 +231,14 @@ export default { }; function filter(xs, f) { - if (xs.filter) return xs.filter(f); + if (xs.filter) { + return xs.filter(f); + } const res = []; for (let i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); + if (f(xs[i], i, xs)) { + res.push(xs[i]); + } } return res; } diff --git a/packages/website-eslint/src/mock/semver.js b/packages/website-eslint/src/mock/semver.js index a7671aaaf066..a0ff9f81c77d 100644 --- a/packages/website-eslint/src/mock/semver.js +++ b/packages/website-eslint/src/mock/semver.js @@ -1,7 +1,8 @@ -import satisfies from 'semver/functions/satisfies'; import major from 'semver/functions/major'; +import satisfies from 'semver/functions/satisfies'; // just in case someone adds a import * as semver usage export { satisfies, major }; +// eslint-disable-next-line import/no-default-export export default { satisfies, major }; diff --git a/packages/website-eslint/src/mock/typescript.js b/packages/website-eslint/src/mock/typescript.js index 324b844294b5..dad0b7126061 100644 --- a/packages/website-eslint/src/mock/typescript.js +++ b/packages/website-eslint/src/mock/typescript.js @@ -1 +1,2 @@ +// eslint-disable-next-line no-undef module.exports = window.ts; diff --git a/packages/website-eslint/src/mock/util.js b/packages/website-eslint/src/mock/util.js index 3e5cd5e0e71b..35afa6a4380e 100644 --- a/packages/website-eslint/src/mock/util.js +++ b/packages/website-eslint/src/mock/util.js @@ -4,4 +4,5 @@ util.inspect = function (value) { return value; }; +// eslint-disable-next-line import/no-default-export export default util; diff --git a/packages/website/project.json b/packages/website/project.json index e7e7b0eabbfc..6f5b3f2f8ab5 100644 --- a/packages/website/project.json +++ b/packages/website/project.json @@ -8,7 +8,10 @@ "executor": "@nrwl/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/website/**/*.ts"] + "lintFilePatterns": [ + "packages/website/**/*.ts", + "packages/website/**/*.tsx" + ] } } } diff --git a/packages/website/src/pages/index.tsx b/packages/website/src/pages/index.tsx index e82e7e7495b9..fc363e49eeb4 100644 --- a/packages/website/src/pages/index.tsx +++ b/packages/website/src/pages/index.tsx @@ -161,7 +161,7 @@ function Home(): JSX.Element { key={idx} className={clsx( styles.features, - idx % 2 == 1 ? styles.lightBackground : '', + idx % 2 === 1 ? styles.lightBackground : '', )} >
diff --git a/packages/website/src/theme/CodeBlock/Content/String.tsx b/packages/website/src/theme/CodeBlock/Content/String.tsx index 9ea2df703b22..73b9a37a7dce 100644 --- a/packages/website/src/theme/CodeBlock/Content/String.tsx +++ b/packages/website/src/theme/CodeBlock/Content/String.tsx @@ -14,7 +14,7 @@ import CopyButton from '@theme/CodeBlock/CopyButton'; import Line from '@theme/CodeBlock/Line'; import WordWrapButton from '@theme/CodeBlock/WordWrapButton'; import clsx from 'clsx'; -import Highlight, { type Language, defaultProps } from 'prism-react-renderer'; +import Highlight, { defaultProps, type Language } from 'prism-react-renderer'; import React from 'react'; import styles from './styles.module.css'; diff --git a/packages/website/src/vendor/ds/createDesignSystem.d.ts b/packages/website/src/vendor/ds/createDesignSystem.d.ts index 7a506961350d..839293280c66 100644 --- a/packages/website/src/vendor/ds/createDesignSystem.d.ts +++ b/packages/website/src/vendor/ds/createDesignSystem.d.ts @@ -1,6 +1,7 @@ -import type { Sandbox } from '../sandbox'; import type { DiagnosticRelatedInformation, Node } from 'typescript'; +import type { Sandbox } from '../sandbox'; + export declare interface LocalStorageOption { blurb: string; flag: string; diff --git a/packages/website/src/vendor/playground.d.ts b/packages/website/src/vendor/playground.d.ts index 8de9141b6613..6aeebc93db2f 100644 --- a/packages/website/src/vendor/playground.d.ts +++ b/packages/website/src/vendor/playground.d.ts @@ -1,6 +1,7 @@ -import { PluginUtils } from './pluginUtils'; import type React from 'react'; +import type { PluginUtils } from './pluginUtils'; + declare type Sandbox = import('./sandbox').Sandbox; declare type Monaco = typeof import('monaco-editor'); export { PluginUtils } from './pluginUtils'; diff --git a/packages/website/src/vendor/sandbox.d.ts b/packages/website/src/vendor/sandbox.d.ts index 0bd3ecc2d259..e0a3ecdd967c 100644 --- a/packages/website/src/vendor/sandbox.d.ts +++ b/packages/website/src/vendor/sandbox.d.ts @@ -1,6 +1,6 @@ -import { TypeScriptWorker } from './tsWorker'; +import type { TypeScriptWorker } from './tsWorker'; // import lzstring from "./vendor/lzstring.min"; -import * as tsvfs from './typescript-vfs'; +import type * as tsvfs from './typescript-vfs'; declare type CompilerOptions = import('monaco-editor').languages.typescript.CompilerOptions; diff --git a/packages/website/src/vendor/tsWorker.d.ts b/packages/website/src/vendor/tsWorker.d.ts index 801ea3e43b44..7e859786726b 100644 --- a/packages/website/src/vendor/tsWorker.d.ts +++ b/packages/website/src/vendor/tsWorker.d.ts @@ -1,4 +1,4 @@ -import * as ts from 'typescript'; +import type * as ts from 'typescript'; export declare class TypeScriptWorker implements ts.LanguageServiceHost { private _ctx; From a6358630abaaba33ffaf2bc638e168a722678b31 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Wed, 22 Feb 2023 10:43:55 +1030 Subject: [PATCH 7/8] review fixes --- .../util/parsers/typescript-estree-import.ts | 1 - .../eslint-plugin-tslint/tsconfig.build.json | 1 + packages/eslint-plugin/rules.d.ts | 32 +++++++++++++++++-- packages/eslint-plugin/tsconfig.build.json | 1 + patches/eslint+8.34.0.patch | 15 +++++++++ yarn.lock | 2 +- 6 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 patches/eslint+8.34.0.patch diff --git a/packages/ast-spec/tests/util/parsers/typescript-estree-import.ts b/packages/ast-spec/tests/util/parsers/typescript-estree-import.ts index e4efe29db099..7474f4eeecc0 100644 --- a/packages/ast-spec/tests/util/parsers/typescript-estree-import.ts +++ b/packages/ast-spec/tests/util/parsers/typescript-estree-import.ts @@ -13,5 +13,4 @@ * This should be the only place in the package that we import from typescript-estree. */ -// We need to ignore this lint error regarding it being missing from the package.json, see above. export { parse } from '@typescript-eslint/typescript-estree'; diff --git a/packages/eslint-plugin-tslint/tsconfig.build.json b/packages/eslint-plugin-tslint/tsconfig.build.json index 1eb8c0821e29..86650784975c 100644 --- a/packages/eslint-plugin-tslint/tsconfig.build.json +++ b/packages/eslint-plugin-tslint/tsconfig.build.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { // specifically disable declarations for the plugin + // see reasoning in packages/eslint-plugin/rules.d.ts "declaration": false, "declarationMap": false, "outDir": "./dist", diff --git a/packages/eslint-plugin/rules.d.ts b/packages/eslint-plugin/rules.d.ts index 0b154ba78d6e..9a5272d205c3 100644 --- a/packages/eslint-plugin/rules.d.ts +++ b/packages/eslint-plugin/rules.d.ts @@ -1,10 +1,38 @@ /* -We purposely don't generate types for our plugin because: +We purposely don't generate types for our plugin because TL;DR: 1) there's no real reason that anyone should do a typed import of our rules, 2) it would require us to change our code so there aren't as many inferred types This type declaration exists as a hacky way to add a type to the export for our -internal packages that require it +internal packages that require it. + +*** Long reason *** + +When you turn on declaration files, TS requires all types to be "fully resolvable" +without changes to the code. +All of our lint rules `export default createRule(...)`, which means they all +implicitly reference the `TSESLint.Rule` type for the export. + +TS wants to transpile each rule file to this `.d.ts` file: + +```ts +import type { TSESLint } from '@typescript-eslint/utils'; +declare const _default: TSESLint.RuleModule; +export default _default; +``` + +Because we don't import `TSESLint` in most files, it means that TS would have to +insert a new import during the declaration emit to make this work. +However TS wants to avoid adding new imports to the file because a new module +could have type side-effects (like global augmentation) which could cause weird +type side-effects in the decl file that wouldn't exist in source TS file. + +So TS errors on most of our rules with the following error: +``` +The inferred type of 'default' cannot be named without a reference to +'../../../../node_modules/@typescript-eslint/utils/src/ts-eslint/Rule'. +This is likely not portable. A type annotation is necessary. ts(2742) +``` */ import type { RuleModule } from '@typescript-eslint/utils/ts-eslint'; diff --git a/packages/eslint-plugin/tsconfig.build.json b/packages/eslint-plugin/tsconfig.build.json index af60c77e84f4..49f58646073d 100644 --- a/packages/eslint-plugin/tsconfig.build.json +++ b/packages/eslint-plugin/tsconfig.build.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { // specifically disable declarations for the plugin + // see reasoning in packages/eslint-plugin/rules.d.ts "declaration": false, "declarationMap": false, "outDir": "./dist", diff --git a/patches/eslint+8.34.0.patch b/patches/eslint+8.34.0.patch new file mode 100644 index 000000000000..d9302432437b --- /dev/null +++ b/patches/eslint+8.34.0.patch @@ -0,0 +1,15 @@ +diff --git a/node_modules/eslint/lib/rules/indent.js b/node_modules/eslint/lib/rules/indent.js +index cda0203..66714b4 100644 +--- a/node_modules/eslint/lib/rules/indent.js ++++ b/node_modules/eslint/lib/rules/indent.js +@@ -12,7 +12,9 @@ + // Requirements + //------------------------------------------------------------------------------ + +-const { OrderedMap } = require("js-sdsl"); ++// make this a deep import so that rollup doesn't attempt to bundle the downleveled ESM build ++// https://github.com/js-sdsl/js-sdsl/issues/158 ++const { default: OrderedMap } = require("js-sdsl/dist/cjs/container/TreeContainer/OrderedMap"); + + const astUtils = require("./utils/ast-utils"); + diff --git a/yarn.lock b/yarn.lock index a21ab2b4af66..54d2b8cdeab0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9687,7 +9687,7 @@ lzstring.ts@^2.0.2: dependencies: tslib "^1.10.0" -magic-string@^0.25.0, magic-string@^0.25.7, magic-string@^0.25.9: +magic-string@0.25.9, magic-string@^0.25.0, magic-string@^0.25.7: version "0.25.9" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.9.tgz#de7f9faf91ef8a1c91d02c2e5314c8277dbcdd1c" integrity sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ== From 00af53f34f45f97be093f2cf093a491bbe4b20a9 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Wed, 22 Feb 2023 11:18:48 +1030 Subject: [PATCH 8/8] ci fixes --- .github/workflows/ci.yml | 1 + .../fixture.ts | 2 +- .../fixture.ts | 2 +- packages/eslint-plugin-tslint/tsconfig.json | 6 +---- .../docs/rules/no-base-to-string.md | 2 +- packages/eslint-plugin/package.json | 2 +- .../rules/no-redundant-type-constituents.ts | 2 +- .../rules/padding-line-between-statements.ts | 2 +- packages/eslint-plugin/tests/configs.test.ts | 2 +- .../tests/fixtures/mixed-enums-decl.ts | 4 +++ .../tests/fixtures/tsconfig.json | 1 + .../tests/rules/no-mixed-enums.test.ts | 18 ++++++------- ...anges.ts => generate-breaking-changes.mts} | 25 ++++++++----------- .../fixtures/scope-analysis/typeof-in-var.ts | 2 +- packages/repo-tools/jest.config.js | 1 + packages/scope-manager/tests/fixtures.test.ts | 2 +- packages/visitor-keys/src/visitor-keys.ts | 8 +++--- packages/website-eslint/jsconfig.json | 18 ------------- packages/website-eslint/package.json | 2 +- packages/website-eslint/src/mock/empty.js | 1 - packages/website-eslint/src/mock/is-glob.js | 1 - packages/website-eslint/src/mock/path.js | 1 - packages/website-eslint/src/mock/semver.js | 1 - packages/website-eslint/src/mock/util.js | 1 - packages/website-eslint/typings/eslint.d.ts | 7 ------ .../website/plugins/generated-rule-docs.ts | 4 +-- packages/website/rulesMeta.ts | 22 ++++++++-------- .../src/components/RulesTable/index.tsx | 2 +- packages/website/tests/index.spec.ts | 11 ++++++-- 29 files changed, 64 insertions(+), 89 deletions(-) create mode 100644 packages/eslint-plugin/tests/fixtures/mixed-enums-decl.ts rename packages/eslint-plugin/tools/{generate-breaking-changes.ts => generate-breaking-changes.mts} (88%) delete mode 100644 packages/website-eslint/jsconfig.json delete mode 100644 packages/website-eslint/typings/eslint.d.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75494fa75731..079ab0bce5d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -129,6 +129,7 @@ jobs: 'eslint-plugin-internal', 'eslint-plugin-tslint', 'parser', + 'repo-tools', 'scope-manager', 'type-utils', 'typescript-estree', diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts index b7726f7f1404..ec7b71c8e2b1 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts @@ -1 +1 @@ -({ prop: 'string' } satisfies { prop: string }); +({ prop: 'string' }) satisfies { prop: string }; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts index b7726f7f1404..ec7b71c8e2b1 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts @@ -1 +1 @@ -({ prop: 'string' } satisfies { prop: string }); +({ prop: 'string' }) satisfies { prop: string }; diff --git a/packages/eslint-plugin-tslint/tsconfig.json b/packages/eslint-plugin-tslint/tsconfig.json index 8d332b589a2c..4ba17c6d60ab 100644 --- a/packages/eslint-plugin-tslint/tsconfig.json +++ b/packages/eslint-plugin-tslint/tsconfig.json @@ -5,10 +5,6 @@ "rootDir": "." }, "include": ["src", "tests"], - "exclude": [ - "tests/fixture-project", - "tests/test-project", - "tests/test-tslint-rules-directory" - ], + "exclude": ["tests/fixtures"], "references": [{ "path": "../utils/tsconfig.build.json" }] } diff --git a/packages/eslint-plugin/docs/rules/no-base-to-string.md b/packages/eslint-plugin/docs/rules/no-base-to-string.md index 7409f5e134e2..a5493c7e50f3 100644 --- a/packages/eslint-plugin/docs/rules/no-base-to-string.md +++ b/packages/eslint-plugin/docs/rules/no-base-to-string.md @@ -29,7 +29,7 @@ value + ''; // Interpolation and manual .toString() calls too: `Value: ${value}`; -({}.toString()); +({}).toString(); ``` ### ✅ Correct diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 95d6652d262d..7565816652be 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -49,7 +49,7 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "generate:breaking-changes": "yarn tsx tools/generate-breaking-changes.ts", + "generate:breaking-changes": "yarn tsx tools/generate-breaking-changes.mts", "generate:configs": "yarn tsx tools/generate-configs.ts", "lint": "nx lint", "test": "jest --coverage", diff --git a/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts b/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts index d5a7f9572691..825e46405401 100644 --- a/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts +++ b/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts @@ -51,7 +51,7 @@ const keywordNodeTypesToTsTypes = new Map([ [TSESTree.AST_NODE_TYPES.TSStringKeyword, ts.TypeFlags.String], ]); -type PrimitiveTypeFlag = typeof primitiveTypeFlags[number]; +type PrimitiveTypeFlag = (typeof primitiveTypeFlags)[number]; interface TypeFlagsWithName { typeFlags: ts.TypeFlags; diff --git a/packages/eslint-plugin/src/rules/padding-line-between-statements.ts b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts index 7cadfac4613f..d92eb197ad16 100644 --- a/packages/eslint-plugin/src/rules/padding-line-between-statements.ts +++ b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts @@ -698,7 +698,7 @@ export default util.createRule({ function getPaddingType( prevNode: TSESTree.Node, nextNode: TSESTree.Node, - ): typeof PaddingTypes[keyof typeof PaddingTypes] { + ): (typeof PaddingTypes)[keyof typeof PaddingTypes] { for (let i = configureList.length - 1; i >= 0; --i) { const configure = configureList[i]; if ( diff --git a/packages/eslint-plugin/tests/configs.test.ts b/packages/eslint-plugin/tests/configs.test.ts index 4fcc7d0d5d0f..07e204e1344a 100644 --- a/packages/eslint-plugin/tests/configs.test.ts +++ b/packages/eslint-plugin/tests/configs.test.ts @@ -1,4 +1,4 @@ -import type { RuleRecommendation } from '@typescript-eslint/utils/src/ts-eslint'; +import type { RuleRecommendation } from '@typescript-eslint/utils/ts-eslint'; import plugin from '../src/index'; import rules from '../src/rules'; diff --git a/packages/eslint-plugin/tests/fixtures/mixed-enums-decl.ts b/packages/eslint-plugin/tests/fixtures/mixed-enums-decl.ts new file mode 100644 index 000000000000..df4070733679 --- /dev/null +++ b/packages/eslint-plugin/tests/fixtures/mixed-enums-decl.ts @@ -0,0 +1,4 @@ +export enum Enum { + A = 'A', + B = 'B', +} diff --git a/packages/eslint-plugin/tests/fixtures/tsconfig.json b/packages/eslint-plugin/tests/fixtures/tsconfig.json index b0096e33bc0a..6ae5e64730b1 100644 --- a/packages/eslint-plugin/tests/fixtures/tsconfig.json +++ b/packages/eslint-plugin/tests/fixtures/tsconfig.json @@ -11,6 +11,7 @@ "include": [ "file.ts", "consistent-type-exports.ts", + "mixed-enums-decl.ts", "react.tsx" ] } diff --git a/packages/eslint-plugin/tests/rules/no-mixed-enums.test.ts b/packages/eslint-plugin/tests/rules/no-mixed-enums.test.ts index 3847fda01311..b3aace8cc812 100644 --- a/packages/eslint-plugin/tests/rules/no-mixed-enums.test.ts +++ b/packages/eslint-plugin/tests/rules/no-mixed-enums.test.ts @@ -189,19 +189,19 @@ enum Foo { } `, ` -import { AST_NODE_TYPES } from '@typescript-eslint/types'; +import { Enum } from './mixed-enums-decl'; -declare module '@typescript-eslint/types' { - enum AST_NODE_TYPES { +declare module './mixed-enums-decl' { + enum Enum { StringLike = 'StringLike', } } `, ` -import { TSESTree } from '@typescript-eslint/types'; +import { Enum } from "module-that-does't-exist"; -declare module '@typescript-eslint/types' { - enum TSESTree { +declare module "module-that-doesn't-exist" { + enum Enum { StringLike = 'StringLike', } } @@ -552,10 +552,10 @@ namespace Different { }, { code: ` -import { AST_NODE_TYPES } from '@typescript-eslint/types'; +import { Enum } from './mixed-enums-decl'; -declare module '@typescript-eslint/types' { - enum AST_NODE_TYPES { +declare module './mixed-enums-decl' { + enum Enum { Numeric = 0, } } diff --git a/packages/eslint-plugin/tools/generate-breaking-changes.ts b/packages/eslint-plugin/tools/generate-breaking-changes.mts similarity index 88% rename from packages/eslint-plugin/tools/generate-breaking-changes.ts rename to packages/eslint-plugin/tools/generate-breaking-changes.mts index bb24d0ebbe17..d4ec9233e6c3 100644 --- a/packages/eslint-plugin/tools/generate-breaking-changes.ts +++ b/packages/eslint-plugin/tools/generate-breaking-changes.mts @@ -1,20 +1,17 @@ +import type { TypeScriptESLintRules } from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/rules'; import { fetch } from 'cross-fetch'; +// markdown-table is ESM, hence this file needs to be `.mts` import { markdownTable } from 'markdown-table'; -import type RulesFile from '../src/rules'; - -interface RulesObject { - default: { - default: typeof RulesFile; - }; -} - async function main(): Promise { - const { - default: { default: rules }, - } = - // @ts-expect-error -- We don't support ESM imports of local code yet. - (await import('../dist/rules/index.js')) as RulesObject; + const rulesImport = await import('../src/rules/index.js'); + /* + weird TS resolution which adds an additional default layer in the type like: + { default: { default: Rules }} + instead of just + { default: Rules } + @ts-expect-error */ + const rules = rulesImport.default as TypeScriptESLintRules; // Annotate which rules are new since the last version async function getNewRulesAsOfMajorVersion( @@ -33,7 +30,7 @@ async function main(): Promise { // Normally we wouldn't condone using the 'eval' API... // But this is an internal-only script and it's the easiest way to convert // the JS raw text into a runtime object. 🤷 - let oldRulesObject!: { rules: typeof RulesFile }; + let oldRulesObject!: { rules: TypeScriptESLintRules }; eval('oldRulesObject = ' + oldObjectText); const oldRuleNames = new Set(Object.keys(oldRulesObject.rules)); diff --git a/packages/parser/tests/fixtures/scope-analysis/typeof-in-var.ts b/packages/parser/tests/fixtures/scope-analysis/typeof-in-var.ts index 4a63a161af9d..8d34de61d71f 100644 --- a/packages/parser/tests/fixtures/scope-analysis/typeof-in-var.ts +++ b/packages/parser/tests/fixtures/scope-analysis/typeof-in-var.ts @@ -1,4 +1,4 @@ var obj = { value: 1 }; var obj2: typeof obj = { value: 2 }; var { value }: typeof obj = { value: 2 }; -var [element]: typeof obj[] = [{ value: 2 }]; +var [element]: (typeof obj)[] = [{ value: 2 }]; diff --git a/packages/repo-tools/jest.config.js b/packages/repo-tools/jest.config.js index 72e29aa600b9..7d2ec5530a19 100644 --- a/packages/repo-tools/jest.config.js +++ b/packages/repo-tools/jest.config.js @@ -5,4 +5,5 @@ module.exports = { ...require('../../jest.config.base.js'), coveragePathIgnorePatterns: ['src/index.ts$', 'src/configs/.*.ts$'], + passWithNoTests: true, }; diff --git a/packages/scope-manager/tests/fixtures.test.ts b/packages/scope-manager/tests/fixtures.test.ts index ac6b39c860ef..06af753bc52d 100644 --- a/packages/scope-manager/tests/fixtures.test.ts +++ b/packages/scope-manager/tests/fixtures.test.ts @@ -51,7 +51,7 @@ const ALLOWED_OPTIONS: Map = new Map< ]); function nestDescribe( - fixture: typeof fixtures[number], + fixture: (typeof fixtures)[number], segments = fixture.segments, ): void { if (segments.length > 0) { diff --git a/packages/visitor-keys/src/visitor-keys.ts b/packages/visitor-keys/src/visitor-keys.ts index b20b9c4396d1..fedc412a361c 100644 --- a/packages/visitor-keys/src/visitor-keys.ts +++ b/packages/visitor-keys/src/visitor-keys.ts @@ -101,14 +101,14 @@ type KeysDefinedInESLintVisitorKeysCore = // strictly type the arrays of keys provided to make sure we keep this config in sync with the type defs type AdditionalKeys = { - readonly // require keys for all nodes NOT defined in `eslint-visitor-keys` - [T in Exclude< + // require keys for all nodes NOT defined in `eslint-visitor-keys` + readonly [T in Exclude< AST_NODE_TYPES, KeysDefinedInESLintVisitorKeysCore >]: readonly GetNodeTypeKeys[]; } & { - readonly // optionally allow keys for all nodes defined in `eslint-visitor-keys` - [T in KeysDefinedInESLintVisitorKeysCore]?: readonly GetNodeTypeKeys[]; + // optionally allow keys for all nodes defined in `eslint-visitor-keys` + readonly [T in KeysDefinedInESLintVisitorKeysCore]?: readonly GetNodeTypeKeys[]; }; /** diff --git a/packages/website-eslint/jsconfig.json b/packages/website-eslint/jsconfig.json deleted file mode 100644 index 74a4571db9a9..000000000000 --- a/packages/website-eslint/jsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "composite": false, - "outDir": "./dist", - "rootDir": ".", - "resolveJsonModule": true - }, - "include": ["src", "typings", "tests", "tools"], - "references": [ - { "path": "../parser/tsconfig.build.json" }, - { "path": "../scope-manager/tsconfig.build.json" }, - { "path": "../types/tsconfig.build.json" }, - { "path": "../typescript-estree/tsconfig.build.json" }, - { "path": "../utils/tsconfig.build.json" }, - { "path": "../visitor-keys/tsconfig.build.json" } - ] -} diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json index a7426e596df9..9678f8bf7068 100644 --- a/packages/website-eslint/package.json +++ b/packages/website-eslint/package.json @@ -20,7 +20,7 @@ "build": "rollup --config=rollup.config.js", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "nx lint", - "typecheck": "tsc -p jsconfig.json --noEmit" + "typecheck": "tsc --noEmit" }, "dependencies": { "@typescript-eslint/types": "5.53.0", diff --git a/packages/website-eslint/src/mock/empty.js b/packages/website-eslint/src/mock/empty.js index 11e15179595a..ff8b4c56321a 100644 --- a/packages/website-eslint/src/mock/empty.js +++ b/packages/website-eslint/src/mock/empty.js @@ -1,2 +1 @@ -// eslint-disable-next-line import/no-default-export export default {}; diff --git a/packages/website-eslint/src/mock/is-glob.js b/packages/website-eslint/src/mock/is-glob.js index f8338ae73ebd..e35771f6460f 100644 --- a/packages/website-eslint/src/mock/is-glob.js +++ b/packages/website-eslint/src/mock/is-glob.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line import/no-default-export export default function isGlob() { // the website config is static and doesn't use glob config return false; diff --git a/packages/website-eslint/src/mock/path.js b/packages/website-eslint/src/mock/path.js index 4f72e5538727..abf5e0f2466c 100644 --- a/packages/website-eslint/src/mock/path.js +++ b/packages/website-eslint/src/mock/path.js @@ -216,7 +216,6 @@ export function extname(path) { return splitPath(path)[3]; } -// eslint-disable-next-line import/no-default-export export default { extname: extname, basename: basename, diff --git a/packages/website-eslint/src/mock/semver.js b/packages/website-eslint/src/mock/semver.js index a0ff9f81c77d..ef1ba71db660 100644 --- a/packages/website-eslint/src/mock/semver.js +++ b/packages/website-eslint/src/mock/semver.js @@ -4,5 +4,4 @@ import satisfies from 'semver/functions/satisfies'; // just in case someone adds a import * as semver usage export { satisfies, major }; -// eslint-disable-next-line import/no-default-export export default { satisfies, major }; diff --git a/packages/website-eslint/src/mock/util.js b/packages/website-eslint/src/mock/util.js index 35afa6a4380e..3e5cd5e0e71b 100644 --- a/packages/website-eslint/src/mock/util.js +++ b/packages/website-eslint/src/mock/util.js @@ -4,5 +4,4 @@ util.inspect = function (value) { return value; }; -// eslint-disable-next-line import/no-default-export export default util; diff --git a/packages/website-eslint/typings/eslint.d.ts b/packages/website-eslint/typings/eslint.d.ts deleted file mode 100644 index b4be2f26a880..000000000000 --- a/packages/website-eslint/typings/eslint.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// if we don't declare this, then TS in VSCode will use its "helpfully fetched" -// types and report errors in the IDE -declare module 'eslint' { - export class Linter { - defineRule(name: string, rule: unknown): void; - } -} diff --git a/packages/website/plugins/generated-rule-docs.ts b/packages/website/plugins/generated-rule-docs.ts index d5b9e06335e4..38300beb6c00 100644 --- a/packages/website/plugins/generated-rule-docs.ts +++ b/packages/website/plugins/generated-rule-docs.ts @@ -1,4 +1,4 @@ -import * as eslintPlugin from '@typescript-eslint/eslint-plugin'; +import pluginRules from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/rules'; import * as tseslintParser from '@typescript-eslint/parser'; import * as fs from 'fs'; import type { JSONSchema7 } from 'json-schema'; @@ -40,7 +40,7 @@ export const generatedRuleDocs: Plugin = () => { return; } - const rule = eslintPlugin.rules[file.stem]; + const rule = pluginRules[file.stem]; const meta = rule?.meta; if (!meta?.docs) { return; diff --git a/packages/website/rulesMeta.ts b/packages/website/rulesMeta.ts index 8aa5f317469f..e29058983e4d 100644 --- a/packages/website/rulesMeta.ts +++ b/packages/website/rulesMeta.ts @@ -1,15 +1,13 @@ -import * as eslintPlugin from '@typescript-eslint/eslint-plugin'; +import rules from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/rules'; -export const rulesMeta = Object.entries(eslintPlugin.rules).map( - ([name, content]) => ({ - name, - type: content.meta.type, - docs: content.meta.docs, - fixable: content.meta.fixable, - hasSuggestions: content.meta.hasSuggestions, - deprecated: content.meta.deprecated, - replacedBy: content.meta.replacedBy, - }), -); +export const rulesMeta = Object.entries(rules).map(([name, content]) => ({ + name, + type: content.meta.type, + docs: content.meta.docs, + fixable: content.meta.fixable, + hasSuggestions: content.meta.hasSuggestions, + deprecated: content.meta.deprecated, + replacedBy: content.meta.replacedBy, +})); export type RulesMeta = typeof rulesMeta; diff --git a/packages/website/src/components/RulesTable/index.tsx b/packages/website/src/components/RulesTable/index.tsx index 58e9eb6e55c6..affe196cc609 100644 --- a/packages/website/src/components/RulesTable/index.tsx +++ b/packages/website/src/components/RulesTable/index.tsx @@ -64,7 +64,7 @@ function RuleRow({ rule }: { rule: RulesMeta[number] }): JSX.Element | null { } const filterModes = ['neutral', 'include', 'exclude'] as const; -type FilterMode = typeof filterModes[number]; +type FilterMode = (typeof filterModes)[number]; function RuleFilterCheckBox({ label, diff --git a/packages/website/tests/index.spec.ts b/packages/website/tests/index.spec.ts index 77d6c73cda27..81b7f0c42d92 100644 --- a/packages/website/tests/index.spec.ts +++ b/packages/website/tests/index.spec.ts @@ -10,9 +10,16 @@ test.describe('Website', () => { test('should have no errors', async ({ page }) => { const errorMessages: string[] = []; page.on('console', msg => { - if (['error', 'warning'].includes(msg.type())) { - errorMessages.push(`[${msg.type()}] ${msg.text()}`); + const type = msg.type(); + if (!['error', 'warning'].includes(type)) { + return; } + const text = msg.text(); + // this log is fine because the ReactDOM usage is controlled by docusaurus, not us + if (text.includes('ReactDOM.render is no longer supported in React 18')) { + return; + } + errorMessages.push(`[${type}] ${text}`); }); await page.goto('/'); expect(errorMessages).toStrictEqual([]);