web lint SyntaxError: Unexpected token 'with' #12522

Closed
opened 2026-02-21 19:07:48 -05:00 by yindo · 5 comments
Owner

Originally created by @baiyutang on GitHub (Apr 3, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.1.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

1 clone

git clone git@github.com:langgenius/dify.git

2 cd web

3 pnpm install

4 pnpm run lint


> dify-web@1.1.3 lint /home/xxx/idea/dify/web
> pnpm eslint --cache --cache-location node_modules/.cache/eslint/.eslint-cache


Oops! Something went wrong! :(

ESLint: 9.22.0

SyntaxError: Unexpected token 'with'
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:152:18)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:298:14)

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @baiyutang on GitHub (Apr 3, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.1.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1 clone ``` git clone git@github.com:langgenius/dify.git ``` 2 cd web 3 pnpm install 4 pnpm run lint ``` > dify-web@1.1.3 lint /home/xxx/idea/dify/web > pnpm eslint --cache --cache-location node_modules/.cache/eslint/.eslint-cache Oops! Something went wrong! :( ESLint: 9.22.0 SyntaxError: Unexpected token 'with' at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:152:18) at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:298:14) ``` ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug🤔 cant-reproduce labels 2026-02-21 19:07:48 -05:00
yindo closed this issue 2026-02-21 19:07:48 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 3, 2025):

Hey @baiyutang! 👋 I'm here to help you with your bug report and answer any questions you may have. I'm a bot designed to assist with bug fixes, questions, and contributions while you wait for a human maintainer.

The error "SyntaxError: Unexpected token 'with'" in your linting process is likely due to the use of the with statement in JavaScript, which is generally disallowed by ESLint's default configuration. The no-with rule is typically enabled by default because the with statement can make code harder to understand and maintain.

To resolve this issue, you can check your ESLint configuration to ensure that the no-with rule is not being overridden or disabled. If you need to use the with statement for some reason, you might consider refactoring the code to avoid it, as it is not recommended for use in modern JavaScript development.

If the with statement is being used in your codebase, you should locate and refactor it to improve code clarity and maintainability. If you need further assistance with specific code examples, feel free to provide more details.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Apr 3, 2025): <!-- Greeting --> Hey @baiyutang! 👋 I'm here to help you with your bug report and answer any questions you may have. I'm a bot designed to assist with bug fixes, questions, and contributions while you wait for a human maintainer. <!-- Answer --> The error "SyntaxError: Unexpected token 'with'" in your linting process is likely due to the use of the `with` statement in JavaScript, which is generally disallowed by ESLint's default configuration. The `no-with` rule is typically enabled by default because the `with` statement can make code harder to understand and maintain. To resolve this issue, you can check your ESLint configuration to ensure that the `no-with` rule is not being overridden or disabled. If you need to use the `with` statement for some reason, you might consider refactoring the code to avoid it, as it is not recommended for use in modern JavaScript development. If the `with` statement is being used in your codebase, you should locate and refactor it to improve code clarity and maintainability. If you need further assistance with specific code examples, feel free to provide more details. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/f928efec-1319-45e8-8493-649bd60f55a0?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/f928efec-1319-45e8-8493-649bd60f55a0?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/f928efec-1319-45e8-8493-649bd60f55a0?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/f928efec-1319-45e8-8493-649bd60f55a0?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/f928efec-1319-45e8-8493-649bd60f55a0?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/f928efec-1319-45e8-8493-649bd60f55a0?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/f928efec-1319-45e8-8493-649bd60f55a0?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Apr 3, 2025):

I can not reproduce this error in my local development environment. Please check the dependencies.

 ~/Program/dify/web/ [main] npx eslint --version
v9.22.0
> dify-web@1.1.3 lint /Users/crazywoola/Program/dify/web
> pnpm eslint --cache --cache-location node_modules/.cache/eslint/.eslint-cache

(node:43266) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

/Users/crazywoola/Program/dify/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx
  97:6  warning  React Hook useCallback has a missing dependency: 't'. Either include it or remove the dependency array  react-hooks/exhaustive-deps

/Users/crazywoola/Program/dify/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/api/page.tsx
  5:15  warning  'props' is defined but never used. Allowed unused args must match /^_/u  unused-imports/no-unused-vars

/Users/crazywoola/Program/dify/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx
  69:10  warning  'isShowTips' is assigned a value but never used. Allowed unused vars must match /^_/u  unused-imports/no-unused-vars
  69:32  warning  'toggleTips' is assigned a value but never used. Allowed unused vars must match /^_/u  unused-imports/no-unused-vars

/Users/crazywoola/Program/dify/web/app/(commonLayout)/datasets/DatasetCard.tsx
@crazywoola commented on GitHub (Apr 3, 2025): I can not reproduce this error in my local development environment. Please check the dependencies. ```  ~/Program/dify/web/ [main] npx eslint --version v9.22.0 ``` ``` > dify-web@1.1.3 lint /Users/crazywoola/Program/dify/web > pnpm eslint --cache --cache-location node_modules/.cache/eslint/.eslint-cache (node:43266) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) /Users/crazywoola/Program/dify/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx 97:6 warning React Hook useCallback has a missing dependency: 't'. Either include it or remove the dependency array react-hooks/exhaustive-deps /Users/crazywoola/Program/dify/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/api/page.tsx 5:15 warning 'props' is defined but never used. Allowed unused args must match /^_/u unused-imports/no-unused-vars /Users/crazywoola/Program/dify/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx 69:10 warning 'isShowTips' is assigned a value but never used. Allowed unused vars must match /^_/u unused-imports/no-unused-vars 69:32 warning 'toggleTips' is assigned a value but never used. Allowed unused vars must match /^_/u unused-imports/no-unused-vars /Users/crazywoola/Program/dify/web/app/(commonLayout)/datasets/DatasetCard.tsx ```
Author
Owner

@baiyutang commented on GitHub (Apr 3, 2025):

npx eslint --version
v9.22.0

node --version
v18.19.1

pnpm --version
10.7.1

npm --version
9.2.0

pnpm lint-staged

✔ Preparing lint-staged...
⚠ Running tasks for staged files...
  ❯ package.json — 13 files
    ❯ **/*.js?(x) — 1 file
      ✖ eslint --fix [FAILED]
    ❯ **/*.ts?(x) — 8 files
      ✖ eslint --fix [FAILED]
↓ Skipped because of errors from tasks.
✔ Reverting to original state because of errors...
✔ Cleaning up temporary files...

✖ eslint --fix:

Oops! Something went wrong! :(

ESLint: 9.22.0

SyntaxError: Unexpected token 'with'
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:152:18)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:298:14)

✖ eslint --fix:

Oops! Something went wrong! :(

ESLint: 9.22.0

SyntaxError: Unexpected token 'with'
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:152:18)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:298:14)
@baiyutang commented on GitHub (Apr 3, 2025): npx eslint --version v9.22.0 node --version v18.19.1 pnpm --version 10.7.1 npm --version 9.2.0 pnpm lint-staged ``` ✔ Preparing lint-staged... ⚠ Running tasks for staged files... ❯ package.json — 13 files ❯ **/*.js?(x) — 1 file ✖ eslint --fix [FAILED] ❯ **/*.ts?(x) — 8 files ✖ eslint --fix [FAILED] ↓ Skipped because of errors from tasks. ✔ Reverting to original state because of errors... ✔ Cleaning up temporary files... ✖ eslint --fix: Oops! Something went wrong! :( ESLint: 9.22.0 SyntaxError: Unexpected token 'with' at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:152:18) at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:298:14) ✖ eslint --fix: Oops! Something went wrong! :( ESLint: 9.22.0 SyntaxError: Unexpected token 'with' at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:152:18) at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:298:14) ```
Author
Owner

@CorrectRoadH commented on GitHub (Apr 12, 2025):

npx eslint --version v9.22.0

node --version v18.19.1

pnpm --version 10.7.1

npm --version 9.2.0

pnpm lint-staged

✔ Preparing lint-staged...
⚠ Running tasks for staged files...
  ❯ package.json — 13 files
    ❯ **/*.js?(x) — 1 file
      ✖ eslint --fix [FAILED]
    ❯ **/*.ts?(x) — 8 files
      ✖ eslint --fix [FAILED]
↓ Skipped because of errors from tasks.
✔ Reverting to original state because of errors...
✔ Cleaning up temporary files...

✖ eslint --fix:

Oops! Something went wrong! :(

ESLint: 9.22.0

SyntaxError: Unexpected token 'with'
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:152:18)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:298:14)

✖ eslint --fix:

Oops! Something went wrong! :(

ESLint: 9.22.0

SyntaxError: Unexpected token 'with'
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:152:18)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:298:14)

I got same issue, anyway to resolve it?

@CorrectRoadH commented on GitHub (Apr 12, 2025): > npx eslint --version v9.22.0 > > node --version v18.19.1 > > pnpm --version 10.7.1 > > npm --version 9.2.0 > > pnpm lint-staged > > ``` > ✔ Preparing lint-staged... > ⚠ Running tasks for staged files... > ❯ package.json — 13 files > ❯ **/*.js?(x) — 1 file > ✖ eslint --fix [FAILED] > ❯ **/*.ts?(x) — 8 files > ✖ eslint --fix [FAILED] > ↓ Skipped because of errors from tasks. > ✔ Reverting to original state because of errors... > ✔ Cleaning up temporary files... > > ✖ eslint --fix: > > Oops! Something went wrong! :( > > ESLint: 9.22.0 > > SyntaxError: Unexpected token 'with' > at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:152:18) > at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:298:14) > > ✖ eslint --fix: > > Oops! Something went wrong! :( > > ESLint: 9.22.0 > > SyntaxError: Unexpected token 'with' > at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:152:18) > at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:298:14) > ``` I got same issue, anyway to resolve it?
Author
Owner

@CorrectRoadH commented on GitHub (Apr 12, 2025):

I can not reproduce this error in my local development environment. Please check the dependencies.

 ~/Program/dify/web/ [main] npx eslint --version
v9.22.0
> dify-web@1.1.3 lint /Users/crazywoola/Program/dify/web
> pnpm eslint --cache --cache-location node_modules/.cache/eslint/.eslint-cache

(node:43266) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

/Users/crazywoola/Program/dify/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx
  97:6  warning  React Hook useCallback has a missing dependency: 't'. Either include it or remove the dependency array  react-hooks/exhaustive-deps

/Users/crazywoola/Program/dify/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/api/page.tsx
  5:15  warning  'props' is defined but never used. Allowed unused args must match /^_/u  unused-imports/no-unused-vars

/Users/crazywoola/Program/dify/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx
  69:10  warning  'isShowTips' is assigned a value but never used. Allowed unused vars must match /^_/u  unused-imports/no-unused-vars
  69:32  warning  'toggleTips' is assigned a value but never used. Allowed unused vars must match /^_/u  unused-imports/no-unused-vars

/Users/crazywoola/Program/dify/web/app/(commonLayout)/datasets/DatasetCard.tsx

I update node version to v22.14.0 to resolve the issue. I think to upgrade the requirement in package.json is good.

@CorrectRoadH commented on GitHub (Apr 12, 2025): > I can not reproduce this error in my local development environment. Please check the dependencies. > > ``` >  ~/Program/dify/web/ [main] npx eslint --version > v9.22.0 > ``` > > ``` > > dify-web@1.1.3 lint /Users/crazywoola/Program/dify/web > > pnpm eslint --cache --cache-location node_modules/.cache/eslint/.eslint-cache > > (node:43266) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time > (Use `node --trace-warnings ...` to show where the warning was created) > > /Users/crazywoola/Program/dify/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx > 97:6 warning React Hook useCallback has a missing dependency: 't'. Either include it or remove the dependency array react-hooks/exhaustive-deps > > /Users/crazywoola/Program/dify/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/api/page.tsx > 5:15 warning 'props' is defined but never used. Allowed unused args must match /^_/u unused-imports/no-unused-vars > > /Users/crazywoola/Program/dify/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx > 69:10 warning 'isShowTips' is assigned a value but never used. Allowed unused vars must match /^_/u unused-imports/no-unused-vars > 69:32 warning 'toggleTips' is assigned a value but never used. Allowed unused vars must match /^_/u unused-imports/no-unused-vars > > /Users/crazywoola/Program/dify/web/app/(commonLayout)/datasets/DatasetCard.tsx > ``` I update node version to v22.14.0 to resolve the issue. I think to upgrade the requirement in package.json is good.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12522