nvuillam / npm-groovy-lint

Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files using command line
https://nvuillam.github.io/npm-groovy-lint/
MIT License
193 stars 61 forks source link

Error when running as pre-commit hook: SyntaxError: Unexpected token ; #355

Closed okainov closed 3 months ago

okainov commented 5 months ago

I've just tried to add npm-groovy-lint to my repo as pre-commit hook but I'm getting following error:

SyntaxError: Unexpected token ;
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/nfs/site/home/okainov/.cache/pre-commit/repohkeo9dc_/node_env-system/lib/node_modules/npm-groovy-lint/lib/index.js:4:23)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
/nfs/site/home/okainov/.cache/pre-commit/repohkeo9dc_/node_env-system/lib/node_modules/npm-groovy-lint/lib/groovy-lint.js:18
    "use strict";
                ^

SyntaxError: Unexpected token ;
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/nfs/site/home/okainov/.cache/pre-commit/repohkeo9dc_/node_env-system/lib/node_modules/npm-groovy-lint/lib/index.js:4:23)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

Pre-commit configuration:

  - repo: https://github.com/nvuillam/npm-groovy-lint
    rev: v14.2.0
    hooks:
      - id: npm-groovy-lint
        name: Lint groovy files
        description: Groovy & Jenkinsfile Linter
        entry: npm-groovy-lint --output txt
        language: node
        types: [groovy]
      - id: format-npm-groovy-lint
        name: Format Lint groovy findings
        description: Groovy & Jenkinsfile Formatter
        entry: npm-groovy-lint --format --output txt
        language: node
        types: [groovy]
      - id: fix-npm-groovy-lint
        name: Fix Lint groovy findings
        description: Groovy & Jenkinsfile Auto-fixer
        entry: npm-groovy-lint --fix  --output txt
        language: node
        types: [groovy]

node --version gives v10.19.0

nvuillam commented 5 months ago

node v10 is quite old, npm-groovy-lint requires node v18 minimum, please can you upgrade and try again ?

github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.