@typescript-eslint/typescript-estree 8.63.1-alpha.7 → 8.63.1-alpha.9
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.
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.checkSyntaxError = checkSyntaxError;
|
|
37
37
|
const ts = __importStar(require("typescript"));
|
|
38
38
|
const check_modifiers_1 = require("./check-modifiers");
|
|
39
|
+
const getImportClausePhaseModifier_1 = require("./getImportClausePhaseModifier");
|
|
39
40
|
const node_utils_1 = require("./node-utils");
|
|
40
41
|
const SyntaxKind = ts.SyntaxKind;
|
|
41
42
|
function checkSyntaxError(tsNode, parent, allowPattern) {
|
|
@@ -237,12 +238,8 @@ function checkSyntaxError(tsNode, parent, allowPattern) {
|
|
|
237
238
|
}
|
|
238
239
|
case SyntaxKind.ImportDeclaration: {
|
|
239
240
|
const { importClause } = node;
|
|
240
|
-
if (
|
|
241
|
-
|
|
242
|
-
// https://github.com/estree/estree/issues/328
|
|
243
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
244
|
-
importClause?.isTypeOnly &&
|
|
245
|
-
importClause.name &&
|
|
241
|
+
if ((0, getImportClausePhaseModifier_1.getImportClausePhaseModifier)(importClause) === 'type' &&
|
|
242
|
+
importClause?.name &&
|
|
246
243
|
importClause.namedBindings) {
|
|
247
244
|
throw (0, node_utils_1.createError)(importClause, 'A type-only import can specify a default import or named bindings, but not both.');
|
|
248
245
|
}
|
package/dist/convert.js
CHANGED
|
@@ -39,6 +39,7 @@ exports.convertError = convertError;
|
|
|
39
39
|
/* eslint-disable @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access */
|
|
40
40
|
const ts = __importStar(require("typescript"));
|
|
41
41
|
const check_syntax_errors_1 = require("./check-syntax-errors");
|
|
42
|
+
const getImportClausePhaseModifier_1 = require("./getImportClausePhaseModifier");
|
|
42
43
|
const getModifiers_1 = require("./getModifiers");
|
|
43
44
|
const node_utils_1 = require("./node-utils");
|
|
44
45
|
const ts_estree_1 = require("./ts-estree");
|
|
@@ -1252,14 +1253,14 @@ class Converter {
|
|
|
1252
1253
|
type: ts_estree_1.AST_NODE_TYPES.ImportDeclaration,
|
|
1253
1254
|
attributes: this.convertImportAttributes(node),
|
|
1254
1255
|
importKind: 'value',
|
|
1256
|
+
phase: (0, getImportClausePhaseModifier_1.getImportClausePhaseModifier)(node.importClause) === 'defer'
|
|
1257
|
+
? 'defer'
|
|
1258
|
+
: null,
|
|
1255
1259
|
source: this.convertChild(node.moduleSpecifier),
|
|
1256
1260
|
specifiers: [],
|
|
1257
1261
|
}, 'assertions', 'attributes', true));
|
|
1258
1262
|
if (node.importClause) {
|
|
1259
|
-
|
|
1260
|
-
// https://github.com/estree/estree/issues/328
|
|
1261
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1262
|
-
if (node.importClause.isTypeOnly) {
|
|
1263
|
+
if ((0, getImportClausePhaseModifier_1.getImportClausePhaseModifier)(node.importClause) === 'type') {
|
|
1263
1264
|
result.importKind = 'type';
|
|
1264
1265
|
}
|
|
1265
1266
|
if (node.importClause.name) {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getImportClausePhaseModifier = getImportClausePhaseModifier;
|
|
37
|
+
const ts = __importStar(require("typescript"));
|
|
38
|
+
const version_check_1 = require("./version-check");
|
|
39
|
+
const isAtLeast59 = version_check_1.typescriptVersionIsAtLeast['5.9'];
|
|
40
|
+
// TODO: Remove when we support TS >= 5.9
|
|
41
|
+
function getImportClausePhaseModifier(node) {
|
|
42
|
+
if (!node) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
if (isAtLeast59) {
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- guarded by TS version check.
|
|
47
|
+
return node.phaseModifier === ts.SyntaxKind.TypeKeyword
|
|
48
|
+
? 'type'
|
|
49
|
+
: // eslint-disable-next-line @typescript-eslint/no-deprecated -- guarded by TS version check
|
|
50
|
+
node.phaseModifier === ts.SyntaxKind.DeferKeyword
|
|
51
|
+
? 'defer'
|
|
52
|
+
: null;
|
|
53
|
+
}
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- guarded by TS version check
|
|
55
|
+
return node.isTypeOnly ? 'type' : null;
|
|
56
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/typescript-estree",
|
|
3
|
-
"version": "8.63.1-alpha.
|
|
3
|
+
"version": "8.63.1-alpha.9",
|
|
4
4
|
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"semver": "^7.7.3",
|
|
48
48
|
"tinyglobby": "^0.2.15",
|
|
49
49
|
"ts-api-utils": "^2.5.0",
|
|
50
|
-
"@typescript-eslint/project-service": "8.63.1-alpha.
|
|
51
|
-
"@typescript-eslint/types": "8.63.1-alpha.
|
|
52
|
-
"@typescript-eslint/
|
|
53
|
-
"@typescript-eslint/
|
|
50
|
+
"@typescript-eslint/project-service": "8.63.1-alpha.9",
|
|
51
|
+
"@typescript-eslint/types": "8.63.1-alpha.9",
|
|
52
|
+
"@typescript-eslint/visitor-keys": "8.63.1-alpha.9",
|
|
53
|
+
"@typescript-eslint/tsconfig-utils": "8.63.1-alpha.9"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@typescript/native-preview": "7.0.0-dev.20260518.1",
|