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

Version 12+ results in exit code 1 instead of working #1438

Open
TimPaulaskasDS opened this issue Jun 12, 2024 · 2 comments
Open

Version 12+ results in exit code 1 instead of working #1438

TimPaulaskasDS opened this issue Jun 12, 2024 · 2 comments

Comments

@TimPaulaskasDS
Copy link

@iiroj I have an issue when trying to upgrade from version 11 to 12+. Even though I am using Node v20.

git commit -S -am "EASFDC-1399: bump version for lint-staged"
husky - pre-commit script failed (code 1)

I have manually run it instead of using husky to reproduce the issue.

Before with version 11

npx lint-staged --debug

Running lint-staged with the following config:
{
  '**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml}': [
    'prettier --write'
  ],
  '**/{aura,lwc}/**': [
    'eslint'
  ],
  '**/*.{yaml, yml}': [
    'yaml-verify',
    'eslint'
  ]
}
[STARTED] Preparing...
[SUCCESS] Preparing...
[STARTED] Running tasks...
[STARTED] Running tasks for **/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml}
[STARTED] Running tasks for **/{aura,lwc}/**
[STARTED] Running tasks for **/*.{yaml, yml}
[SKIPPED] No staged files match **/{aura,lwc}/**
[SKIPPED] No staged files match **/*.{yaml, yml}
[STARTED] prettier --write
[SUCCESS] prettier --write
[SUCCESS] Running tasks for **/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml}
[SUCCESS] Running tasks...
[STARTED] Applying modifications...
[SUCCESS] Applying modifications...
[STARTED] Cleaning up...
[SUCCESS] Cleaning up...

node --version
v20.12.0

git --version
git version 2.45.2

After upgrading to v15.2.6

npx lint-staged --debug

  lint-staged:bin Running `[email protected]` on Node.js v20.12.0 (darwin) +0ms
  lint-staged:bin Options parsed from command-line: {
  allowEmpty: false,
  concurrent: true,
  configPath: undefined,
  cwd: undefined,
  debug: true,
  diff: undefined,
  diffFilter: undefined,
  maxArgLength: undefined,
  quiet: false,
  relative: false,
  shell: false,
  stash: true,
  hidePartiallyStaged: true,
  verbose: false
} +1ms
  lint-staged:validateOptions Validating options... +0ms
  lint-staged:validateOptions Validated options! +0ms
  lint-staged Unset GIT_LITERAL_PATHSPECS (was `undefined`) +0ms
  lint-staged:runAll Running all linter scripts... +0ms
  lint-staged:runAll Using working directory `/Users/tim.paulaskas/git-repos/SalesforceCI` +0ms
  lint-staged:resolveGitRepo Resolving git repo from `/Users/tim.paulaskas/git-repos/SalesforceCI` +0ms
  lint-staged:resolveGitRepo Unset GIT_DIR (was `undefined`) +0ms
  lint-staged:resolveGitRepo Unset GIT_WORK_TREE (was `undefined`) +0ms
  lint-staged:execGit Running git command [ 'rev-parse', '--path-format=absolute', '--show-toplevel' ] +0ms
  lint-staged:resolveGitRepo Resolved git directory to be `/Users/tim.paulaskas/git-repos/SalesforceCI` +107ms
  lint-staged:execGit Running git command [ 'rev-parse', '--path-format=absolute', '--absolute-git-dir' ] +107ms
  lint-staged:resolveGitRepo Resolved git config directory to be `/Users/tim.paulaskas/git-repos/SalesforceCI/.git` +140ms
  lint-staged:execGit Running git command [ 'log', '-1' ] +140ms
  lint-staged:execGit Running git command [ 'diff', '--name-only', '-z', '--diff-filter=ACMR', '--staged' ] +89ms
  lint-staged:runAll Loaded list of staged files in git:
  lint-staged:runAll [
  lint-staged:runAll   '/Users/tim.paulaskas/git-repos/SalesforceCI/package-lock.json',
  lint-staged:runAll   '/Users/tim.paulaskas/git-repos/SalesforceCI/package.json'
  lint-staged:runAll ] +1s
  lint-staged:searchConfigs Searching for configuration files... +0ms
  lint-staged:execGit Running git command [ 'ls-files', '-z', '--full-name', '-t' ] +924ms
  lint-staged:execGit Running git command [
  'ls-files',
  '-z',
  '--full-name',
  '-t',
  '--others',
  '--exclude-standard'
] +23ms

Exits with an error code 1

This is my lint-staged chunk from my package.json file:

    "lint-staged": {
        "**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml}": [
            "prettier --write"
        ],
        "**/{aura,lwc}/**": [
            "eslint"
        ],
        "**/*.{yaml, yml}": [
            "yaml-verify",
            "eslint"
        ]
    },

Originally posted by @TimPaulaskasDS in #1341 (comment)

@iiroj
Copy link
Member

iiroj commented Jun 12, 2024

Do you mean lint-staged abruptly exits at the last log line:

lint-staged:execGit Running git command [
  'ls-files',
  '-z',
  '--full-name',
  '-t',
  '--others',
  '--exclude-standard'
] +23ms

Does running that git command manually work?

@TimPaulaskasDS
Copy link
Author

Correct, it just ends. And I can run the git command without error.
Screenshot 2024-06-12 at 4 51 29 AM

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

No branches or pull requests

2 participants