Skip to content

config file not correctly processed #331

@mvolkmann

Description

@mvolkmann

Checklist

  • Did you run the analyzer with the --dev flag to get more information?
  • Did you create a minimal reproduction in the playground? I don't see a way to use a config file in the playground.

I have a project that contains a custom-elements-manifest.config.js file that contains the following:

export default {
  exclude: [
    "coverage/**",
    "src/stories/**",
    "storybook-static/**",
  ],
};

The excludes are not being honored, as evidenced by the generated custom-elements.json file containing descriptions of things found in files under the coverage directory. I debugged this and discovered an issue in the getUserConfig function defined in packages/analyzer/src/utils/cli-helpers.js. The object it returns looks like this:

{
  __esModule: true,
  default: {
    exclude: [
      'coverage/**',
      'custom-elements-manifest/**',
      'src/stories/**',
      'storybook-static/**'
    ]
  }
}

I expected it to look like this:

{
  exclude: [
    'coverage/**',
    'custom-elements-manifest/**',
    'src/stories/**',
    'storybook-static/**'
  ]
}

This is a problem in the mergeGlobsAndExcludes function which contains this line:

    ...(userConfig?.exclude?.map((i) => `!${i}`) || []),

The reason is that the userConfig object doesn't have an exclude property. Instead it has a default property whose value is an object that has an exclude property.

Expected behavior

I expected the excludes described in the config file to be honored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions