open-wc / custom-elements-manifest

Custom Elements Manifest is a file format that describes custom elements in your project.
https://custom-elements-manifest.open-wc.org/
234 stars 43 forks source link

docs(to-markdown): correct omitSections options case #160

Closed evanjo03 closed 1 year ago

evanjo03 commented 2 years ago

The docs for the omitSections options for customElementsManifestToMarkdown were displaying the wrong casing.

These are the SECTIONS listed in lib/index.js:

const SECTIONS = {
  mainHeading: 'main-heading',
  superClass: 'super-class',
  fields: 'fields', 
  methods: 'methods',
  staticFields: 'static-fields',
  staticMethods: 'static-methods',
  slots: 'slots',
  events: 'events',
  attributes: 'attributes',
  cssProperties: 'css-properties',
  cssParts: 'css-parts',
  mixins: 'mixins'
}

The below fn in the same file parses the options passed in to see if they match the values of the above object, and so should also be kebab-case, not camelCase:

function getOmittedConfig(type, omittedOptions) {
  // target will either be the declarations options object or the sections options object, depending on `type`
  const target = type === 'decl' ? Object.assign({}, DECLARATIONS) : Object.assign({}, SECTIONS);

  // rewrite target object with boolean values for comparison in nodes array
  // true if not omitted, false if omitted.
  Object.keys(target).forEach((omitted) => target[omitted] = !omittedOptions.includes(target[omitted]));
  return target;
}
netlify[bot] commented 2 years ago

✔️ Deploy Preview for custom-elements-manifest-analyzer ready!

🔨 Explore the source changes: faeac1fba82e2206306a677b696566914ff16b86

🔍 Inspect the deploy log: https://app.netlify.com/sites/custom-elements-manifest-analyzer/deploys/61fad151953d070008a9bed6

😎 Browse the preview: https://deploy-preview-160--custom-elements-manifest-analyzer.netlify.app

thepassle commented 1 year ago

this was fixed in https://github.com/open-wc/custom-elements-manifest/pull/198