Skip to content

Plugin create and onConfigurationChanged config-confusion #37470

@neurolag

Description

@neurolag

TypeScript Version: 3.7.x-dev.20200318

Search Terms:

  • Plugin
  • Configuration
  • Global Plugin

Code
https://github.com/manuth/TypeScriptESLintPlugin/tree/2e55e4533755ec6cadce9b980e23c140494a1ddf

export = ({ typescript }) => {
    return {
        create: (createInfo) => {
            console.log(createInfo.config);
        },
        onConfigurationChanged: (config) => {
            console.log(config);
        }
}

When working with local plugins only, each time I update the tsconfig.json-file, create is invoked with its createInfo.config set to the configuration I set in the tsconfig.json-file.

When enabling the plugin globally, creationInfo.config is set to the tsconfig.json-file only the very first time. In all consequent invokations the createInfo.config-object looks as followed:

{ name: "typescript-eslint-plugin" }

It gets overwritten at this piece of code:

if (configurationOverride) {
// Preserve the name property since it's immutable
const pluginName = pluginConfigEntry.name;
pluginConfigEntry = configurationOverride;
pluginConfigEntry.name = pluginName;
}

Expected behavior:
I'd expect TypeScript to invoke onConfigurationChanged each time a global configuration (a config-override) changes and to invoke create each time the plugin changes in tsconfig.json with createInfo.config set to the configuration inside the tsconfig.json file.

Actual behavior:
Though onConfigurationChanged is invoked each time a global configuration changes and create is called each time the tsconfig.json-file changes, the createInfo.config-object only contains the tsconfig.json-settings the very first time. That way I cannot load future changes that are made to the tsconfig.json.

Metadata

Metadata

Assignees

Labels

DuplicateAn existing issue was already createdNeeds InvestigationThis issue needs a team member to investigate its status.RescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions