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

Running in a subdirectory of a git repo incorrectly runs in other directories #1132

Closed
alex-grover opened this issue Apr 9, 2022 · 21 comments · Fixed by #1133
Closed

Running in a subdirectory of a git repo incorrectly runs in other directories #1132

alex-grover opened this issue Apr 9, 2022 · 21 comments · Fixed by #1133

Comments

@alex-grover
Copy link

Description

Running lint-staged in a subdirectory of a monorepo incorrectly runs scripts in other parts of the monorepo. Based on a quick look at recent issues and PRs I suspect it might be related to this change, but I'm not positive: #1093

This bug does not exist in lint-staged@11.2.6, but does in 12.3.7 (latest).

Steps to reproduce

Basic reproduction:
https://github.com/alex-grover/lint-staged-bug

See the run.sh script for steps. It's a repo that looks like the following:

lint-staged-bug/
├── parent.txt
├── package.json
├── a/
│   ├── a.txt
│   └── package.json
└── b/
    ├── b.txt
    └── package.json

Each package.json has a lint-staged configuration. If you make and stage changes in every directory, then run lint-staged from inside of a or b, all 3 scripts run rather than just the one in the current child directory.

Debug Logs

expand to view
✔ Preparing lint-staged...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
✔ Cleaning up temporary files...

→ echo "a modified":
a modified /Users/alexgrover/Developer/lint-staged-bug/a/a.txt

→ echo "parent modified":
parent modified /Users/alexgrover/Developer/lint-staged-bug/parent.txt

→ echo "b modified":
b modified /Users/alexgrover/Developer/lint-staged-bug/b/b.txt

Environment

  • OS: macOS 12.3.1 (M1)
  • Node.js: v14.19.1
  • lint-staged: 12.3.7
@iiroj
Copy link
Member

iiroj commented Apr 9, 2022

Please post debug logs using lint-staged --debug. That should show what directories and configurations it considers.

@alex-grover
Copy link
Author

oops sorry, here they are:

