@typescript-eslint/eslint-plugin 8.72.3-alpha.4 → 8.72.3-alpha.6

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.
@@ -281,28 +281,22 @@ exports.default = (0, util_1.createRule)({
281
281
  else {
282
282
  // we have a mixed type/value import or just value imports, so we need to split them out into multiple imports if separate-type-imports is configured
283
283
  const importNames = report.typeSpecifiers.map(specifier => `"${specifier.local.name}"`);
284
- const message = (() => {
285
- const typeImports = (0, util_1.formatWordList)(importNames);
286
- if (importNames.length === 1) {
287
- return {
288
- messageId: 'someImportsAreOnlyTypes',
289
- data: {
290
- typeImports,
291
- },
292
- };
293
- }
294
- return {
295
- messageId: 'someImportsAreOnlyTypes',
296
- data: {
297
- typeImports,
298
- },
299
- };
300
- })();
284
+ const firstTypeSpecifier = report.typeSpecifiers[0];
285
+ const lastTypeSpecifier = report.typeSpecifiers[report.typeSpecifiers.length - 1];
301
286
  context.report({
302
- node: report.node,
303
- ...message,
287
+ loc: report.node.specifiers.indexOf(lastTypeSpecifier) -
288
+ report.node.specifiers.indexOf(firstTypeSpecifier) ===
289
+ report.typeSpecifiers.length - 1
290
+ ? {
291
+ start: firstTypeSpecifier.loc.start,
292
+ end: lastTypeSpecifier.loc.end,
293
+ }
294
+ : report.node.loc,
295
+ messageId: 'someImportsAreOnlyTypes',
296
+ data: {
297
+ typeImports: (0, util_1.formatWordList)(importNames),
298
+ },
304
299
  *fix(fixer) {
305
- // take all the typeSpecifiers and put them on a new line
306
300
  yield* fixToTypeImportDeclaration(fixer, report, sourceImports);
307
301
  },
308
302
  });
@@ -304,12 +304,12 @@ exports.default = (0, util_1.createRule)({
304
304
  if (uncastProps.length !== castProps.length) {
305
305
  return false;
306
306
  }
307
- const castPropNames = new Set(castProps.map(p => p.getEscapedName()));
307
+ const castPropsByName = new Map(castProps.map(p => [p.getEscapedName(), p]));
308
308
  return uncastProps.every(prop => {
309
- const name = prop.getEscapedName();
310
- return (castPropNames.has(name) &&
311
- tsutils.isPropertyReadonlyInType(uncast, name, checker) ===
312
- tsutils.isPropertyReadonlyInType(cast, name, checker));
309
+ const castProp = castPropsByName.get(prop.getEscapedName());
310
+ return (castProp != null &&
311
+ (0, util_1.isPropertyReadonlyInType)(uncast, prop, checker) ===
312
+ (0, util_1.isPropertyReadonlyInType)(cast, castProp, checker));
313
313
  });
314
314
  }
315
315
  function haveSameTypeArguments(uncast, cast) {
@@ -1,7 +1,8 @@
1
1
  import type { TSESLint } from '@typescript-eslint/utils';
2
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
3
  export declare const phrases: {
3
- readonly TSInterfaceDeclaration: 'Interface';
4
- readonly TSTypeLiteral: 'Type literal';
4
+ readonly [AST_NODE_TYPES.TSInterfaceDeclaration]: 'Interface';
5
+ readonly [AST_NODE_TYPES.TSTypeLiteral]: 'Type literal';
5
6
  };
6
7
  declare const _default: TSESLint.RuleModule<"functionTypeOverCallableType" | "unexpectedThisOnFunctionOnlyInterface", [], import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
7
8
  name: string;
@@ -37,9 +37,6 @@ export * from './skipChainExpression';
37
37
  export * from './truthinessUtils';
38
38
  export * from './walkStatements';
39
39
  export * from '@typescript-eslint/type-utils';
40
- export declare const applyDefault: typeof ESLintUtils.applyDefault, deepMerge: typeof ESLintUtils.deepMerge, getParserServices: typeof ESLintUtils.getParserServices, isObjectNotArray: typeof ESLintUtils.isObjectNotArray, nullThrows: typeof ESLintUtils.nullThrows, NullThrowsReasons: {
41
- readonly MissingParent: 'Expected node to have a parent.';
42
- readonly MissingToken: (token: string, thing: string) => string;
43
- };
40
+ export declare const { applyDefault, deepMerge, getParserServices, isObjectNotArray, nullThrows, NullThrowsReasons, }: typeof ESLintUtils;
44
41
  export type InferMessageIdsTypeFromRule<T> = ESLintUtils.InferMessageIdsTypeFromRule<T>;
45
42
  export type InferOptionsTypeFromRule<T> = ESLintUtils.InferOptionsTypeFromRule<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typescript-eslint/eslint-plugin",
3
- "version": "8.72.3-alpha.4",
3
+ "version": "8.72.3-alpha.6",
4
4
  "description": "TypeScript plugin for ESLint",
5
5
  "files": [
6
6
  "dist",
@@ -47,10 +47,10 @@
47
47
  ],
48
48
  "dependencies": {
49
49
  "@eslint-community/regexpp": "^4.12.2",
50
- "@typescript-eslint/scope-manager": "8.72.3-alpha.4",
51
- "@typescript-eslint/type-utils": "8.72.3-alpha.4",
52
- "@typescript-eslint/utils": "8.72.3-alpha.4",
53
- "@typescript-eslint/visitor-keys": "8.72.3-alpha.4",
50
+ "@typescript-eslint/scope-manager": "8.72.3-alpha.6",
51
+ "@typescript-eslint/type-utils": "8.72.3-alpha.6",
52
+ "@typescript-eslint/utils": "8.72.3-alpha.6",
53
+ "@typescript-eslint/visitor-keys": "8.72.3-alpha.6",
54
54
  "ignore": "^7.0.5",
55
55
  "natural-compare": "^1.4.0",
56
56
  "ts-api-utils": "^2.5.0"
@@ -60,9 +60,9 @@
60
60
  "@types/mdast": "^4.0.4",
61
61
  "@types/natural-compare": "^1.4.3",
62
62
  "@types/react": "^18.3.21",
63
- "@typescript-eslint/rule-schema-to-typescript-types": "8.72.3-alpha.4",
64
- "@typescript-eslint/rule-tester": "8.72.3-alpha.4",
65
- "@typescript/native": "npm:typescript@^7.0.2",
63
+ "@typescript-eslint/rule-schema-to-typescript-types": "8.72.3-alpha.6",
64
+ "@typescript-eslint/rule-tester": "8.72.3-alpha.6",
65
+ "@typescript/native": "npm:typescript@7.1.0-dev.20261009.1",
66
66
  "@vitest/coverage-v8": "^5.0.3",
67
67
  "ajv": "^6.12.6",
68
68
  "eslint": "^10.0.0",
@@ -81,7 +81,7 @@
81
81
  "vitest": "^5.0.3"
82
82
  },
83
83
  "peerDependencies": {
84
- "@typescript-eslint/parser": "^8.72.3-alpha.4",
84
+ "@typescript-eslint/parser": "^8.72.3-alpha.6",
85
85
  "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
86
86
  "typescript": ">=4.8.4 <6.1.0"
87
87
  },