Repository: parcel-bundler/parcel
File: packages/core/parcel/src/cli.js (JavaScript)

Code before:
    (val, list) => list.concat([val]),
    [],
  ],
  '--log-level <level>': new commander.Option(
    '--log-level <level>',
    'set the log level',
  ).choices(['none', 'error', 'warn', 'info', 'verbose']),
  '--dist-dir <dir>':
    'output directory to write to when unspecified by targets',
  '--no-autoinstall': 'disable autoinstall',
  '--profile': 'enable sampling build profiling',
  '--trace': 'enable build tracing',
  '-V, --version': 'output the version number',
  '--detailed-report [count]': [
    'print the asset timings and sizes in the build report',
    parseOptionInt,
  ],
  '--reporter <name>': [
    'additional reporters to run',
    (val, acc) => {
      acc.push(val);
      return acc;
    },
    [],
  ],
  '-F, --feature-flag <name=value>': [
    'sets the value of a feature flag',
    (value, previousValue) => {
      let [name, val] = value.split('=');
      if (name in DEFAULT_FEATURE_FLAGS) {
        let featureFlagValue;
        if (typeof DEFAULT_FEATURE_FLAGS[name] === 'boolean') {
          if (val !== 'true' && val !== 'false') {
            throw new Error(
              `Feature flag ${name} must be set to true or false`,
            );
          }
          featureFlagValue = val;
        }
        previousValue[name] = featureFlagValue ?? String(val);
      } else {
        INTERNAL_ORIGINAL_CONSOLE.warn(
          `Unknown feature flag ${name} specified, it will be ignored`,
        );
      }
      return previousValue;
    },
    {},
  ],
};


Review comment (suggestion):
Nitpick: Honestly prefer without the `-F` shorthand. People aren't going to type this by hand anyway so explicit is better. 

Code after:
    (val, list) => list.concat([val]),
    [],
  ],
  '--log-level <level>': new commander.Option(
    '--log-level <level>',
    'set the log level',
  ).choices(['none', 'error', 'warn', 'info', 'verbose']),
  '--dist-dir <dir>':
    'output directory to write to when unspecified by targets',
  '--no-autoinstall': 'disable autoinstall',
  '--profile': 'enable sampling build profiling',
  '--trace': 'enable build tracing',
  '-V, --version': 'output the version number',
  '--detailed-report [count]': [
    'print the asset timings and sizes in the build report',
    parseOptionInt,
  ],
  '--reporter <name>': [
    'additional reporters to run',
    (val, acc) => {
      acc.push(val);
      return acc;
    },
    [],
  ],
  '--feature-flag <name=value>': [
    'sets the value of a feature flag',
    (value, previousValue) => {
      let [name, val] = value.split('=');
      if (name in DEFAULT_FEATURE_FLAGS) {
        let featureFlagValue;
        if (typeof DEFAULT_FEATURE_FLAGS[name] === 'boolean') {
          if (val !== 'true' && val !== 'false') {
            throw new Error(
              `Feature flag ${name} must be set to true or false`,
            );
          }
          featureFlagValue = val;
        }
        previousValue[name] = featureFlagValue ?? String(val);
      } else {
        INTERNAL_ORIGINAL_CONSOLE.warn(
          `Unknown feature flag ${name} specified, it will be ignored`,
        );
      }
      return previousValue;
    },
    {},
  ],
};