expand to view
  lint-staged:bin Running `lint-staged@12.3.7` +0ms
  lint-staged:bin Options parsed from command-line: {
  allowEmpty: false,
  concurrent: true,
  configPath: undefined,
  cwd: undefined,
  debug: true,
  maxArgLength: 131072,
  quiet: false,
  relative: false,
  shell: false,
  stash: 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/alexgrover/Developer/lint-staged-bug/a` +0ms
  lint-staged:resolveGitRepo Resolving git repo from `/Users/alexgrover/Developer/lint-staged-bug/a` +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', '--show-prefix' ] +0ms
  lint-staged:resolveGitRepo Resolved git directory to be `/Users/alexgrover/Developer/lint-staged-bug` +6ms
  lint-staged:resolveGitRepo Resolved git config directory to be `/Users/alexgrover/Developer/lint-staged-bug/.git` +0ms
  lint-staged:execGit Running git command [ 'log', '-1' ] +6ms
  lint-staged:execGit Running git command [ 'diff', '--staged', '--diff-filter=ACMR', '--name-only', '-z' ] +4ms
  lint-staged:runAll Loaded list of staged files in git:
  lint-staged:runAll [
  lint-staged:runAll   '/Users/alexgrover/Developer/lint-staged-bug/a/a.txt',
  lint-staged:runAll   '/Users/alexgrover/Developer/lint-staged-bug/b/b.txt',
  lint-staged:runAll   '/Users/alexgrover/Developer/lint-staged-bug/parent.txt',
  lint-staged:runAll   '/Users/alexgrover/Developer/lint-staged-bug/run.sh'
  lint-staged:runAll ] +15ms
  lint-staged:getConfigGroups Grouping configuration files... +0ms
  lint-staged:getConfigGroups Grouping staged files by their directories... +0ms
  lint-staged:getConfigGroups Grouped staged files into 3 directories: +0ms
  lint-staged:getConfigGroups {
  lint-staged:getConfigGroups   '/Users/alexgrover/Developer/lint-staged-bug/a': [ '/Users/alexgrover/Developer/lint-staged-bug/a/a.txt' ],
  lint-staged:getConfigGroups   '/Users/alexgrover/Developer/lint-staged-bug/b': [ '/Users/alexgrover/Developer/lint-staged-bug/b/b.txt' ],
  lint-staged:getConfigGroups   '/Users/alexgrover/Developer/lint-staged-bug': [ '/Users/alexgrover/Developer/lint-staged-bug/parent.txt', '/Users/alexgrover/Developer/lint-staged-bug/run.sh' ]
  lint-staged:getConfigGroups } +0ms
  lint-staged:getConfigGroups Searching config files... +0ms
  lint-staged:loadConfig Searching for configuration from `/Users/alexgrover/Developer/lint-staged-bug/a`... +0ms
  lint-staged:loadConfig Successfully loaded config from `/Users/alexgrover/Developer/lint-staged-bug/a/package.json`:
  lint-staged:loadConfig { 'a.txt': 'echo "a modified"' } +0ms
  lint-staged:getConfigGroups Found new config "/Users/alexgrover/Developer/lint-staged-bug/a/package.json" from "/Users/alexgrover/Developer/lint-staged-bug/a"! +1ms
  lint-staged:validateConfig Validating config from `/Users/alexgrover/Developer/lint-staged-bug/a/package.json`... +0ms
  lint-staged:validateConfig Validated config from `/Users/alexgrover/Developer/lint-staged-bug/a/package.json`: +0ms
  lint-staged:validateConfig {
  lint-staged:validateConfig   'a.txt': 'echo "a modified"'
  lint-staged:validateConfig } +0ms
  lint-staged:loadConfig Searching for configuration from `/Users/alexgrover/Developer/lint-staged-bug/a`... +0ms
  lint-staged:loadConfig Searching for configuration from `/Users/alexgrover/Developer/lint-staged-bug/b`... +0ms
  lint-staged:loadConfig Searching for configuration from `/Users/alexgrover/Developer/lint-staged-bug`... +1ms
  lint-staged:loadConfig Successfully loaded config from `/Users/alexgrover/Developer/lint-staged-bug/b/package.json`:
  lint-staged:loadConfig { 'b.txt': 'echo "b modified"' } +0ms
  lint-staged:getConfigGroups Found new config "/Users/alexgrover/Developer/lint-staged-bug/b/package.json" from "/Users/alexgrover/Developer/lint-staged-bug/b"! +1ms
  lint-staged:validateConfig Validating config from `/Users/alexgrover/Developer/lint-staged-bug/b/package.json`... +1ms
  lint-staged:validateConfig Validated config from `/Users/alexgrover/Developer/lint-staged-bug/b/package.json`: +0ms
  lint-staged:validateConfig {
  lint-staged:validateConfig   'b.txt': 'echo "b modified"'
  lint-staged:validateConfig } +0ms
  lint-staged:loadConfig Successfully loaded config from `/Users/alexgrover/Developer/lint-staged-bug/a/package.json`:
  lint-staged:loadConfig { 'a.txt': 'echo "a modified"' } +0ms
  lint-staged:getConfigGroups Found existing config "/Users/alexgrover/Developer/lint-staged-bug/a/package.json" from "/Users/alexgrover/Developer/lint-staged-bug/a"! +0ms
  lint-staged:loadConfig Successfully loaded config from `/Users/alexgrover/Developer/lint-staged-bug/package.json`:
  lint-staged:loadConfig { 'parent.txt': 'echo "parent modified"' } +0ms
  lint-staged:getConfigGroups Found new config "/Users/alexgrover/Developer/lint-staged-bug/package.json" from "/Users/alexgrover/Developer/lint-staged-bug"! +0ms
  lint-staged:validateConfig Validating config from `/Users/alexgrover/Developer/lint-staged-bug/package.json`... +0ms
  lint-staged:validateConfig Validated config from `/Users/alexgrover/Developer/lint-staged-bug/package.json`: +0ms
  lint-staged:validateConfig {
  lint-staged:validateConfig   'parent.txt': 'echo "parent modified"'
  lint-staged:validateConfig } +0ms
  lint-staged:getConfigGroups Grouped staged files into 3 groups! +0ms
  lint-staged:execGit Running git command [ 'ls-files', '-z', '--full-name' ] +8ms
  lint-staged:execGit Running git command [ 'ls-files', '-z', '--full-name', '--others', '--exclude-standard' ] +4ms
  lint-staged:loadConfig Loading configuration from `/Users/alexgrover/Developer/lint-staged-bug/a/package.json`... +7ms
  lint-staged:loadConfig Loading configuration from `/Users/alexgrover/Developer/lint-staged-bug/b/package.json`... +0ms
  lint-staged:loadConfig Loading configuration from `/Users/alexgrover/Developer/lint-staged-bug/package.json`... +0ms
  lint-staged:loadConfig Successfully loaded config from `/Users/alexgrover/Developer/lint-staged-bug/a/package.json`:
  lint-staged:loadConfig { 'a.txt': 'echo "a modified"' } +1ms
  lint-staged:validateConfig Validating config from `/Users/alexgrover/Developer/lint-staged-bug/a/package.json`... +8ms
  lint-staged:validateConfig Validated config from `/Users/alexgrover/Developer/lint-staged-bug/a/package.json`: +0ms
  lint-staged:validateConfig {
  lint-staged:validateConfig   'a.txt': 'echo "a modified"'
  lint-staged:validateConfig } +0ms
  lint-staged:loadConfig Successfully loaded config from `/Users/alexgrover/Developer/lint-staged-bug/b/package.json`:
  lint-staged:loadConfig { 'b.txt': 'echo "b modified"' } +0ms
  lint-staged:validateConfig Validating config from `/Users/alexgrover/Developer/lint-staged-bug/b/package.json`... +0ms
  lint-staged:validateConfig Validated config from `/Users/alexgrover/Developer/lint-staged-bug/b/package.json`: +0ms
  lint-staged:validateConfig {
  lint-staged:validateConfig   'b.txt': 'echo "b modified"'
  lint-staged:validateConfig } +0ms
  lint-staged:loadConfig Successfully loaded config from `/Users/alexgrover/Developer/lint-staged-bug/package.json`:
  lint-staged:loadConfig { 'parent.txt': 'echo "parent modified"' } +0ms
  lint-staged:validateConfig Validating config from `/Users/alexgrover/Developer/lint-staged-bug/package.json`... +0ms
  lint-staged:validateConfig Validated config from `/Users/alexgrover/Developer/lint-staged-bug/package.json`: +0ms
  lint-staged:validateConfig {
  lint-staged:validateConfig   'parent.txt': 'echo "parent modified"'
  lint-staged:validateConfig } +0ms
  lint-staged:runAll Found 3 configs:
  lint-staged:runAll {
  lint-staged:runAll   '/Users/alexgrover/Developer/lint-staged-bug/a/package.json': { 'a.txt': 'echo "a modified"' },
  lint-staged:runAll   '/Users/alexgrover/Developer/lint-staged-bug/b/package.json': { 'b.txt': 'echo "b modified"' },
  lint-staged:runAll   '/Users/alexgrover/Developer/lint-staged-bug/package.json': { 'parent.txt': 'echo "parent modified"' }
  lint-staged:runAll } +11ms
  lint-staged:chunkFiles Resolved an argument string length of 51 characters from 1 files +0ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 131072 +0ms
  lint-staged:generateTasks Generating linter tasks +0ms
  lint-staged:generateTasks Generated task: 
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: 'a.txt',
  lint-staged:generateTasks   commands: 'echo "a modified"',
  lint-staged:generateTasks   fileList: [ '/Users/alexgrover/Developer/lint-staged-bug/a/a.txt' ]
  lint-staged:generateTasks } +1ms
  lint-staged:makeCmdTasks Creating listr tasks for commands 'echo "a modified"' +0ms
  lint-staged:resolveTaskFn cmd: echo +0ms
  lint-staged:resolveTaskFn args: [ 'a modified' ] +0ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: '/Users/alexgrover/Developer/lint-staged-bug/a',
  preferLocal: true,
  reject: false,
  shell: false
} +1ms
  lint-staged:chunkFiles Resolved an argument string length of 51 characters from 1 files +3ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 131072 +0ms
  lint-staged:generateTasks Generating linter tasks +2ms
  lint-staged:generateTasks Generated task: 
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: 'b.txt',
  lint-staged:generateTasks   commands: 'echo "b modified"',
  lint-staged:generateTasks   fileList: [ '/Users/alexgrover/Developer/lint-staged-bug/b/b.txt' ]
  lint-staged:generateTasks } +0ms
  lint-staged:makeCmdTasks Creating listr tasks for commands 'echo "b modified"' +1ms
  lint-staged:resolveTaskFn cmd: echo +0ms
  lint-staged:resolveTaskFn args: [ 'b modified' ] +0ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: '/Users/alexgrover/Developer/lint-staged-bug/b',
  preferLocal: true,
  reject: false,
  shell: false
} +0ms
  lint-staged:chunkFiles Resolved an argument string length of 105 characters from 2 files +0ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 131072 +0ms
  lint-staged:generateTasks Generating linter tasks +0ms
  lint-staged:generateTasks Generated task: 
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: 'parent.txt',
  lint-staged:generateTasks   commands: 'echo "parent modified"',
  lint-staged:generateTasks   fileList: [ '/Users/alexgrover/Developer/lint-staged-bug/parent.txt' ]
  lint-staged:generateTasks } +0ms
  lint-staged:makeCmdTasks Creating listr tasks for commands 'echo "parent modified"' +0ms
  lint-staged:resolveTaskFn cmd: echo +0ms
  lint-staged:resolveTaskFn args: [ 'parent modified' ] +0ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: '/Users/alexgrover/Developer/lint-staged-bug',
  preferLocal: true,
  reject: false,
  shell: false
} +0ms
  lint-staged:chunkFiles Resolved an argument string length of 158 characters from 3 files +0ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 131072 +0ms
[STARTED] Preparing lint-staged...
  lint-staged:GitWorkflow Backing up original state... +0ms
  lint-staged:GitWorkflow Getting partially staged files... +0ms
  lint-staged:execGit Running git command [ 'status', '-z' ] +10ms
  lint-staged:GitWorkflow Found partially staged files: [] +4ms
  lint-staged:GitWorkflow Backing up merge state... +0ms
  lint-staged:file Reading file `/Users/alexgrover/Developer/lint-staged-bug/.git/MERGE_HEAD` +0ms
  lint-staged:file Reading file `/Users/alexgrover/Developer/lint-staged-bug/.git/MERGE_MODE` +0ms
  lint-staged:file Reading file `/Users/alexgrover/Developer/lint-staged-bug/.git/MERGE_MSG` +0ms
  lint-staged:file File `/Users/alexgrover/Developer/lint-staged-bug/.git/MERGE_HEAD` doesn't exist, ignoring... +0ms
  lint-staged:file File `/Users/alexgrover/Developer/lint-staged-bug/.git/MERGE_MODE` doesn't exist, ignoring... +0ms
  lint-staged:file File `/Users/alexgrover/Developer/lint-staged-bug/.git/MERGE_MSG` doesn't exist, ignoring... +0ms
  lint-staged:GitWorkflow Done backing up merge state! +0ms
  lint-staged:GitWorkflow Getting deleted files... +0ms
  lint-staged:execGit Running git command [ 'ls-files', '--deleted' ] +4ms
  lint-staged:GitWorkflow Found deleted files: [] +4ms
  lint-staged:execGit Running git command [ 'stash', 'create' ] +4ms
  lint-staged:execGit Running git command [
  'stash',
  'store',
  '--quiet',
  '--message',
  'lint-staged automatic backup',
  '86a773e483c8b9b45c478905727e28378220d3ef'
] +11ms
  lint-staged:GitWorkflow Done backing up original state! +15ms
[SUCCESS] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] package.json — 1 file
[STARTED] ../b/package.json — 1 file
[STARTED] ../package.json — 2 files
[STARTED] a.txt — 1 file
[STARTED] b.txt — 1 file
[STARTED] parent.txt — 1 file
[STARTED] echo "a modified"
[STARTED] echo "b modified"
[STARTED] echo "parent modified"
[SUCCESS] echo "a modified"
[SUCCESS] a.txt — 1 file
[SUCCESS] package.json — 1 file
[SUCCESS] echo "b modified"
[SUCCESS] b.txt — 1 file
[SUCCESS] ../b/package.json — 1 file
[SUCCESS] echo "parent modified"
[SUCCESS] parent.txt — 1 file
[SUCCESS] ../package.json — 2 files
[SUCCESS] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
  lint-staged:GitWorkflow Adding task modifications to index... +9ms
  lint-staged:execGit Running git command [
  'add',
  '--',
  '/Users/alexgrover/Developer/lint-staged-bug/a/a.txt',
  '/Users/alexgrover/Developer/lint-staged-bug/b/b.txt',
  '/Users/alexgrover/Developer/lint-staged-bug/parent.txt'
] +13ms
  lint-staged:GitWorkflow Done adding task modifications to index! +4ms
  lint-staged:execGit Running git command [ 'diff', '--name-only', '--cached' ] +4ms
[SUCCESS] Applying modifications from tasks...
[STARTED] Cleaning up temporary files...
  lint-staged:GitWorkflow Dropping backup stash... +4ms
  lint-staged:execGit Running git command [ 'stash', 'list' ] +4ms
  lint-staged:execGit Running git command [ 'stash', 'drop', '--quiet', 'refs/stash@{0}' ] +7ms
  lint-staged:GitWorkflow Done dropping backup stash! +16ms
[SUCCESS] Cleaning up temporary files...
  lint-staged Tasks were executed successfully! +88ms

@iiroj
Copy link
Member

iiroj commented Apr 9, 2022

Thanks... looks like the multiple config feature now means it will find all configs from the git repo, even if your cwd is not at the root. Not sure how/if this should be fixed; maybe we need to limit discovered configs so that they are inside cwd.

@alex-grover
Copy link
Author

The monorepo section in the README indicates that cwd only is the expected behavior. That’s how we (and I’m assuming many others) are using the tool, with different lint configurations per directory.

@verekia
Copy link

verekia commented Apr 9, 2022

Getting a related issue with my monorepo setup in 12.3.7. Each sub-project has a lint-staged config. When I run lint-staged within a sub-project, it goes to find all the other configurations, and crashes with a No matching pid found.

I would like to avoid moving linting to the root, to leverage each sub-project's configuration and for them to be stay self-contained.

Note : I do not have ESLint, Prettier, or TS installed on the root, they are in each sub-project.

Added debug logs there, where a similar error message was found:
#988 (comment)

@iiroj
Copy link
Member

iiroj commented Apr 9, 2022

I can leave out configs outside the cwd, but I'm pretty sure the behaviour pre-monorepo features would have found the "root config" from a parent directory.

So I think this might work:

  1. search all configs from git
  2. Ignore those outside cwd
  3. If no configs left, auto-discover from cwd (this would be the previous behavior)
  4. If still no configs, throw

@verekia
Copy link

verekia commented Apr 9, 2022

By the way, I can also confirm that version 11.2.6 that @alex-grover mentioned works for my setup too.

@iiroj
Copy link
Member

iiroj commented Apr 9, 2022

@alex-grover and @verekia can you checkout the code in PR #1133 and see if it fixes your issues? The lint-staged npm module is native ESM so you can pretty much just copy-paste the lib/ directory in your node_modules/lint-staged/lib/

@verekia
Copy link

verekia commented Apr 9, 2022

Thank you for looking into this so fast :)

I loaded 12.3.7 in my monorepo, checked out the monorepo-fixes branch on 303a714, replaced the lib directory with the one from monorepo-fixes.
For me it is still crashing with the No matching pid found, but I can see in the debug logs that it doesn't seem to load other configurations, so there's some progress!

Debug logs
yarn run v1.22.17
$ lint-staged --debug
  lint-staged:bin Running `lint-staged@12.3.7` +0ms
  lint-staged:bin Options parsed from command-line: {
  allowEmpty: false,
  concurrent: true,
  configPath: undefined,
  cwd: undefined,
  debug: true,
  maxArgLength: 131072,
  quiet: false,
  relative: false,
  shell: false,
  stash: true,
  verbose: false
} +0ms
  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/verekia/Local/Code/private-projects/apps/learnthai` +0ms
  lint-staged:resolveGitRepo Resolving git repo from `/Users/verekia/Local/Code/private-projects/apps/learnthai` +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', '--show-prefix' ] +0ms
  lint-staged:resolveGitRepo Resolved git directory to be `/Users/verekia/Local/Code/private-projects` +13ms
  lint-staged:resolveGitRepo Resolved git config directory to be `/Users/verekia/Local/Code/private-projects/.git` +0ms
  lint-staged:execGit Running git command [ 'log', '-1' ] +13ms
  lint-staged:execGit Running git command [ 'diff', '--staged', '--diff-filter=ACMR', '--name-only', '-z' ] +15ms
  lint-staged:runAll Loaded list of staged files in git:
  lint-staged:runAll [
  lint-staged:runAll   '/Users/verekia/Local/Code/private-projects/apps/learnthai/src/lib/create-id.ts'
  lint-staged:runAll ] +38ms
  lint-staged:searchConfigs Searching for configuration files... +0ms
  lint-staged:execGit Running git command [ 'ls-files', '-z', '--full-name' ] +11ms
  lint-staged:execGit Running git command [ 'ls-files', '-z', '--full-name', '--others', '--exclude-standard' ] +12ms
  lint-staged:searchConfigs Found possible config files: [
  '/Users/verekia/Local/Code/private-projects/apps/learnthai/package.json'
] +26ms
  lint-staged:loadConfig Loading configuration from `/Users/verekia/Local/Code/private-projects/apps/learnthai/package.json`... +0ms
  lint-staged:loadConfig Successfully loaded config from `/Users/verekia/Local/Code/private-projects/apps/learnthai/package.json`:
  lint-staged:loadConfig {
  lint-staged:loadConfig   '*.{ts,tsx}': [ 'tsc-files' ],
  lint-staged:loadConfig   '*.{js,jsx,ts,tsx}': [ 'eslint' ],
  lint-staged:loadConfig   '*.{js,jsx,ts,tsx,json,html,css,md,gql,graphql}': [ 'prettier -c' ]
  lint-staged:loadConfig } +0ms
  lint-staged:validateConfig Validating config from `/Users/verekia/Local/Code/private-projects/apps/learnthai/package.json`... +0ms
  lint-staged:validateConfig Validated config from `/Users/verekia/Local/Code/private-projects/apps/learnthai/package.json`: +1ms
  lint-staged:validateConfig {
  lint-staged:validateConfig   '*.{ts,tsx}': [ 'tsc-files' ],
  lint-staged:validateConfig   '*.{js,jsx,ts,tsx}': [ 'eslint' ],
  lint-staged:validateConfig   '*.{js,jsx,ts,tsx,json,html,css,md,gql,graphql}': [ 'prettier -c' ]
  lint-staged:validateConfig } +0ms
  lint-staged:searchConfigs Found 1 config files +2ms
  lint-staged:groupFilesByConfig Grouping 1 files by 1 configurations +0ms
  lint-staged:chunkFiles Resolved an argument string length of 78 characters from 1 files +0ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 131072 +0ms
  lint-staged:generateTasks Generating linter tasks +0ms
  lint-staged:generateTasks Generated task: 
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: '*.{ts,tsx}',
  lint-staged:generateTasks   commands: [ 'tsc-files' ],
  lint-staged:generateTasks   fileList: [
  lint-staged:generateTasks     '/Users/verekia/Local/Code/private-projects/apps/learnthai/src/lib/create-id.ts'
  lint-staged:generateTasks   ]
  lint-staged:generateTasks } +1ms
  lint-staged:generateTasks Generated task: 
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: '*.{js,jsx,ts,tsx}',
  lint-staged:generateTasks   commands: [ 'eslint' ],
  lint-staged:generateTasks   fileList: [
  lint-staged:generateTasks     '/Users/verekia/Local/Code/private-projects/apps/learnthai/src/lib/create-id.ts'
  lint-staged:generateTasks   ]
  lint-staged:generateTasks } +0ms
  lint-staged:generateTasks Generated task: 
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: '*.{js,jsx,ts,tsx,json,html,css,md,gql,graphql}',
  lint-staged:generateTasks   commands: [ 'prettier -c' ],
  lint-staged:generateTasks   fileList: [
  lint-staged:generateTasks     '/Users/verekia/Local/Code/private-projects/apps/learnthai/src/lib/create-id.ts'
  lint-staged:generateTasks   ]
  lint-staged:generateTasks } +0ms
  lint-staged:makeCmdTasks Creating listr tasks for commands [ 'tsc-files' ] +0ms
  lint-staged:resolveTaskFn cmd: tsc-files +0ms
  lint-staged:resolveTaskFn args: [] +0ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: '/Users/verekia/Local/Code/private-projects/apps/learnthai',
  preferLocal: true,
  reject: false,
  shell: false
} +0ms
  lint-staged:makeCmdTasks Creating listr tasks for commands [ 'eslint' ] +1ms
  lint-staged:resolveTaskFn cmd: eslint +1ms
  lint-staged:resolveTaskFn args: [] +0ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: '/Users/verekia/Local/Code/private-projects/apps/learnthai',
  preferLocal: true,
  reject: false,
  shell: false
} +0ms
  lint-staged:makeCmdTasks Creating listr tasks for commands [ 'prettier -c' ] +1ms
  lint-staged:resolveTaskFn cmd: prettier +0ms
  lint-staged:resolveTaskFn args: [ '-c' ] +0ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: '/Users/verekia/Local/Code/private-projects/apps/learnthai',
  preferLocal: true,
  reject: false,
  shell: false
} +0ms
  lint-staged:chunkFiles Resolved an argument string length of 78 characters from 1 files +3ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 131072 +0ms
