Skip to content

Plugin create and onConfigurationChanged config-confusion #37470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
neurolag opened this issue Mar 19, 2020 · 1 comment
Closed

Plugin create and onConfigurationChanged config-confusion #37470

neurolag opened this issue Mar 19, 2020 · 1 comment
Assignees
Labels
Duplicate An existing issue was already created Needs Investigation This issue needs a team member to investigate its status. Rescheduled This issue was previously scheduled to an earlier milestone

Comments

@neurolag
Copy link
Contributor

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.

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Mar 19, 2020
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.0 milestone Mar 19, 2020
@RyanCavanaugh RyanCavanaugh added the Rescheduled This issue was previously scheduled to an earlier milestone label Aug 31, 2020
@sheetalkamat
Copy link
Member

Duplicate of #28969

@sheetalkamat sheetalkamat marked this as a duplicate of #28969 Jan 5, 2021
@sheetalkamat sheetalkamat added the Duplicate An existing issue was already created label Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created Needs Investigation This issue needs a team member to investigate its status. Rescheduled This issue was previously scheduled to an earlier milestone
Projects
None yet
Development

No branches or pull requests

3 participants