@typescript-eslint/typescript-estree 8.64.1-alpha.0 → 8.64.1-alpha.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.
|
@@ -248,11 +248,20 @@ function checkSyntaxError(tsNode, parent, allowPattern) {
|
|
|
248
248
|
}
|
|
249
249
|
case SyntaxKind.ImportDeclaration: {
|
|
250
250
|
const { importClause } = node;
|
|
251
|
-
|
|
251
|
+
const importPhase = (0, getImportClausePhaseModifier_1.getImportClausePhaseModifier)(importClause);
|
|
252
|
+
if (importPhase === 'type' &&
|
|
252
253
|
importClause?.name &&
|
|
253
254
|
importClause.namedBindings) {
|
|
254
255
|
throw (0, node_utils_1.createError)(importClause, 'A type-only import can specify a default import or named bindings, but not both.');
|
|
255
256
|
}
|
|
257
|
+
const isNamedImport = importClause?.namedBindings?.kind === SyntaxKind.NamedImports;
|
|
258
|
+
const isDefaultImport = !!importClause?.name;
|
|
259
|
+
if (importPhase === 'defer' && isNamedImport) {
|
|
260
|
+
throw (0, node_utils_1.createError)(importClause, 'Named imports are not allowed in a deferred import.');
|
|
261
|
+
}
|
|
262
|
+
if (importPhase === 'defer' && isDefaultImport) {
|
|
263
|
+
throw (0, node_utils_1.createError)(importClause, 'Default imports are not allowed in a deferred import.');
|
|
264
|
+
}
|
|
256
265
|
assertModuleSpecifier(node, false);
|
|
257
266
|
break;
|
|
258
267
|
}
|
|
@@ -213,7 +213,7 @@ function createParseSettings(code, tsestreeOptions = {}) {
|
|
|
213
213
|
parseSettings.projectService == null) {
|
|
214
214
|
parseSettings.jsDocParsingMode = JSDocParsingMode.ParseNone;
|
|
215
215
|
}
|
|
216
|
-
(0, warnAboutTSVersion_1.
|
|
216
|
+
(0, warnAboutTSVersion_1.handleUnsupportedTSVersion)(parseSettings, tsestreeOptions.onUnsupportedTypeScriptVersion ?? 'warn', passedLoggerFn);
|
|
217
217
|
return parseSettings;
|
|
218
218
|
}
|
|
219
219
|
function clearTSConfigMatchCache() {
|
|
@@ -3,4 +3,4 @@ import type { ParseSettings } from './index';
|
|
|
3
3
|
* This needs to be kept in sync with package.json in the typescript-eslint monorepo
|
|
4
4
|
*/
|
|
5
5
|
export declare const SUPPORTED_TYPESCRIPT_VERSIONS = ">=4.8.4 <6.1.0";
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function handleUnsupportedTSVersion(parseSettings: ParseSettings, behavior: 'error' | 'ignore' | 'warn', passedLoggerFn: boolean): void;
|
|
@@ -37,7 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.SUPPORTED_TYPESCRIPT_VERSIONS = void 0;
|
|
40
|
-
exports.
|
|
40
|
+
exports.handleUnsupportedTSVersion = handleUnsupportedTSVersion;
|
|
41
41
|
const semver_1 = __importDefault(require("semver"));
|
|
42
42
|
const ts = __importStar(require("typescript"));
|
|
43
43
|
const version_1 = require("../version");
|
|
@@ -53,29 +53,38 @@ const SUPPORTED_PRERELEASE_RANGES = [];
|
|
|
53
53
|
const ACTIVE_TYPESCRIPT_VERSION = ts.version;
|
|
54
54
|
const isRunningSupportedTypeScriptVersion = semver_1.default.satisfies(ACTIVE_TYPESCRIPT_VERSION, [exports.SUPPORTED_TYPESCRIPT_VERSIONS, ...SUPPORTED_PRERELEASE_RANGES].join(' || '));
|
|
55
55
|
let warnedAboutTSVersion = false;
|
|
56
|
-
function
|
|
57
|
-
|
|
56
|
+
function buildUnsupportedTSVersionMessage(severity) {
|
|
57
|
+
const label = severity === 'error' ? 'ERROR' : 'WARNING';
|
|
58
|
+
const border = '=============';
|
|
59
|
+
return [
|
|
60
|
+
border,
|
|
61
|
+
'\n',
|
|
62
|
+
`${label}: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.`,
|
|
63
|
+
'\n',
|
|
64
|
+
`* @typescript-eslint/typescript-estree version: ${version_1.version}`,
|
|
65
|
+
`* Supported TypeScript versions: ${exports.SUPPORTED_TYPESCRIPT_VERSIONS}`,
|
|
66
|
+
`* Your TypeScript version: ${ACTIVE_TYPESCRIPT_VERSION}`,
|
|
67
|
+
'\n',
|
|
68
|
+
'Please only submit bug reports when using the officially supported version.',
|
|
69
|
+
'\n',
|
|
70
|
+
border,
|
|
71
|
+
].join('\n');
|
|
72
|
+
}
|
|
73
|
+
function handleUnsupportedTSVersion(parseSettings, behavior, passedLoggerFn) {
|
|
74
|
+
if (isRunningSupportedTypeScriptVersion || behavior === 'ignore') {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (behavior === 'error') {
|
|
78
|
+
throw new Error(buildUnsupportedTSVersionMessage('error'));
|
|
79
|
+
}
|
|
80
|
+
if (warnedAboutTSVersion) {
|
|
58
81
|
return;
|
|
59
82
|
}
|
|
60
83
|
if (passedLoggerFn ||
|
|
61
84
|
// See https://github.com/typescript-eslint/typescript-eslint/issues/7896
|
|
62
85
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
63
86
|
(typeof process === 'undefined' ? false : process.stdout?.isTTY)) {
|
|
64
|
-
|
|
65
|
-
const versionWarning = [
|
|
66
|
-
border,
|
|
67
|
-
'\n',
|
|
68
|
-
'WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.',
|
|
69
|
-
'\n',
|
|
70
|
-
`* @typescript-eslint/typescript-estree version: ${version_1.version}`,
|
|
71
|
-
`* Supported TypeScript versions: ${exports.SUPPORTED_TYPESCRIPT_VERSIONS}`,
|
|
72
|
-
`* Your TypeScript version: ${ACTIVE_TYPESCRIPT_VERSION}`,
|
|
73
|
-
'\n',
|
|
74
|
-
'Please only submit bug reports when using the officially supported version.',
|
|
75
|
-
'\n',
|
|
76
|
-
border,
|
|
77
|
-
].join('\n');
|
|
78
|
-
parseSettings.log(versionWarning);
|
|
87
|
+
parseSettings.log(buildUnsupportedTSVersionMessage('warn'));
|
|
79
88
|
}
|
|
80
89
|
warnedAboutTSVersion = true;
|
|
81
90
|
}
|
package/dist/parser-options.d.ts
CHANGED
|
@@ -64,6 +64,14 @@ interface ParseOptions {
|
|
|
64
64
|
*/
|
|
65
65
|
loc?: boolean;
|
|
66
66
|
loggerFn?: ((message: string) => void) | false;
|
|
67
|
+
/**
|
|
68
|
+
* Controls how the parser reacts when run with a TypeScript version that is
|
|
69
|
+
* not officially supported by typescript-eslint.
|
|
70
|
+
* - `'warn'` (default): log a warning via {@link loggerFn}.
|
|
71
|
+
* - `'error'`: throw, regardless of {@link loggerFn}.
|
|
72
|
+
* - `'ignore'`: do nothing.
|
|
73
|
+
*/
|
|
74
|
+
onUnsupportedTypeScriptVersion?: 'error' | 'ignore' | 'warn';
|
|
67
75
|
/**
|
|
68
76
|
* Controls whether the `range` property is included on AST nodes.
|
|
69
77
|
* The `range` property is a [number, number] which indicates the start/end index of the node in the file contents.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/typescript-estree",
|
|
3
|
-
"version": "8.64.1-alpha.
|
|
3
|
+
"version": "8.64.1-alpha.10",
|
|
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.64.1-alpha.
|
|
51
|
-
"@typescript-eslint/
|
|
52
|
-
"@typescript-eslint/
|
|
53
|
-
"@typescript-eslint/
|
|
50
|
+
"@typescript-eslint/project-service": "8.64.1-alpha.10",
|
|
51
|
+
"@typescript-eslint/visitor-keys": "8.64.1-alpha.10",
|
|
52
|
+
"@typescript-eslint/types": "8.64.1-alpha.10",
|
|
53
|
+
"@typescript-eslint/tsconfig-utils": "8.64.1-alpha.10"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@typescript/native-preview": "7.0.0-dev.20260518.1",
|
|
@@ -78,7 +78,8 @@
|
|
|
78
78
|
"lint": {
|
|
79
79
|
"command": "eslint"
|
|
80
80
|
},
|
|
81
|
-
"typecheck:tsgo": {}
|
|
81
|
+
"typecheck:tsgo": {},
|
|
82
|
+
"attw-check": {}
|
|
82
83
|
}
|
|
83
84
|
},
|
|
84
85
|
"scripts": {
|
|
@@ -88,6 +89,7 @@
|
|
|
88
89
|
"lint": "pnpm -w exec nx lint",
|
|
89
90
|
"test": "pnpm -w exec nx test",
|
|
90
91
|
"typecheck": "pnpm -w exec nx typecheck",
|
|
91
|
-
"typecheck:tsgo": "pnpm -w exec nx typecheck:tsgo"
|
|
92
|
+
"typecheck:tsgo": "pnpm -w exec nx typecheck:tsgo",
|
|
93
|
+
"attw-check": "pnpm -w exec nx attw-check"
|
|
92
94
|
}
|
|
93
95
|
}
|