[STARTED] Preparing lint-staged...
  lint-staged:GitWorkflow Backing up original state... +0ms
  lint-staged:GitWorkflow Getting partially staged files... +0ms
  lint-staged:execGit Running git command [ 'status', '-z' ] +22ms
  lint-staged:GitWorkflow Found partially staged files: [] +16ms
  lint-staged:GitWorkflow Backing up merge state... +0ms
  lint-staged:file Reading file `/Users/verekia/Local/Code/private-projects/.git/MERGE_HEAD` +0ms
  lint-staged:file Reading file `/Users/verekia/Local/Code/private-projects/.git/MERGE_MODE` +0ms
  lint-staged:file Reading file `/Users/verekia/Local/Code/private-projects/.git/MERGE_MSG` +0ms
  lint-staged:file File `/Users/verekia/Local/Code/private-projects/.git/MERGE_MODE` doesn't exist, ignoring... +0ms
  lint-staged:file File `/Users/verekia/Local/Code/private-projects/.git/MERGE_MSG` doesn't exist, ignoring... +0ms
  lint-staged:file File `/Users/verekia/Local/Code/private-projects/.git/MERGE_HEAD` doesn't exist, ignoring... +0ms
  lint-staged:GitWorkflow Done backing up merge state! +0ms
  lint-staged:GitWorkflow Getting deleted files... +0ms
  lint-staged:execGit Running git command [ 'ls-files', '--deleted' ] +16ms
  lint-staged:GitWorkflow Found deleted files: [] +11ms
  lint-staged:execGit Running git command [ 'stash', 'create' ] +12ms
  lint-staged:execGit Running git command [
  'stash',
  'store',
  '--quiet',
  '--message',
  'lint-staged automatic backup',
  '32c3e48de5aae5d0b2462235b1623777ab973041'
] +24ms
  lint-staged:GitWorkflow Done backing up original state! +35ms
