<commit_before>/* eslint-disable new-cap */
/* eslint-disable no-underscore-dangle */
import { ArgTypes } from '@storybook/api';

import { ArgTypesExtractor, hasDocgen, extractComponentProps } from '../../lib/docgen';

type ComponentWithDocgen = {
  __docgen: {
    components: [];
    computed: [];
    data: [
      {
        defaultValue: any;
        description: string;
        keywords: [];
        kind: string;
        name: string;
        readonly: boolean;
        static: boolean;
        type: { kind: string; text: string; type: string };
        visibility: string;
      }
    ];
    description: null;
    events: [];
    keywords: [];
    methods: [];
    name: string;
    refs: [];
    slots: [];
    version: number;
  };
};

export const extractArgTypes: ArgTypesExtractor = (component) => {
  const comp: ComponentWithDocgen = new component({ props: {} });
  const docs = comp.__docgen;

  const results: ArgTypes = {};
  docs.data.forEach((item) => {
    results[item.name] = {
      control: { type: parseType(item.type.type) },
      name: item.name,
      description: item.description,
      type: {},
      defaultValue: item.defaultValue,
      table: {
        defaultValue: {
          summary: item.defaultValue,
        },<commit_msg>moved eslitn disable comments inline<commit_after>import { ArgTypes } from '@storybook/api';

import { ArgTypesExtractor, hasDocgen, extractComponentProps } from '../../lib/docgen';

type ComponentWithDocgen = {
  __docgen: {
    components: [];
    computed: [];
    data: [
      {
        defaultValue: any;
        description: string;
        keywords: [];
        kind: string;
        name: string;
        readonly: boolean;
        static: boolean;
        type: { kind: string; text: string; type: string };
        visibility: string;
      }
    ];
    description: null;
    events: [];
    keywords: [];
    methods: [];
    name: string;
    refs: [];
    slots: [];
    version: number;
  };
};

export const extractArgTypes: ArgTypesExtractor = (component) => {
  // eslint-disable-next-line new-cap
  const comp: ComponentWithDocgen = new component({ props: {} });
  // eslint-disable-next-line no-underscore-dangle
  const docs = comp.__docgen;

  const results: ArgTypes = {};
  docs.data.forEach((item) => {
    results[item.name] = {
      control: { type: parseType(item.type.type) },
      name: item.name,
      description: item.description,
      type: {},
      defaultValue: item.defaultValue,
      table: {
        defaultValue: {
          summary: item.defaultValue,
        },
{'fraction_non_alphanumeric': 0.1403644823575029, 'fraction_numerical': 0.0, 'mean_word_length': 2.4172185430463577, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2490176', 'n_tokens_mistral': 762, 'n_tokens_neox': 757, 'n_words': 177}