Skip to content
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

fix: correctly parse unknown args with dashes when they resemble known args #502

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Xunnamius
Copy link

@Xunnamius Xunnamius commented Mar 17, 2025

Resolves #501

Additionally, to compile yargs-parser and pass the CJS unit tests, I had to make two changes I did not include in this PR:

  1. Upgrade to typescript@5 and add --noCheck to the "compile" and "pretest" scripts in package.json to work around some benign? unrelated type issues elsewhere in the codebase:
"scripts": {
...
-    "pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
+    "pretest": "rimraf build && tsc --noCheck -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
...
-    "compile": "tsc",
+    "compile": "tsc --noCheck",
...
  },
...
"devDependencies": {
...
-    "typescript": "^4.0.0"
+    "typescript": "^5.8.2"
  },
  1. Remove transformDefaultExport-related configuration from rollup.config.js since the package seems to be non-functional; I don't believe the transform is required by non-EOL JS runtimes anyway:
import cleanup from 'rollup-plugin-cleanup'
import ts from 'rollup-plugin-ts'
- import transformDefaultExport from 'ts-transform-default-export'

const output = {
  format: 'cjs',
  file: './build/index.cjs',
  exports: 'default'
}

if (process.env.NODE_ENV === 'test') output.sourcemap = true

export default {
  input: './lib/index.ts',
  output,
  plugins: [
-    ts({
-      transformers: ({ program }) => ({
-        afterDeclarations: transformDefaultExport(program)
-      })
-    }),
+    ts(),
    cleanup({
      comments: 'none',
      extensions: ['*']
    })
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect parsing of unknown args with dashes when they resemble known args
1 participant