[SUCCESS] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] package.json — 1 file
[STARTED] *.{ts,tsx} — 1 file
[STARTED] *.{js,jsx,ts,tsx} — 1 file
[STARTED] *.{js,jsx,ts,tsx,json,html,css,md,gql,graphql} — 1 file
[STARTED] tsc-files
[STARTED] eslint
[STARTED] prettier -c
[FAILED] prettier -c [FAILED]
[FAILED] prettier -c [FAILED]
[SUCCESS] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
[SKIPPED] Skipped because of errors from tasks.
[STARTED] Reverting to original state because of errors...
  lint-staged:GitWorkflow Restoring original state... +324ms
  lint-staged:execGit Running git command [ 'reset', '--hard', 'HEAD' ] +334ms
  lint-staged:execGit Running git command [ 'stash', 'list' ] +44ms
  lint-staged:execGit Running git command [ 'stash', 'apply', '--quiet', '--index', 'refs/stash@{0}' ] +17ms
[FAILED] eslint [KILLED]
[FAILED] eslint [KILLED]
  lint-staged:GitWorkflow Restoring merge state... +119ms
  lint-staged:GitWorkflow Done restoring merge state! +0ms
  lint-staged:file Removing file `/Users/verekia/Local/Code/private-projects/.git/lint-staged_unstaged.patch` +489ms
  lint-staged:file File `/Users/verekia/Local/Code/private-projects/.git/lint-staged_unstaged.patch` doesn't exist, ignoring... +1ms
  lint-staged:GitWorkflow Done restoring original state! +1ms
[SUCCESS] Reverting to original state because of errors...
[STARTED] Cleaning up temporary files...
  lint-staged:GitWorkflow Dropping backup stash... +0ms
  lint-staged:execGit Running git command [ 'stash', 'list' ] +59ms
  lint-staged:execGit Running git command [ 'stash', 'drop', '--quiet', 'refs/stash@{0}' ] +13ms
  lint-staged:GitWorkflow Done dropping backup stash! +27ms
[SUCCESS] Cleaning up temporary files...

✖ prettier -c:
[warn] src/lib/create-id.ts
[warn] Code style issues found in the above file(s). Forgot to run Prettier?
Checking formatting...

✖ eslint failed without output (KILLED).
/Users/verekia/Local/Code/private-projects/node_modules/lint-staged/node_modules/pidtree/lib/pidtree.js:61
callback(new Error('No matching pid found'));
^

Error: No matching pid found
at /Users/verekia/Local/Code/private-projects/node_modules/lint-staged/node_modules/pidtree/lib/pidtree.js:61:16
at /Users/verekia/Local/Code/private-projects/node_modules/lint-staged/node_modules/pidtree/lib/ps.js:40:7
at ChildProcess. (/Users/verekia/Local/Code/private-projects/node_modules/lint-staged/node_modules/pidtree/lib/bin.js:45:5)
at ChildProcess.emit (node:events:394:28)
at maybeClose (node:internal/child_process:1067:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
error Command failed with exit code 1.

@iiroj
Copy link
Member

iiroj commented Apr 9, 2022

That seems to be a separate issue related to #1117. Maybe I can add some try/catch, because if the process is not found, it's probably already quit.

@iiroj
Copy link
Member

iiroj commented Apr 9, 2022

@verekia I pushed a commit that ignores errors from pidtree, I guess it's better this way.

@verekia
Copy link

verekia commented Apr 9, 2022

The pidtree error is gone, but it still crashes:

I run 3 tasks : Prettier, ESLint, and TS check
My test here involves only a Prettier problem, so ESLint and TS should not report problems.
With 11.2.6 that's the case. But with 12.3.7 ESLint and TS get KILLED.

Also, when using 12.3.7 at the root, this problem doesn't happen, so it still seems related to having multiple configs.

Debug logs
$ lint-staged --debug
  lint-staged:bin Running `lint-staged@12.3.7` +0ms
  lint-staged:bin Options parsed from command-line: {
  allowEmpty: false,
  concurrent: true,
  configPath: undefined,
  cwd: undefined,
  debug: true,
  maxArgLength: 131072,
  quiet: false,
  relative: false,
  shell: false,
  stash: 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/verekia/Local/Code/private-projects/apps/learnthai` +0ms
  lint-staged:resolveGitRepo Resolving git repo from `/Users/verekia/Local/Code/private-projects/apps/learnthai` +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', '--show-prefix' ] +0ms
  lint-staged:resolveGitRepo Resolved git directory to be `/Users/verekia/Local/Code/private-projects` +13ms
  lint-staged:resolveGitRepo Resolved git config directory to be `/Users/verekia/Local/Code/private-projects/.git` +0ms
  lint-staged:execGit Running git command [ 'log', '-1' ] +13ms
  lint-staged:execGit Running git command [ 'diff', '--staged', '--diff-filter=ACMR', '--name-only', '-z' ] +13ms
  lint-staged:runAll Loaded list of staged files in git:
  lint-staged:runAll [
  lint-staged:runAll   '/Users/verekia/Local/Code/private-projects/apps/learnthai/src/lib/create-id.ts'
  lint-staged:runAll ] +36ms
  lint-staged:searchConfigs Searching for configuration files... +0ms
  lint-staged:execGit Running git command [ 'ls-files', '-z', '--full-name' ] +10ms
  lint-staged:execGit Running git command [ 'ls-files', '-z', '--full-name', '--others', '--exclude-standard' ] +11ms
  lint-staged:searchConfigs Found possible config files: [
  '/Users/verekia/Local/Code/private-projects/apps/learnthai/.lintstagedrc.js',
  '/Users/verekia/Local/Code/private-projects/apps/learnthai/package.json'
] +27ms
  lint-staged:loadConfig Loading configuration from `/Users/verekia/Local/Code/private-projects/apps/learnthai/.lintstagedrc.js`... +0ms
  lint-staged:loadConfig Loading configuration from `/Users/verekia/Local/Code/private-projects/apps/learnthai/package.json`... +0ms
  lint-staged:loadConfig Successfully loaded config from `/Users/verekia/Local/Code/private-projects/apps/learnthai/package.json`:
  lint-staged:loadConfig null +1ms
  lint-staged:loadConfig Successfully loaded config from `/Users/verekia/Local/Code/private-projects/apps/learnthai/.lintstagedrc.js`:
  lint-staged:loadConfig {
  lint-staged:loadConfig   '*.{ts,tsx}': [ 'tsc-files' ],
  lint-staged:loadConfig   '*.{js,jsx,ts,tsx}': [ 'eslint' ],
  lint-staged:loadConfig   '*.{js,jsx,ts,tsx,json,html,css,md,gql,graphql}': [ 'prettier -c' ]
  lint-staged:loadConfig } +2ms
  lint-staged:validateConfig Validating config from `/Users/verekia/Local/Code/private-projects/apps/learnthai/.lintstagedrc.js`... +0ms
  lint-staged:validateConfig Validated config from `/Users/verekia/Local/Code/private-projects/apps/learnthai/.lintstagedrc.js`: +0ms
  lint-staged:validateConfig {
  lint-staged:validateConfig   '*.{ts,tsx}': [ 'tsc-files' ],
  lint-staged:validateConfig   '*.{js,jsx,ts,tsx}': [ 'eslint' ],
  lint-staged:validateConfig   '*.{js,jsx,ts,tsx,json,html,css,md,gql,graphql}': [ 'prettier -c' ]
  lint-staged:validateConfig } +1ms
  lint-staged:searchConfigs Found 1 config files +4ms
  lint-staged:groupFilesByConfig Grouping 1 files by 1 configurations +0ms
  lint-staged:chunkFiles Resolved an argument string length of 78 characters from 1 files +0ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 131072 +0ms
  lint-staged:generateTasks Generating linter tasks +0ms
  lint-staged:generateTasks Generated task: 
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: '*.{ts,tsx}',
  lint-staged:generateTasks   commands: [ 'tsc-files' ],
  lint-staged:generateTasks   fileList: [
  lint-staged:generateTasks     '/Users/verekia/Local/Code/private-projects/apps/learnthai/src/lib/create-id.ts'
  lint-staged:generateTasks   ]
  lint-staged:generateTasks } +1ms
  lint-staged:generateTasks Generated task: 
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: '*.{js,jsx,ts,tsx}',
  lint-staged:generateTasks   commands: [ 'eslint' ],
  lint-staged:generateTasks   fileList: [
  lint-staged:generateTasks     '/Users/verekia/Local/Code/private-projects/apps/learnthai/src/lib/create-id.ts'
  lint-staged:generateTasks   ]
  lint-staged:generateTasks } +0ms
  lint-staged:generateTasks Generated task: 
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: '*.{js,jsx,ts,tsx,json,html,css,md,gql,graphql}',
  lint-staged:generateTasks   commands: [ 'prettier -c' ],
  lint-staged:generateTasks   fileList: [
  lint-staged:generateTasks     '/Users/verekia/Local/Code/private-projects/apps/learnthai/src/lib/create-id.ts'
  lint-staged:generateTasks   ]
  lint-staged:generateTasks } +0ms
  lint-staged:makeCmdTasks Creating listr tasks for commands [ 'tsc-files' ] +0ms
  lint-staged:resolveTaskFn cmd: tsc-files +0ms
  lint-staged:resolveTaskFn args: [] +1ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: '/Users/verekia/Local/Code/private-projects/apps/learnthai',
  preferLocal: true,
  reject: false,
  shell: false
} +0ms
  lint-staged:makeCmdTasks Creating listr tasks for commands [ 'eslint' ] +1ms
  lint-staged:resolveTaskFn cmd: eslint +0ms
  lint-staged:resolveTaskFn args: [] +0ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: '/Users/verekia/Local/Code/private-projects/apps/learnthai',
  preferLocal: true,
  reject: false,
  shell: false
} +0ms
  lint-staged:makeCmdTasks Creating listr tasks for commands [ 'prettier -c' ] +0ms
  lint-staged:resolveTaskFn cmd: prettier +0ms
  lint-staged:resolveTaskFn args: [ '-c' ] +0ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: '/Users/verekia/Local/Code/private-projects/apps/learnthai',
  preferLocal: true,
  reject: false,
  shell: false
} +0ms
  lint-staged:chunkFiles Resolved an argument string length of 78 characters from 1 files +4ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 131072 +0ms
[STARTED] Preparing lint-staged...
  lint-staged:GitWorkflow Backing up original state... +0ms
  lint-staged:GitWorkflow Getting partially staged files... +0ms
  lint-staged:execGit Running git command [ 'status', '-z' ] +26ms
  lint-staged:GitWorkflow Found partially staged files: [] +16ms
  lint-staged:GitWorkflow Backing up merge state... +1ms
  lint-staged:file Reading file `/Users/verekia/Local/Code/private-projects/.git/MERGE_HEAD` +0ms
  lint-staged:file Reading file `/Users/verekia/Local/Code/private-projects/.git/MERGE_MODE` +0ms
  lint-staged:file Reading file `/Users/verekia/Local/Code/private-projects/.git/MERGE_MSG` +0ms
  lint-staged:file File `/Users/verekia/Local/Code/private-projects/.git/MERGE_HEAD` doesn't exist, ignoring... +0ms
  lint-staged:file File `/Users/verekia/Local/Code/private-projects/.git/MERGE_MODE` doesn't exist, ignoring... +0ms
  lint-staged:file File `/Users/verekia/Local/Code/private-projects/.git/MERGE_MSG` doesn't exist, ignoring... +0ms
  lint-staged:GitWorkflow Done backing up merge state! +0ms
  lint-staged:GitWorkflow Getting deleted files... +0ms
  lint-staged:execGit Running git command [ 'ls-files', '--deleted' ] +17ms
  lint-staged:GitWorkflow Found deleted files: [] +11ms
  lint-staged:execGit Running git command [ 'stash', 'create' ] +11ms
  lint-staged:execGit Running git command [
  'stash',
  'store',
  '--quiet',
  '--message',
  'lint-staged automatic backup',
  '7277eb434393358570d52128224e3e6d3902306d'
] +22ms
  lint-staged:GitWorkflow Done backing up original state! +33ms
[SUCCESS] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] .lintstagedrc.js — 1 file
[STARTED] *.{ts,tsx} — 1 file
[STARTED] *.{js,jsx,ts,tsx} — 1 file
[STARTED] *.{js,jsx,ts,tsx,json,html,css,md,gql,graphql} — 1 file
[STARTED] tsc-files
[STARTED] eslint
[STARTED] prettier -c
[FAILED] prettier -c [FAILED]
[FAILED] prettier -c [FAILED]
[SUCCESS] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
[SKIPPED] Skipped because of errors from tasks.
[STARTED] Reverting to original state because of errors...
  lint-staged:GitWorkflow Restoring original state... +355ms
  lint-staged:execGit Running git command [ 'reset', '--hard', 'HEAD' ] +366ms
  lint-staged:execGit Running git command [ 'stash', 'list' ] +71ms
[FAILED] eslint [KILLED]
[FAILED] eslint [KILLED]
  lint-staged:execGit Running git command [ 'stash', 'apply', '--quiet', '--index', 'refs/stash@{0}' ] +27ms
  lint-staged:GitWorkflow Restoring merge state... +144ms
  lint-staged:GitWorkflow Done restoring merge state! +0ms
  lint-staged:file Removing file `/Users/verekia/Local/Code/private-projects/.git/lint-staged_unstaged.patch` +543ms
  lint-staged:file File `/Users/verekia/Local/Code/private-projects/.git/lint-staged_unstaged.patch` doesn't exist, ignoring... +0ms
  lint-staged:GitWorkflow Done restoring original state! +0ms
[SUCCESS] Reverting to original state because of errors...
[STARTED] Cleaning up temporary files...
  lint-staged:GitWorkflow Dropping backup stash... +0ms
  lint-staged:execGit Running git command [ 'stash', 'list' ] +46ms
  lint-staged:execGit Running git command [ 'stash', 'drop', '--quiet', 'refs/stash@{0}' ] +12ms
  lint-staged:GitWorkflow Done dropping backup stash! +28ms
[SUCCESS] Cleaning up temporary files...

✖ prettier -c:
[warn] src/lib/create-id.ts
[warn] Code style issues found in the above file(s). Forgot to run Prettier?
Checking formatting...

✖ eslint failed without output (KILLED).
[FAILED] tsc-files [KILLED]
[FAILED] tsc-files [KILLED]
error Command failed with exit code 1.

Edit: @iiroj I corrected this comment. It previously said that ESLint and TS should not run at all, but that was wrong. It's just that they should not report any problem.

@iiroj
Copy link
Member

iiroj commented Apr 9, 2022

I mean, looks like one of your tasks failed and so the others were killed as well. That was the goal of PR #1117.

@verekia
Copy link

verekia commented Apr 9, 2022

But it doesn't exit cleanly.
It should show that these 2 other tasks are ✅, but they are ❌ with crashing messages, and even leave some TS build artifacts after running. Something is not terminating as expected.

@iiroj
Copy link
Member

iiroj commented Apr 9, 2022

Are they still running when the failing task exits? If they are killed mid-run, how can one know they're not going to fail as well?

Or do you just mean visually that the tasks should look like "skipped" instead of "failed"?

@verekia
Copy link

verekia commented Apr 9, 2022

You're right, sorry I didn't really understand what was going on, it's more clear now thanks to your comment.

Also, the "TS build artifacts" I mentioned is not lint-staged's fault per se. It's because tsc-files creates temporary tsconfig.json files, and since the process gets killed mid-run, the files don't get a chance to get cleaned up. So I guess I should use --concurrent false to prevent the issue.

Anyway, so I guess it's just a matter of UI then, because it looks very messy when the processes are killed.

The tree view appears 2 times which is quite overwhelming. I don't think that's intentional. If not I can open a new issue to stop polluting this one :)

@iiroj
Copy link
Member

iiroj commented Apr 9, 2022

Can you open a separate issue of the duplicate log output? It might be because of an update to Listr2 or something; not intentional.

@verekia
Copy link

verekia commented Apr 9, 2022

Opened here: #1134
Thank you.

@alex-grover
Copy link
Author

@iiroj that PR does fix the issue for me! thanks for looking into this so quickly. here are the debug logs in case you need them.

expand to view
$ npx lint-staged --debug
  lint-staged:bin Running `lint-staged@12.3.7` +0ms
  lint-staged:bin Options parsed from command-line: {
  allowEmpty: false,
  concurrent: true,
  configPath: undefined,
  cwd: undefined,
  debug: true,
  maxArgLength: 131072,
  quiet: false,
  relative: false,
  shell: false,
  stash: 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/alexgrover/Developer/lint-staged-bug/a` +0ms
  lint-staged:resolveGitRepo Resolving git repo from `/Users/alexgrover/Developer/lint-staged-bug/a` +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', '--show-prefix' ] +0ms
  lint-staged:resolveGitRepo Resolved git directory to be `/Users/alexgrover/Developer/lint-staged-bug` +17ms
  lint-staged:resolveGitRepo Resolved git config directory to be `/Users/alexgrover/Developer/lint-staged-bug/.git` +0ms
  lint-staged:execGit Running git command [ 'log', '-1' ] +17ms
  lint-staged:execGit Running git command [ 'diff', '--staged', '--diff-filter=ACMR', '--name-only', '-z' ] +9ms
  lint-staged:runAll Loaded list of staged files in git:
  lint-staged:runAll [
  lint-staged:runAll   '/Users/alexgrover/Developer/lint-staged-bug/a/a.txt',
  lint-staged:runAll   '/Users/alexgrover/Developer/lint-staged-bug/b/b.txt',
  lint-staged:runAll   '/Users/alexgrover/Developer/lint-staged-bug/parent.txt'
  lint-staged:runAll ] +35ms
  lint-staged:searchConfigs Searching for configuration files... +0ms
  lint-staged:execGit Running git command [ 'ls-files', '-z', '--full-name' ] +10ms
  lint-staged:execGit Running git command [ 'ls-files', '-z', '--full-name', '--others', '--exclude-standard' ] +8ms
  lint-staged:searchConfigs Found possible config files: [ '/Users/alexgrover/Developer/lint-staged-bug/a/package.json' ] +16ms
  lint-staged:loadConfig Loading configuration from `/Users/alexgrover/Developer/lint-staged-bug/a/package.json`... +0ms
  lint-staged:loadConfig Successfully loaded config from `/Users/alexgrover/Developer/lint-staged-bug/a/package.json`:
  lint-staged:loadConfig { 'a.txt': 'echo "a modified"' } +1ms
  lint-staged:validateConfig Validating config from `/Users/alexgrover/Developer/lint-staged-bug/a/package.json`... +0ms
  lint-staged:validateConfig Validated config from `/Users/alexgrover/Developer/lint-staged-bug/a/package.json`: +1ms
  lint-staged:validateConfig {
  lint-staged:validateConfig   'a.txt': 'echo "a modified"'
  lint-staged:validateConfig } +1ms
  lint-staged:searchConfigs Found 1 config files +3ms
  lint-staged:groupFilesByConfig Grouping 3 files by 1 configurations +0ms
  lint-staged:chunkFiles Resolved an argument string length of 51 characters from 1 files +0ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 131072 +0ms
  lint-staged:generateTasks Generating linter tasks +0ms
  lint-staged:generateTasks Generated task: 
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: 'a.txt',
  lint-staged:generateTasks   commands: 'echo "a modified"',
  lint-staged:generateTasks   fileList: [ '/Users/alexgrover/Developer/lint-staged-bug/a/a.txt' ]
  lint-staged:generateTasks } +2ms
  lint-staged:makeCmdTasks Creating listr tasks for commands 'echo "a modified"' +0ms
  lint-staged:resolveTaskFn cmd: echo +0ms
  lint-staged:resolveTaskFn args: [ 'a modified' ] +0ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: '/Users/alexgrover/Developer/lint-staged-bug/a',
  preferLocal: true,
  reject: false,
  shell: false
} +0ms
  lint-staged:chunkFiles Resolved an argument string length of 51 characters from 1 files +6ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 131072 +0ms
[STARTED] Preparing lint-staged...
  lint-staged:GitWorkflow Backing up original state... +0ms
  lint-staged:GitWorkflow Getting partially staged files... +0ms
  lint-staged:execGit Running git command [ 'status', '-z' ] +22ms
  lint-staged:GitWorkflow Found partially staged files: [] +11ms
  lint-staged:GitWorkflow Backing up merge state... +0ms
  lint-staged:file Reading file `/Users/alexgrover/Developer/lint-staged-bug/.git/MERGE_HEAD` +0ms
  lint-staged:file Reading file `/Users/alexgrover/Developer/lint-staged-bug/.git/MERGE_MODE` +0ms
  lint-staged:file Reading file `/Users/alexgrover/Developer/lint-staged-bug/.git/MERGE_MSG` +0ms
  lint-staged:file File `/Users/alexgrover/Developer/lint-staged-bug/.git/MERGE_HEAD` doesn't exist, ignoring... +0ms
  lint-staged:file File `/Users/alexgrover/Developer/lint-staged-bug/.git/MERGE_MODE` doesn't exist, ignoring... +0ms
  lint-staged:file File `/Users/alexgrover/Developer/lint-staged-bug/.git/MERGE_MSG` doesn't exist, ignoring... +1ms
  lint-staged:GitWorkflow Done backing up merge state! +1ms
  lint-staged:GitWorkflow Getting deleted files... +0ms
  lint-staged:execGit Running git command [ 'ls-files', '--deleted' ] +12ms
  lint-staged:GitWorkflow Found deleted files: [] +6ms
  lint-staged:execGit Running git command [ 'stash', 'create' ] +7ms
  lint-staged:execGit Running git command [
  'stash',
  'store',
  '--quiet',
  '--message',
  'lint-staged automatic backup',
  'a12877feb6bbf35ded33cc80ca6d77c5ab314422'
] +19ms
  lint-staged:GitWorkflow Done backing up original state! +29ms
[SUCCESS] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] package.json — 1 file
[STARTED] a.txt — 1 file
[STARTED] echo "a modified"
[SUCCESS] echo "a modified"
[SUCCESS] a.txt — 1 file
[SUCCESS] package.json — 1 file
[SUCCESS] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
  lint-staged:GitWorkflow Adding task modifications to index... +8ms
  lint-staged:execGit Running git command [ 'add', '--', '/Users/alexgrover/Developer/lint-staged-bug/a/a.txt' ] +17ms
  lint-staged:GitWorkflow Done adding task modifications to index! +7ms
  lint-staged:execGit Running git command [ 'diff', '--name-only', '--cached' ] +7ms
[SUCCESS] Applying modifications from tasks...
[STARTED] Cleaning up temporary files...
  lint-staged:GitWorkflow Dropping backup stash... +8ms
  lint-staged:execGit Running git command [ 'stash', 'list' ] +8ms
  lint-staged:execGit Running git command [ 'stash', 'drop', '--quiet', 'refs/stash@{0}' ] +15ms
  lint-staged:GitWorkflow Done dropping backup stash! +31ms
[SUCCESS] Cleaning up temporary files...
  lint-staged Tasks were executed successfully! +168ms

@iiroj
Copy link
Member

iiroj commented Apr 9, 2022

Thanks for confirming, @alex-grover! I'll add some missing unit test coverage and try to get it released soon.

@Lonli-Lokli
Copy link

I still observe the behaviour with lint-staged & husky, eg when I have changes in two separate folders with two separate rc files, both folders are validated.

Debug log
PS D:\gitlab\cv-app\frontend\cv-ui> npx lint-staged --debug
  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,
  verbose: false
} +0ms
  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 `D:\gitlab\cv-app\frontend\cv-ui` +1ms
  lint-staged:resolveGitRepo Resolving git repo from `D:\gitlab\cv-app\frontend\cv-ui` +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', '--show-prefix' ] +0ms
  lint-staged:resolveGitRepo Resolved git directory to be `D:/gitlab/cv-app` +99ms
  lint-staged:resolveGitRepo Resolved git config directory to be `D:/gitlab/cv-app/.git` +0ms
  lint-staged:execGit Running git command [ 'log', '-1' ] +99ms
  lint-staged:execGit Running git command [ 'diff', '--name-only', '-z', '--diff-filter=ACMR', '--staged' ] +75ms
  lint-staged:runAll Loaded list of staged files in git:
  lint-staged:runAll [
  lint-staged:runAll   'D:/gitlab/cv-app/.gitignore',
  lint-staged:runAll   'D:/gitlab/cv-app/.gitlab-ci.yml',
  lint-staged:runAll   'D:/gitlab/cv-app/backend/cv-api/.config/dotnet-tools.json',
  lint-staged:runAll   'D:/gitlab/cv-app/backend/cv-api/CV.Core/CV.Core.fsproj',
  lint-staged:runAll   'D:/gitlab/cv-app/backend/cv-api/CV.Domain.Services.Abstractions/CV.Domain.Services.Abstractions.csproj',
  lint-staged:runAll   'D:/gitlab/cv-app/backend/cv-api/CV.Domain.Services.Tests/CV.Domain.Services.Tests.csproj',
  lint-staged:runAll   'D:/gitlab/cv-app/backend/cv-api/CV.Domain/CV.Domain.fsproj',
  lint-staged:runAll   'D:/gitlab/cv-app/backend/cv-api/CV.Repository.Abstractions/CV.Repository.Abstractions.csproj',
  lint-staged:runAll   'D:/gitlab/cv-app/backend/cv-api/CV.Repository.LiteDb/CV.Repository.LiteDb.csproj',
  lint-staged:runAll   'D:/gitlab/cv-app/backend/cv-api/CV.WebApi.Tests/CV.WebApi.Tests.csproj',
  lint-staged:runAll   'D:/gitlab/cv-app/backend/cv-api/CV.WebApi/CV.WebApi.csproj',
  lint-staged:runAll   'D:/gitlab/cv-app/backend/cv-api/Directory.Build.props',
  lint-staged:runAll   'D:/gitlab/cv-app/backend/cv-api/THANKS.md',
  lint-staged:runAll   'D:/gitlab/cv-app/backend/cv-api/scripts/deploy/Dockerfile',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/.eslintignore',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/.eslintrc.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/.gitattributes',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/.gitignore',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/.gitlab-ci.yml',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/.husky/pre-commit',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/.lintstagedrc.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/.npmrc',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/.prettierignore',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/.prettierrc',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/.yarn/plugins/@yarnpkg/plugin-engines.cjs',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/.yarn/releases/yarn-3.2.1.cjs',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/.yarnrc.yml',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/README.md',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/package.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/playwright.config.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/tests-examples/demo-todo-app.spec.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/tests/example.spec.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/tools/schematics/.gitkeep',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/tools/tsconfig.tools.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/tsconfig.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui-e2e/yarn.lock',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.eslintrc.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.gitignore',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.gitlab-ci.yml',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.prettierignore',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.stylelintrc',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.vscode/extensions.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.vscode/settings.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.yarn/releases/yarn-3.2.2.cjs',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/eslint/lib/api.js',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/eslint/package.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/integrations.yml',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/prettier/index.js',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/prettier/package.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/typescript/lib/tsc.js',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/typescript/lib/tsserver.js',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/typescript/lib/tsserverlibrary.js',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/typescript/lib/typescript.js',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/typescript/package.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/.yarnrc.yml',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/angular.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/apps/cv/src/app/config-providers.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/apps/cv/src/config/host.config.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/apps/cv/src/config/prod/host.config.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/apps/cv/src/styles.scss',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/api/generated/request-builder.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/api/generated/services/t-documents.service.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/api/generated/services/t-info.service.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/api/generated/services/t-jobs.service.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/api/v1.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/auth/authentication/authentication.component.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/auth/profile/profile.component.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/button/index.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/directives/after-view-init.directive.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/directives/if-either.directive..ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/directives/if-option.directive..ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/directives/let.directive.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/index.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/pipes/call.pipe.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/pipes/not.pipe.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/pipes/safe-html.pipe.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/icons/icon/icon.component.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/navbar/navbar.component.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/modules/about/data-access/index.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/modules/about/ui/lib/about.routes.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/modules/about/ui/lib/api-info/api-info.component.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/modules/docs/data-access/index.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/modules/docs/ui/lib/document-list/document-list.component.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/modules/docs/ui/lib/documents.routes.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/modules/jobs/data-access/index.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/modules/jobs/ui/lib/jobs.routes.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/modules/jobs/ui/lib/require/require.component.html',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/modules/jobs/ui/lib/require/require.component.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/modules/jobs/ui/lib/shared/route-path.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/modules/jobs/ui/lib/tabs-view/tabs-view.component.ts',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/package.json',
  lint-staged:runAll   'D:/gitlab/cv-app/frontend/cv-ui/yarn.lock',
  lint-staged:runAll   'D:/gitlab/cv-app/infrastructure/api/main.tf',
  lint-staged:runAll   'D:/gitlab/cv-app/infrastructure/api/versions.tf',
  lint-staged:runAll   'D:/gitlab/cv-app/infrastructure/ui/.terraform.lock.hcl',
  lint-staged:runAll   'D:/gitlab/cv-app/infrastructure/ui/main.tf'
  lint-staged:runAll ] +310ms
  lint-staged:searchConfigs Searching for configuration files... +0ms
  lint-staged:execGit Running git command [ 'ls-files', '-z', '--full-name' ] +149ms
  lint-staged:execGit Running git command [ 'ls-files', '-z', '--full-name', '--others', '--exclude-standard' ] +26ms
  lint-staged:searchConfigs Found possible config files: [
  'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/eslint/package.json',
  'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/prettier/package.json',
  'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/typescript/package.json',
  'D:/gitlab/cv-app/frontend/cv-ui-e2e/.lintstagedrc.json',
  'D:/gitlab/cv-app/frontend/cv-ui-e2e/package.json',
  'D:/gitlab/cv-app/frontend/cv-ui/.lintstagedrc.json',
  'D:/gitlab/cv-app/frontend/cv-ui/package.json'
] +129ms
  lint-staged:loadConfig Loading configuration from `D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/eslint/package.json`... +0ms
  lint-staged:loadConfig Loading configuration from `D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/prettier/package.json`... +1ms
  lint-staged:loadConfig Loading configuration from `D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/typescript/package.json`... +0ms
  lint-staged:loadConfig Loading configuration from `D:/gitlab/cv-app/frontend/cv-ui-e2e/.lintstagedrc.json`... +1ms
  lint-staged:loadConfig Loading configuration from `D:/gitlab/cv-app/frontend/cv-ui-e2e/package.json`... +0ms
  lint-staged:loadConfig Loading configuration from `D:/gitlab/cv-app/frontend/cv-ui/.lintstagedrc.json`... +1ms
  lint-staged:loadConfig Loading configuration from `D:/gitlab/cv-app/frontend/cv-ui/package.json`... +0ms
  lint-staged:loadConfig Successfully loaded config from `D:\gitlab\cv-app\frontend\cv-ui\.yarn\sdks\eslint\package.json`:
  lint-staged:loadConfig null +1ms
  lint-staged:loadConfig Successfully loaded config from `D:\gitlab\cv-app\frontend\cv-ui\.yarn\sdks\prettier\package.json`:
  lint-staged:loadConfig null +0ms
  lint-staged:loadConfig Successfully loaded config from `D:\gitlab\cv-app\frontend\cv-ui\.yarn\sdks\typescript\package.json`:
  lint-staged:loadConfig null +1ms
  lint-staged:loadConfig Successfully loaded config from `D:\gitlab\cv-app\frontend\cv-ui-e2e\.lintstagedrc.json`:
  lint-staged:loadConfig {
  lint-staged:loadConfig   '*.{js,md}': [ 'prettier --write' ],
  lint-staged:loadConfig   '*.ts': [ 'prettier --write', 'eslint --quiet --fix' ]
  lint-staged:loadConfig } +0ms
  lint-staged:searchConfigs Config file "D:/gitlab/cv-app/frontend/cv-ui-e2e/.lintstagedrc.json" resolved to "D:\gitlab\cv-app\frontend\cv-ui-e2e\.lintstagedrc.json" +9ms
  lint-staged:validateConfig Validating config from `D:\gitlab\cv-app\frontend\cv-ui-e2e\.lintstagedrc.json`... +0ms
  lint-staged:validateConfig Validated config from `D:\gitlab\cv-app\frontend\cv-ui-e2e\.lintstagedrc.json`: +1ms
  lint-staged:validateConfig {
  lint-staged:validateConfig   '*.{js,md}': [ 'prettier --write' ],
  lint-staged:validateConfig   '*.ts': [ 'prettier --write', 'eslint --quiet --fix' ]
  lint-staged:validateConfig } +1ms
  lint-staged:loadConfig Successfully loaded config from `D:\gitlab\cv-app\frontend\cv-ui-e2e\package.json`:
  lint-staged:loadConfig null +5ms
  lint-staged:loadConfig Successfully loaded config from `D:\gitlab\cv-app\frontend\cv-ui\.lintstagedrc.json`:
  lint-staged:loadConfig {
  lint-staged:loadConfig   '*.{js,md}': [ 'prettier --write' ],
  lint-staged:loadConfig   '*.{scss,css}': [ 'prettier --write', 'yarn lint:styles' ],
  lint-staged:loadConfig   '*.ts': [ 'prettier --write', 'eslint --quiet --fix' ]
  lint-staged:loadConfig } +0ms
  lint-staged:searchConfigs Config file "D:/gitlab/cv-app/frontend/cv-ui/.lintstagedrc.json" resolved to "D:\gitlab\cv-app\frontend\cv-ui\.lintstagedrc.json" +4ms
  lint-staged:validateConfig Validating config from `D:\gitlab\cv-app\frontend\cv-ui\.lintstagedrc.json`... +2ms
  lint-staged:validateConfig Validated config from `D:\gitlab\cv-app\frontend\cv-ui\.lintstagedrc.json`: +0ms
  lint-staged:validateConfig {
  lint-staged:validateConfig   '*.{js,md}': [ 'prettier --write' ],
  lint-staged:validateConfig   '*.{scss,css}': [ 'prettier --write', 'yarn lint:styles' ],
  lint-staged:validateConfig   '*.ts': [ 'prettier --write', 'eslint --quiet --fix' ]
  lint-staged:validateConfig } +1ms
  lint-staged:loadConfig Successfully loaded config from `D:\gitlab\cv-app\frontend\cv-ui\package.json`:
  lint-staged:loadConfig null +3ms
  lint-staged:searchConfigs Found 2 config files +3ms
  lint-staged:groupFilesByConfig Grouping 97 files by 2 configurations +0ms
  lint-staged:chunkFiles Resolved an argument string length of 1284 characters from 23 files +0ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 4095.5 +1ms
  lint-staged:generateTasks Generating linter tasks +0ms
  lint-staged:generateTasks Generated task: 
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: '*.{js,md}',
  lint-staged:generateTasks   commands: [ 'prettier --write' ],
  lint-staged:generateTasks   fileList: [ 'D:/gitlab/cv-app/frontend/cv-ui-e2e/README.md' ]
  lint-staged:generateTasks } +7ms
  lint-staged:generateTasks Generated task:
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: '*.ts',
  lint-staged:generateTasks   commands: [ 'prettier --write', 'eslint --quiet --fix' ],
  lint-staged:generateTasks   fileList: [
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui-e2e/playwright.config.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui-e2e/tests-examples/demo-todo-app.spec.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui-e2e/tests/example.spec.ts'
  lint-staged:generateTasks   ]
  lint-staged:generateTasks } +4ms
  lint-staged:makeCmdTasks Creating listr tasks for commands [ 'prettier --write' ] +0ms
  lint-staged:resolveTaskFn cmd: prettier +0ms
  lint-staged:resolveTaskFn args: [ '--write' ] +1ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: 'D:/gitlab/cv-app/frontend/cv-ui-e2e',
  preferLocal: true,
  reject: false,
  shell: false
} +0ms
  lint-staged:makeCmdTasks Creating listr tasks for commands [ 'prettier --write', 'eslint --quiet --fix' ] +5ms
  lint-staged:resolveTaskFn cmd: prettier +3ms
  lint-staged:resolveTaskFn args: [ '--write' ] +0ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: 'D:/gitlab/cv-app/frontend/cv-ui-e2e',
  preferLocal: true,
  reject: false,
  shell: false
} +0ms
  lint-staged:resolveTaskFn cmd: eslint +2ms
  lint-staged:resolveTaskFn args: [ '--quiet', '--fix' ] +1ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: 'D:/gitlab/cv-app/frontend/cv-ui-e2e',
  preferLocal: true,
  reject: false,
  shell: false
} +1ms
  lint-staged:chunkFiles Resolved an argument string length of 3845 characters from 56 files +30ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 4095.5 +1ms
  lint-staged:generateTasks Generating linter tasks +20ms
  lint-staged:generateTasks Generated task:
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: '*.{js,md}',
  lint-staged:generateTasks   commands: [ 'prettier --write' ],
  lint-staged:generateTasks   fileList: [
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/eslint/lib/api.js',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/prettier/index.js',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/typescript/lib/tsc.js',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/typescript/lib/tsserver.js',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/typescript/lib/tsserverlibrary.js',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/.yarn/sdks/typescript/lib/typescript.js'
  lint-staged:generateTasks   ]
  lint-staged:generateTasks } +2ms
  lint-staged:generateTasks Generated task:
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: '*.{scss,css}',
  lint-staged:generateTasks   commands: [ 'prettier --write', 'yarn lint:styles' ],
  lint-staged:generateTasks   fileList: [ 'D:/gitlab/cv-app/frontend/cv-ui/apps/cv/src/styles.scss' ]
  lint-staged:generateTasks } +3ms
  lint-staged:generateTasks Generated task: 
  lint-staged:generateTasks {
  lint-staged:generateTasks   pattern: '*.ts',
  lint-staged:generateTasks   commands: [ 'prettier --write', 'eslint --quiet --fix' ],
  lint-staged:generateTasks   fileList: [
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/apps/cv/src/app/config-providers.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/api/generated/request-builder.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/api/generated/services/t-documents.service.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/api/generated/services/t-info.service.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/api/generated/services/t-jobs.service.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/auth/authentication/authentication.component.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/auth/profile/profile.component.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/button/index.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/directives/after-view-init.directive.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/directives/if-either.directive..ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/directives/if-option.directive..ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/directives/let.directive.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/index.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/pipes/call.pipe.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/pipes/not.pipe.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/core/pipes/safe-html.pipe.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/icons/icon/icon.component.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/libs/common/src/lib/navbar/navbar.component.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/modules/about/data-access/index.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/modules/about/ui/lib/about.routes.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/modules/about/ui/lib/api-info/api-info.component.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/modules/docs/data-access/index.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/modules/docs/ui/lib/document-list/document-list.component.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/modules/docs/ui/lib/documents.routes.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/modules/jobs/data-access/index.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/modules/jobs/ui/lib/jobs.routes.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/modules/jobs/ui/lib/require/require.component.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/modules/jobs/ui/lib/shared/route-path.ts',
  lint-staged:generateTasks     'D:/gitlab/cv-app/frontend/cv-ui/modules/jobs/ui/lib/tabs-view/tabs-view.component.ts'
  lint-staged:generateTasks   ]
  lint-staged:generateTasks } +2ms
  lint-staged:makeCmdTasks Creating listr tasks for commands [ 'prettier --write' ] +29ms
  lint-staged:resolveTaskFn cmd: prettier +27ms
  lint-staged:resolveTaskFn args: [ '--write' ] +1ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: 'D:/gitlab/cv-app/frontend/cv-ui',
  preferLocal: true,
  reject: false,
  shell: false
} +1ms
  lint-staged:makeCmdTasks Creating listr tasks for commands [ 'prettier --write', 'yarn lint:styles' ] +8ms
  lint-staged:resolveTaskFn cmd: prettier +3ms
  lint-staged:resolveTaskFn args: [ '--write' ] +0ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: 'D:/gitlab/cv-app/frontend/cv-ui',
  preferLocal: true,
  reject: false,
  shell: false
} +1ms
  lint-staged:resolveTaskFn cmd: yarn +2ms
  lint-staged:resolveTaskFn args: [ 'lint:styles' ] +1ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: 'D:/gitlab/cv-app/frontend/cv-ui',
  preferLocal: true,
  reject: false,
  shell: false
} +2ms
  lint-staged:makeCmdTasks Creating listr tasks for commands [ 'prettier --write', 'eslint --quiet --fix' ] +8ms
  lint-staged:resolveTaskFn cmd: prettier +4ms
  lint-staged:resolveTaskFn args: [ '--write' ] +1ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: 'D:/gitlab/cv-app/frontend/cv-ui',
  preferLocal: true,
  reject: false,
  shell: false
} +0ms
  lint-staged:resolveTaskFn cmd: eslint +2ms
  lint-staged:resolveTaskFn args: [ '--quiet', '--fix' ] +1ms
  lint-staged:resolveTaskFn execaOptions: {
  cwd: 'D:/gitlab/cv-app/frontend/cv-ui',
  preferLocal: true,
  reject: false,
  shell: false
} +1ms
  lint-staged:chunkFiles Resolved an argument string length of 2973 characters from 40 files +44ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 4095.5 +0ms
