8000 --fix flag doesn't work with custom Program · Issue #3834 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content
--fix flag doesn't work with custom Program #3834
Open
@rdsedmundo

Description

@rdsedmundo
  • I have tried resta 772B rting 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

import { logger } from '@charityvest/lambda';

const a = {};
// ["test"] is better written in dot notation. (eslint@typescript-eslint/dot-notation)
logger.info(a['test']);

function b() {
  return true;
}

logger.info(b());
const parsedTsConfig = ts.getParsedCommandLineOfConfigFile(
  './tsconfig.json',
  /*compilerOptionsToExtend*/ undefined,
  { ...ts.sys },
);

const compilerHost = ts.createCompilerHost(parsedTsConfig.options, true);
const program = ts.createProgram(parsedTsConfig.fileNames, parsedTsConfig.options, compilerHost);

// the code you're using to do the parse of the aforementioned code
module.exports = {
  parserOptions: {
    programs: [program],
  },
}

Expected Result

import { logger } from '@charityvest/lambda';

const a = {};
logger.info(a.test);

function b() {
  return true;
}

logger.info(b());

Actual Result

import { logger } from '@charityvest/lambda';

const a = {};
logger.info(a.test true;
}

logger.info(b());

Additional Info

I saw that the allowAutomaticSingleRunInference added a workaround for this by checking if a file has been called inside the parserAndGenerateServices more than once, but unfortunately, there's no way for me to access that from the ESLint config file just. This really limits the usage of the custom Programs functionality if someone relies on the --fix flag.

Versions

package version
@typescript-eslint/typescript-estree 4.29.3
TypeScript 4.3.2
node 4.17.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked by external APIBlocked by a tool we depend on exposing an API, such as TypeScript's Type Relationship APIpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estree

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0