@depup/typescript-eslint__parser 8.57.1-depup.0
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/LICENSE +21 -0
- package/README.md +25 -0
- package/changes.json +5 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +17 -0
- package/dist/parser.d.ts +22 -0
- package/dist/parser.js +139 -0
- package/package.json +96 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 typescript-eslint and other contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @depup/typescript-eslint__parser
|
|
2
|
+
|
|
3
|
+
> Dependency-bumped version of [@typescript-eslint/parser](https://www.npmjs.com/package/@typescript-eslint/parser)
|
|
4
|
+
|
|
5
|
+
Generated by [DepUp](https://github.com/depup/npm) -- all production
|
|
6
|
+
dependencies bumped to latest versions.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @depup/typescript-eslint__parser
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
| Field | Value |
|
|
15
|
+
|-------|-------|
|
|
16
|
+
| Original | [@typescript-eslint/parser](https://www.npmjs.com/package/@typescript-eslint/parser) @ 8.57.1 |
|
|
17
|
+
| Processed | 2026-03-17 |
|
|
18
|
+
| Smoke test | passed |
|
|
19
|
+
| Deps updated | 0 |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/@typescript-eslint/parser
|
|
24
|
+
|
|
25
|
+
License inherited from the original package.
|
package/changes.json
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { parse, parseForESLint, type ParserOptions } from './parser';
|
|
2
|
+
export { clearCaches, createProgram, type ParserServices, type ParserServicesWithoutTypeInformation, type ParserServicesWithTypeInformation, withoutProjectParserOptions, } from '@typescript-eslint/typescript-estree';
|
|
3
|
+
export declare const version: string;
|
|
4
|
+
export declare const meta: {
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.meta = exports.version = exports.withoutProjectParserOptions = exports.createProgram = exports.clearCaches = exports.parseForESLint = exports.parse = void 0;
|
|
4
|
+
var parser_1 = require("./parser");
|
|
5
|
+
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parser_1.parse; } });
|
|
6
|
+
Object.defineProperty(exports, "parseForESLint", { enumerable: true, get: function () { return parser_1.parseForESLint; } });
|
|
7
|
+
var typescript_estree_1 = require("@typescript-eslint/typescript-estree");
|
|
8
|
+
Object.defineProperty(exports, "clearCaches", { enumerable: true, get: function () { return typescript_estree_1.clearCaches; } });
|
|
9
|
+
Object.defineProperty(exports, "createProgram", { enumerable: true, get: function () { return typescript_estree_1.createProgram; } });
|
|
10
|
+
Object.defineProperty(exports, "withoutProjectParserOptions", { enumerable: true, get: function () { return typescript_estree_1.withoutProjectParserOptions; } });
|
|
11
|
+
// note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
13
|
+
exports.version = require('../package.json').version;
|
|
14
|
+
exports.meta = {
|
|
15
|
+
name: 'typescript-eslint/parser',
|
|
16
|
+
version: exports.version,
|
|
17
|
+
};
|
package/dist/parser.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ScopeManager } from '@typescript-eslint/scope-manager';
|
|
2
|
+
import type { ParserOptions, TSESTree } from '@typescript-eslint/types';
|
|
3
|
+
import type { AST, ParserServices } from '@typescript-eslint/typescript-estree';
|
|
4
|
+
import type { VisitorKeys } from '@typescript-eslint/visitor-keys';
|
|
5
|
+
import type * as ts from 'typescript';
|
|
6
|
+
interface ESLintProgram extends AST<{
|
|
7
|
+
comment: true;
|
|
8
|
+
tokens: true;
|
|
9
|
+
}> {
|
|
10
|
+
comments: TSESTree.Comment[];
|
|
11
|
+
range: [number, number];
|
|
12
|
+
tokens: TSESTree.Token[];
|
|
13
|
+
}
|
|
14
|
+
interface ParseForESLintResult {
|
|
15
|
+
ast: ESLintProgram;
|
|
16
|
+
scopeManager: ScopeManager;
|
|
17
|
+
services: ParserServices;
|
|
18
|
+
visitorKeys: VisitorKeys;
|
|
19
|
+
}
|
|
20
|
+
export declare function parse(code: string | ts.SourceFile, options?: ParserOptions): ParseForESLintResult['ast'];
|
|
21
|
+
export declare function parseForESLint(code: string | ts.SourceFile, parserOptions?: ParserOptions | null): ParseForESLintResult;
|
|
22
|
+
export type { ParserOptions } from '@typescript-eslint/types';
|
package/dist/parser.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parse = parse;
|
|
7
|
+
exports.parseForESLint = parseForESLint;
|
|
8
|
+
const scope_manager_1 = require("@typescript-eslint/scope-manager");
|
|
9
|
+
const typescript_estree_1 = require("@typescript-eslint/typescript-estree");
|
|
10
|
+
const visitor_keys_1 = require("@typescript-eslint/visitor-keys");
|
|
11
|
+
const debug_1 = __importDefault(require("debug"));
|
|
12
|
+
const typescript_1 = require("typescript");
|
|
13
|
+
const log = (0, debug_1.default)('typescript-eslint:parser:parser');
|
|
14
|
+
function validateBoolean(value, fallback = false) {
|
|
15
|
+
if (typeof value !== 'boolean') {
|
|
16
|
+
return fallback;
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
const LIB_FILENAME_REGEX = /lib\.(.+)\.d\.[cm]?ts$/;
|
|
21
|
+
function getLib(compilerOptions) {
|
|
22
|
+
if (compilerOptions.lib) {
|
|
23
|
+
return compilerOptions.lib
|
|
24
|
+
.map(lib => LIB_FILENAME_REGEX.exec(lib.toLowerCase())?.[1])
|
|
25
|
+
.filter((lib) => !!lib);
|
|
26
|
+
}
|
|
27
|
+
const target = compilerOptions.target ?? typescript_1.ScriptTarget.ES5;
|
|
28
|
+
// https://github.com/microsoft/TypeScript/blob/ae582a22ee1bb052e19b7c1bc4cac60509b574e0/src/compiler/utilitiesPublic.ts#L13-L36
|
|
29
|
+
switch (target) {
|
|
30
|
+
case typescript_1.ScriptTarget.ES2015:
|
|
31
|
+
return ['es6'];
|
|
32
|
+
case typescript_1.ScriptTarget.ES2016:
|
|
33
|
+
return ['es2016.full'];
|
|
34
|
+
case typescript_1.ScriptTarget.ES2017:
|
|
35
|
+
return ['es2017.full'];
|
|
36
|
+
case typescript_1.ScriptTarget.ES2018:
|
|
37
|
+
return ['es2018.full'];
|
|
38
|
+
case typescript_1.ScriptTarget.ES2019:
|
|
39
|
+
return ['es2019.full'];
|
|
40
|
+
case typescript_1.ScriptTarget.ES2020:
|
|
41
|
+
return ['es2020.full'];
|
|
42
|
+
case typescript_1.ScriptTarget.ES2021:
|
|
43
|
+
return ['es2021.full'];
|
|
44
|
+
case typescript_1.ScriptTarget.ES2022:
|
|
45
|
+
return ['es2022.full'];
|
|
46
|
+
case typescript_1.ScriptTarget.ES2023:
|
|
47
|
+
return ['es2023.full'];
|
|
48
|
+
case typescript_1.ScriptTarget.ES2024:
|
|
49
|
+
return ['es2024.full'];
|
|
50
|
+
case typescript_1.ScriptTarget.ESNext:
|
|
51
|
+
return ['esnext.full'];
|
|
52
|
+
default:
|
|
53
|
+
return ['lib'];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function parse(code, options) {
|
|
57
|
+
return parseForESLint(code, options).ast;
|
|
58
|
+
}
|
|
59
|
+
function parseForESLint(code, parserOptions) {
|
|
60
|
+
if (!parserOptions || typeof parserOptions !== 'object') {
|
|
61
|
+
parserOptions = {};
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
parserOptions = { ...parserOptions };
|
|
65
|
+
}
|
|
66
|
+
// https://eslint.org/docs/user-guide/configuring#specifying-parser-options
|
|
67
|
+
// if sourceType is not provided by default eslint expect that it will be set to "script"
|
|
68
|
+
if (parserOptions.sourceType !== 'module' &&
|
|
69
|
+
parserOptions.sourceType !== 'script') {
|
|
70
|
+
parserOptions.sourceType = 'script';
|
|
71
|
+
}
|
|
72
|
+
if (typeof parserOptions.ecmaFeatures !== 'object') {
|
|
73
|
+
parserOptions.ecmaFeatures = {};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Allow the user to suppress the warning from typescript-estree if they are using an unsupported
|
|
77
|
+
* version of TypeScript
|
|
78
|
+
*/
|
|
79
|
+
const warnOnUnsupportedTypeScriptVersion = validateBoolean(parserOptions.warnOnUnsupportedTypeScriptVersion, true);
|
|
80
|
+
const tsestreeOptions = {
|
|
81
|
+
jsx: validateBoolean(parserOptions.ecmaFeatures.jsx),
|
|
82
|
+
...(!warnOnUnsupportedTypeScriptVersion && { loggerFn: false }),
|
|
83
|
+
...parserOptions,
|
|
84
|
+
// Override errorOnTypeScriptSyntacticAndSemanticIssues and set it to false to prevent use from user config
|
|
85
|
+
// https://github.com/typescript-eslint/typescript-eslint/issues/8681#issuecomment-2000411834
|
|
86
|
+
errorOnTypeScriptSyntacticAndSemanticIssues: false,
|
|
87
|
+
// comment, loc, range, and tokens should always be set for ESLint usage
|
|
88
|
+
// https://github.com/typescript-eslint/typescript-eslint/issues/8347
|
|
89
|
+
comment: true,
|
|
90
|
+
loc: true,
|
|
91
|
+
range: true,
|
|
92
|
+
tokens: true,
|
|
93
|
+
};
|
|
94
|
+
const analyzeOptions = {
|
|
95
|
+
globalReturn: parserOptions.ecmaFeatures.globalReturn,
|
|
96
|
+
jsxFragmentName: parserOptions.jsxFragmentName,
|
|
97
|
+
jsxPragma: parserOptions.jsxPragma,
|
|
98
|
+
lib: parserOptions.lib,
|
|
99
|
+
sourceType: parserOptions.sourceType,
|
|
100
|
+
};
|
|
101
|
+
const { ast, services } = (0, typescript_estree_1.parseAndGenerateServices)(code, tsestreeOptions);
|
|
102
|
+
ast.sourceType = parserOptions.sourceType;
|
|
103
|
+
if (services.program) {
|
|
104
|
+
// automatically apply the options configured for the program
|
|
105
|
+
const compilerOptions = services.program.getCompilerOptions();
|
|
106
|
+
if (analyzeOptions.lib == null) {
|
|
107
|
+
analyzeOptions.lib = getLib(compilerOptions);
|
|
108
|
+
log('Resolved libs from program: %o', analyzeOptions.lib);
|
|
109
|
+
}
|
|
110
|
+
if (
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/internal/eqeq-nullish
|
|
112
|
+
analyzeOptions.jsxPragma === undefined &&
|
|
113
|
+
compilerOptions.jsxFactory != null) {
|
|
114
|
+
// in case the user has specified something like "preact.h"
|
|
115
|
+
const factory = compilerOptions.jsxFactory.split('.')[0].trim();
|
|
116
|
+
analyzeOptions.jsxPragma = factory;
|
|
117
|
+
log('Resolved jsxPragma from program: %s', analyzeOptions.jsxPragma);
|
|
118
|
+
}
|
|
119
|
+
if (
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/internal/eqeq-nullish
|
|
121
|
+
analyzeOptions.jsxFragmentName === undefined &&
|
|
122
|
+
compilerOptions.jsxFragmentFactory != null) {
|
|
123
|
+
// in case the user has specified something like "preact.Fragment"
|
|
124
|
+
const fragFactory = compilerOptions.jsxFragmentFactory
|
|
125
|
+
.split('.')[0]
|
|
126
|
+
.trim();
|
|
127
|
+
analyzeOptions.jsxFragmentName = fragFactory;
|
|
128
|
+
log('Resolved jsxFragmentName from program: %s', analyzeOptions.jsxFragmentName);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const scopeManager = (0, scope_manager_1.analyze)(ast, analyzeOptions);
|
|
132
|
+
// if not defined - override from the parserOptions
|
|
133
|
+
services.emitDecoratorMetadata ??=
|
|
134
|
+
parserOptions.emitDecoratorMetadata === true;
|
|
135
|
+
services.experimentalDecorators ??=
|
|
136
|
+
parserOptions.experimentalDecorators === true;
|
|
137
|
+
services.isolatedDeclarations ??= parserOptions.isolatedDeclarations === true;
|
|
138
|
+
return { ast, scopeManager, services, visitorKeys: visitor_keys_1.visitorKeys };
|
|
139
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@depup/typescript-eslint__parser",
|
|
3
|
+
"version": "8.57.1-depup.0",
|
|
4
|
+
"description": "[DepUp] An ESLint custom parser which leverages TypeScript ESTree",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"!*.tsbuildinfo",
|
|
8
|
+
"README.md",
|
|
9
|
+
"LICENSE",
|
|
10
|
+
"changes.json"
|
|
11
|
+
],
|
|
12
|
+
"type": "commonjs",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./package.json": "./package.json"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/typescript-eslint/typescript-eslint.git",
|
|
26
|
+
"directory": "packages/parser"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/typescript-eslint/typescript-eslint/issues"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://typescript-eslint.io/packages/parser",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"keywords": [
|
|
34
|
+
"depup",
|
|
35
|
+
"dependency-bumped",
|
|
36
|
+
"updated-deps",
|
|
37
|
+
"@typescript-eslint/parser",
|
|
38
|
+
"ast",
|
|
39
|
+
"ecmascript",
|
|
40
|
+
"javascript",
|
|
41
|
+
"typescript",
|
|
42
|
+
"parser",
|
|
43
|
+
"syntax",
|
|
44
|
+
"eslint"
|
|
45
|
+
],
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
|
|
48
|
+
"typescript": ">=4.8.4 <6.0.0"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"debug": "^4.4.3",
|
|
52
|
+
"@typescript-eslint/scope-manager": "8.57.1",
|
|
53
|
+
"@typescript-eslint/types": "8.57.1",
|
|
54
|
+
"@typescript-eslint/typescript-estree": "8.57.1",
|
|
55
|
+
"@typescript-eslint/visitor-keys": "8.57.1"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
59
|
+
"eslint": "^10.0.0",
|
|
60
|
+
"glob": "^11.1.0",
|
|
61
|
+
"rimraf": "^5.0.10",
|
|
62
|
+
"typescript": ">=4.8.4 <6.0.0",
|
|
63
|
+
"vitest": "^4.0.18"
|
|
64
|
+
},
|
|
65
|
+
"funding": {
|
|
66
|
+
"type": "opencollective",
|
|
67
|
+
"url": "https://opencollective.com/typescript-eslint"
|
|
68
|
+
},
|
|
69
|
+
"nx": {
|
|
70
|
+
"name": "parser",
|
|
71
|
+
"includedScripts": [
|
|
72
|
+
"clean"
|
|
73
|
+
],
|
|
74
|
+
"targets": {
|
|
75
|
+
"lint": {
|
|
76
|
+
"command": "eslint"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"scripts": {
|
|
81
|
+
"build": "pnpm exec nx build",
|
|
82
|
+
"clean": "rimraf dist/ coverage/",
|
|
83
|
+
"format": "pnpm -w run format",
|
|
84
|
+
"lint": "pnpm -w exec nx lint",
|
|
85
|
+
"test": "pnpm -w exec nx test",
|
|
86
|
+
"typecheck": "pnpm -w exec nx typecheck"
|
|
87
|
+
},
|
|
88
|
+
"depup": {
|
|
89
|
+
"changes": {},
|
|
90
|
+
"depsUpdated": 0,
|
|
91
|
+
"originalPackage": "@typescript-eslint/parser",
|
|
92
|
+
"originalVersion": "8.57.1",
|
|
93
|
+
"processedAt": "2026-03-17T16:33:38.262Z",
|
|
94
|
+
"smokeTest": "passed"
|
|
95
|
+
}
|
|
96
|
+
}
|