[STARTED] Preparing lint-staged...
  lint-staged:GitWorkflow Backing up original state... +0ms
  lint-staged:GitWorkflow Getting partially staged files... +0ms
  lint-staged:execGit Running git command [ 'status', '-z' ] +212ms
  lint-staged:GitWorkflow Found partially staged files: [] +221ms
  lint-staged:GitWorkflow Backing up merge state... +1ms
  lint-staged:file Reading file `D:\gitlab\cv-app\.git\MERGE_HEAD` +0ms
  lint-staged:file Reading file `D:\gitlab\cv-app\.git\MERGE_MODE` +0ms
  lint-staged:file Reading file `D:\gitlab\cv-app\.git\MERGE_MSG` +1ms
  lint-staged:GitWorkflow Done backing up merge state! +4ms
  lint-staged:GitWorkflow Getting deleted files... +0ms
  lint-staged:execGit Running git command [ 'ls-files', '--deleted' ] +226ms
  lint-staged:GitWorkflow Found deleted files: [] +90ms
  lint-staged:execGit Running git command [ 'stash', 'create' ] +89ms
  lint-staged:execGit Running git command [
  'stash',
  'store',
  '--quiet',
  '--message',
  'lint-staged automatic backup',
  '7ba65499a8134fa69834ed98f792f50cff5f2b5b'
] +187ms
  lint-staged:GitWorkflow Done backing up original state! +271ms
[SUCCESS] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] ../cv-ui-e2e/.lintstagedrc.json — 23 files
[STARTED] .lintstagedrc.json — 56 files
[STARTED] *.{js,md} — 1 file
[STARTED] *.ts — 3 files
[STARTED] *.{js,md} — 6 files
[STARTED] *.{scss,css} — 1 file
[STARTED] yarn lint:styles
[SUCCESS] prettier --write
[STARTED] eslint --quiet --fix
[SUCCESS] prettier --write
[STARTED] eslint --quiet --fix
[FAILED] eslint --quiet --fix [FAILED]
[FAILED] eslint --quiet --fix [FAILED]
[FAILED] eslint --quiet --fix [FAILED]
[STARTED] Applying modifications from tasks...
[SKIPPED] Skipped because of errors from tasks.
[STARTED] Reverting to original state because of errors...
  lint-staged:GitWorkflow Restoring original state... +3s
  lint-staged:execGit Running git command [ 'reset', '--hard', 'HEAD' ] +3s
  lint-staged:execGit Running git command [ 'stash', 'list' ] +434ms
  lint-staged:execGit Running git command [ 'stash', 'apply', '--quiet', '--index', 'refs/stash@{0}' ] +204ms
[FAILED] eslint --quiet --fix [KILLED]
[FAILED] eslint --quiet --fix [KILLED]
[FAILED] eslint --quiet --fix [KILLED]
  lint-staged:resolveTaskFn Failed to kill process with pid "11116": Error: No matching pid found at D:\gitlab\cv-app\frontend\cv-ui\node_modules\pidtree\lib\pidtree.js:61:16 at D:\gitlab\cv-app\frontend\cv-ui\node_modules\pidtree\lib\wmic.js:42:7 at ChildProcess.<anonymous> (D:\gitlab\cv-app\frontend\cv-ui\node_modules\pidtree\lib\bin.js:57:5)     at ChildProcess.emit (node:events:513:28)     at maybeClose (node:internal/child_process:1093:16)     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) +6s
[FAILED] yarn lint:styles [KILLED]
[FAILED] yarn lint:styles [KILLED]
  lint-staged:GitWorkflow Restoring merge state... +6s
  lint-staged:file Writing file `D:\gitlab\cv-app\.git\MERGE_HEAD` +8s
  lint-staged:file Writing file `D:\gitlab\cv-app\.git\MERGE_MODE` +1ms
  lint-staged:file Writing file `D:\gitlab\cv-app\.git\MERGE_MSG` +2ms
  lint-staged:GitWorkflow Done restoring merge state! +21ms
  lint-staged:file Removing file `D:\gitlab\cv-app\.git\lint-staged_unstaged.patch` +16ms
  lint-staged:file File `D:\gitlab\cv-app\.git\lint-staged_unstaged.patch` doesn't exist, ignoring... +2ms
  lint-staged:GitWorkflow Done restoring original state! +3ms
[SUCCESS] Reverting to original state because of errors...
[STARTED] Cleaning up temporary files...
  lint-staged:GitWorkflow Dropping backup stash... +1ms
  lint-staged:execGit Running git command [ 'stash', 'list' ] +5s
  lint-staged:execGit Running git command [ 'stash', 'drop', '--quiet', 'refs/stash@{0}' ] +634ms
  lint-staged:GitWorkflow Done dropping backup stash! +1s
[SUCCESS] Cleaning up temporary files...

✖ eslint --quiet --fix:

Oops! Something went wrong! :(

ESLint: 8.21.0

ESLint couldn't find the plugin "@typescript-eslint/eslint-plugin".

(The package "@typescript-eslint/eslint-plugin" was not found when loaded as a Node module from the directory "D:\gitlab\cv-app\frontend\cv-ui-e2e".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

    npm install @typescript-eslint/eslint-plugin@latest --save-dev

The plugin "@typescript-eslint/eslint-plugin" was referenced from the config file in ".eslintrc.json".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.


✖ eslint --quiet --fix failed without output (KILLED).

✖ yarn lint:styles failed without output (KILLED).

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

Successfully merging a pull request may close this issue.

4 participants