@eslint-react/eslint 5.30.0-beta.1 → 5.30.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,24 +1,9 @@
1
1
  import * as ESLintUtils from "@typescript-eslint/utils/eslint-utils";
2
+ import * as tseslint from "@typescript-eslint/utils/ts-eslint";
3
+ import { ReportDescriptor, ReportFixFunction, RuleFix, RuleFixer, RuleListener, RuleListener as RuleListener$1 } from "@typescript-eslint/utils/ts-eslint";
2
4
  import { TSESTree } from "@typescript-eslint/types";
3
5
  import { ParserServicesWithTypeInformation } from "@typescript-eslint/utils";
4
6
  import ts from "typescript";
5
- import * as tseslint from "@typescript-eslint/utils/ts-eslint";
6
- import { ReportDescriptor, ReportFixFunction, RuleFix, RuleFixer, RuleListener, RuleListener as RuleListener$1 } from "@typescript-eslint/utils/ts-eslint";
7
- /**
8
- * Resolves the given node's type. Will return the type's generic constraint, if it has one.
9
- *
10
- * Warning - if the type is generic and does _not_ have a constraint, the type will be
11
- * returned as-is, rather than returning an `unknown` type. This can be checked
12
- * for by checking for the type flag ts.TypeFlags.TypeParameter.
13
- *
14
- * Adapted from `getConstrainedTypeAtLocation` in `@typescript-eslint/type-utils`
15
- * (MIT License, Copyright (c) 2019 typescript-eslint and other contributors,
16
- * https://github.com/typescript-eslint/typescript-eslint) so that consumers don't
17
- * need to load `@typescript-eslint/type-utils`, whose entry point eagerly loads
18
- * the `eslint` package.
19
- * @see https://github.com/typescript-eslint/typescript-eslint/issues/10438
20
- */
21
- export declare function getConstrainedTypeAtLocation(services: ParserServicesWithTypeInformation, node: TSESTree.Node): ts.Type;
22
7
  /**
23
8
  * Represents the ESLint rule context.
24
9
  * @since 0.0.1
@@ -49,6 +34,21 @@ export declare function getText(context: RuleContext): (node: TSESTree.Node | TS
49
34
  * @returns A function that can be used to report violations.
50
35
  */
51
36
  export declare function report(context: RuleContext): (desc?: null | ReportDescriptor<string>) => void;
37
+ /**
38
+ * Resolves the given node's type. Will return the type's generic constraint, if it has one.
39
+ *
40
+ * Warning - if the type is generic and does _not_ have a constraint, the type will be
41
+ * returned as-is, rather than returning an `unknown` type. This can be checked
42
+ * for by checking for the type flag ts.TypeFlags.TypeParameter.
43
+ *
44
+ * Adapted from `getConstrainedTypeAtLocation` in `@typescript-eslint/type-utils`
45
+ * (MIT License, Copyright (c) 2019 typescript-eslint and other contributors,
46
+ * https://github.com/typescript-eslint/typescript-eslint) so that consumers don't
47
+ * need to load `@typescript-eslint/type-utils`, whose entry point eagerly loads
48
+ * the `eslint` package.
49
+ * @see https://github.com/typescript-eslint/typescript-eslint/issues/10438
50
+ */
51
+ export declare function getConstrainedTypeAtLocation(services: ParserServicesWithTypeInformation, node: TSESTree.Node): ts.Type;
52
52
  /**
53
53
  * Merge multiple visitor objects into a single visitor object.
54
54
  *
package/dist/index.js CHANGED
@@ -1,9 +1,4 @@
1
1
  import * as ESLintUtils from "@typescript-eslint/utils/eslint-utils";
2
- // src/get-constrained-type-at-location.ts
3
- function getConstrainedTypeAtLocation(services, node) {
4
- const nodeType = services.getTypeAtLocation(node);
5
- return services.program.getTypeChecker().getBaseConstraintOfType(nodeType) ?? nodeType;
6
- }
7
2
  // src/utils.ts
8
3
  function getDocsUrl(ruleName) {
9
4
  return `https://eslint-react.xyz/docs/rules/${ruleName}`;
@@ -19,6 +14,10 @@ function report(context) {
19
14
  context.report(desc);
20
15
  };
21
16
  }
17
+ function getConstrainedTypeAtLocation(services, node) {
18
+ const nodeType = services.getTypeAtLocation(node);
19
+ return services.program.getTypeChecker().getBaseConstraintOfType(nodeType) ?? nodeType;
20
+ }
22
21
  function merge(base, ...rest) {
23
22
  for (const r of rest) for (const key in r) {
24
23
  const existing = base[key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/eslint",
3
- "version": "5.30.0-beta.1",
3
+ "version": "5.30.0-beta.10",
4
4
  "description": "ESLint React's ESLint types and utils.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -29,8 +29,8 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@typescript-eslint/types": "^8.72.0",
33
- "@typescript-eslint/utils": "^8.72.0"
32
+ "@typescript-eslint/types": "^8.72.1",
33
+ "@typescript-eslint/utils": "^8.72.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@local/configs": "0.0.0",
@@ -38,7 +38,8 @@
38
38
  "@types/node": "^20.19.43",
39
39
  "eslint": "^10.13.0",
40
40
  "tsdown": "^0.23.2",
41
- "typescript": "6.0.3"
41
+ "typescript": "6.0.3",
42
+ "vitest": "^5.0.5"
42
43
  },
43
44
  "peerDependencies": {
44
45
  "eslint": "*",