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

jsdocs: async arrow function causes error #99

Open
sevenc-nanashi opened this issue Jan 13, 2025 · 3 comments
Open

jsdocs: async arrow function causes error #99

sevenc-nanashi opened this issue Jan 13, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@sevenc-nanashi
Copy link

Environment

Node: v22
automd: v0.3.12

Reproduction

const hoge = async () => {
  await something()
}

Describe the bug

It fails:

SyntaxError: Unexpected reserved word

Additional context

No response

Logs

[6:14:24] ✔ Automd updated (667.54ms)

[6:14:24]   ─    t.md with issues (205.35ms)

[6:14:24]  WARN  Some issues happened during automd update:

[6:14:24] t.md 

 SyntaxError: Unexpected reserved word
[6:14:24] 
@sevenc-nanashi sevenc-nanashi added the bug Something isn't working label Jan 13, 2025
@holyfata
Copy link

holyfata commented Apr 5, 2025

https://github.com/[holyfata-reproduction/automd-issue99-reproduction](https://github.com/holyfata-reproduction/automd-issue99-reproduction)
I made a repo for the issue, the amazing thing is that if you export the async function it will be ok.
However, to normal, if will be ok even it is not exported.

@holyfata
Copy link

holyfata commented Apr 5, 2025

import { createJiti } from 'jiti';
import path from 'node:path';
import { defu } from 'defu';
import babelPluginUntyped from 'untyped/babel-plugin';

// const jitiOptions = { fsCache: false, moduleCache: false }
const jitiOptions = {  moduleCache: false }

const options: {
    jiti?: any
} = { jiti: jitiOptions };
const jiti = createJiti(
    process.cwd(),
        defu(options.jiti, {
          interopDefault: true,
          transformOptions: {
            babel: {
              plugins: [[babelPluginUntyped, { experimentalFunctions: true }]]
            }
          }
        })
);

const rawSchema = await jiti.import(path.join(__dirname, 'func1.ts'));

console.log(rawSchema);

This code cause the issue, i think it's the issue in jiti.

@holyfata
Copy link

holyfata commented Apr 5, 2025

  1. The scheme is {}
  2. when fsCache is false, the code will throw a error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants