Thanks to visit codestin.com
Credit goes to github.com

Skip to content

parser.createProgram is not being exported #3514

Closed
@rdsedmundo

Description

@rdsedmundo
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

  1. mkdir typescript-eslint-bug-no-createprogram
  2. yarn init -y
  3. yarn add eslint @typescript-eslint/parser
  4. Check node_modules/@typescript-eslint/parser exports contents.

Attached screenshots at the bottom.

Expected Result

Should be exported.

Actual Result

I tried to use inside eslintrc.js and it threw saying that parser.createProgram is not defined.

Additional Info

I tried to import from @typescript-eslint/typescript-estree as well and got the same result.

Versions

package version
@typescript-eslint/parser 4.26.1
TypeScript 4.3.2
ESLint 7.28.0
node 14.17.0

Screen Shot 2021-06-11 at 16 12 22

Notice on this file above how it's missing a third import but still has a trailing comma, for some reason createProgram is getting stripped from there.

export { parse, parseForESLint, ParserOptions } from './parser';
export { ParserServices, clearCaches, } from '@typescript-eslint/typescript-estree';
export declare const version: string;
//# sourceMappingURL=index.d.ts.map

Screen Shot 2021-06-11 at 16 12 40

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = exports.clearCaches = exports.parseForESLint = exports.parse = void 0;
var parser_1 = require("./parser");
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parser_1.parse; } });
Object.defineProperty(exports, "parseForESLint", { enumerable: true, get: function () { return parser_1.parseForESLint; } });
var typescript_estree_1 = require("@typescript-eslint/typescript-estree");
Object.defineProperty(exports, "clearCaches", { enumerable: true, get: function () { return typescript_estree_1.clearCaches; } });
// note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
exports.version = require('../package.json').version;
//# sourceMappingURL=index.js.map

Metadata

Metadata

Assignees

No one assigned

    Labels

    fix: user errorissue was fixed by correcting the configuration / correcting the codepackage: parserIssues related to @typescript-eslint/parser

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions