SyntaxError: Unexpected token '('
BonBonSlick opened this issue · 1 comments
BonBonSlick commented
Description
npm list -g
/home/bonbon/.nvm/versions/node/v20.17.0/lib
├── corepack@0.29.4
├── js-beautify@1.15.1
├── minimatch@10.0.1
└── npm@10.8.3
Input
The code looked like this before beautification:
/usr/local/lib/node_modules/js-beautify/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js
#fillNegs() {
/* c8 ignore start */
if (this !== this.#root)
throw new Error('should only call on root');
if (this.#filledNegs)
return this;
/* c8 ignore stop */
Expected Output
The code should have looked like this after beautification:
code is formatter, no errors
Actual Output
The code actually looked like this after beautification:
$ find . -type f -name 'build.js' -exec js-beautify -r {} +
/usr/local/lib/node_modules/js-beautify/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js:86
#fillNegs() {
^
SyntaxError: Unexpected token '('
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/usr/local/lib/node_modules/js-beautify/node_modules/glob/node_modules/minimatch/dist/commonjs/index.js:9:18)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
Steps to Reproduce
- install js-beauty
- run on any .js file
Environment
OS: debian 11
Settings
default
BonBonSlick commented
wrong node version, use higher version