git clone https://github.com/xmlking/ngx-starter-kit -b develop
npx lint-staged
this command hang forever.
you can run lint commands successfully e.g.
npm run affected:lint -- --uncommitted --fix --parallel
if you remove --fix --parallel from lint-staged command then the lint-staged works
npx lint-staged -d
lint-staged:bin Running `[email protected]` +0ms
lint-staged:find-bin Loaded package.json using `process.cwd()` +0ms
lint-staged Loading config using `cosmiconfig` +0ms
lint-staged Successfully loaded config from `/Developer/Work/SPA/ngx-starter-kit/package.json`:
lint-staged { '{apps,libs}/**/*.{ts,json,md,scss}':
lint-staged [ 'npm run affected:lint -- --uncommitted --fix --parallel',
lint-staged 'npm run format:write -- --uncommitted',
lint-staged 'git add' ] } +3ms
lint-staged:cfg Normalizing config +0ms
lint-staged:cfg Validating config +2ms
Running lint-staged with the following config:
{
linters: {
'{apps,libs}/**/*.{ts,json,md,scss}': [
'npm run affected:lint -- --uncommitted --fix --parallel',
'npm run format:write -- --uncommitted',
'git add'
]
},
concurrent: true,
chunkSize: 9007199254740991,
globOptions: {
matchBase: true,
dot: true
},
ignore: [],
subTaskConcurrency: 1,
renderer: 'verbose'
}
lint-staged:run Running all linter scripts +0ms
lint-staged:run Resolved git directory to be `/Developer/Work/SPA/ngx-starter-kit` +1ms
lint-staged:run Loaded list of staged files in git:
lint-staged:run [ 'package.json',
lint-staged:run 'package-lock.json',
lint-staged:run 'libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts',
lint-staged:run 'libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts',
lint-staged:run 'libs/chat-box/src/lib/services/speech-to-text.service.ts',
lint-staged:run 'PLAYBOOK.md' ] +29ms
lint-staged:gen-tasks Generating linter tasks +0ms
lint-staged:cfg Normalizing config +34ms
lint-staged:gen-tasks Generated task:
lint-staged:gen-tasks { pattern: '{apps,libs}/**/*.{ts,json,md,scss}',
lint-staged:gen-tasks commands:
lint-staged:gen-tasks [ 'npm run affected:lint -- --uncommitted --fix --parallel',
lint-staged:gen-tasks 'npm run format:write -- --uncommitted',
lint-staged:gen-tasks 'git add' ],
lint-staged:gen-tasks fileList:
lint-staged:gen-tasks [ '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts',
lint-staged:gen-tasks '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts',
lint-staged:gen-tasks '/Developer/Work/SPA/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts' ] } +17ms
Stashing changes... [started]
Stashing changes... [skipped]
β No partially staged files found...
Running linters... [started]
Running tasks for {apps,libs}/**/*.{ts,json,md,scss} [started]
lint-staged:make-cmd-tasks Creating listr tasks for commands [ 'npm run affected:lint -- --uncommitted --fix --parallel', 'npm run format:write -- --uncommitted', 'git add' ] +0ms
lint-staged:find-bin Resolving binary for command `npm run affected:lint -- --uncommitted --fix --parallel` +206ms
lint-staged:find-bin Binary for `npm run affected:lint -- --uncommitted --fix --parallel` resolved to `/Developer/Work/SPA/ngx-starter-kit/node_modules/.bin/npm` +3ms
lint-staged:task β OS: darwin; File path chunking unnecessary +0ms
lint-staged:find-bin Resolving binary for command `npm run format:write -- --uncommitted` +0ms
lint-staged:find-bin Resolving binary for `npm` from cache +0ms
lint-staged:task β OS: darwin; File path chunking unnecessary +0ms
lint-staged:find-bin Resolving binary for command `git add` +0ms
lint-staged:find-bin Binary for `git add` resolved to `/usr/local/bin/git` +1ms
lint-staged:task β OS: darwin; File path chunking unnecessary +1ms
npm run affected:lint -- --uncommitted --fix --parallel [started]
lint-staged:task bin: /Developer/Work/SPA/ngx-starter-kit/node_modules/.bin/npm +0ms
lint-staged:task args: [ 'run',
lint-staged:task 'affected:lint',
lint-staged:task '--',
lint-staged:task '--uncommitted',
lint-staged:task '--fix',
lint-staged:task '--parallel',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts' ] +0ms
lint-staged:task opts: { reject: false } +1ms
lint-staged: v8.0.2Without the debug log I wonβt be able to help you. Please provide the debug logs.
I don't know how to get debug logs. it just hangs will following logs. please advise how to produce debug logs!
npx lint-staged
β Stashing changes... [skipped]
β No partially staged files found...
β― Running linters...
β― Running tasks for {apps,libs}/**/*.{ts,json,md,scss}
β Έ npm run affected:lint -- --uncommitted --fix --parallel
npm run format:write -- --uncommitted
git add
the command hangs after this logs
npx lint-staged -d
lint-staged:bin Running `[email protected]` +0ms
lint-staged:find-bin Loaded package.json using `process.cwd()` +0ms
lint-staged Loading config using `cosmiconfig` +0ms
lint-staged Successfully loaded config from `/Developer/Work/SPA/ngx-starter-kit/package.json`:
lint-staged { '{apps,libs}/**/*.{ts,json,md,scss}':
lint-staged [ 'npm run affected:lint -- --uncommitted --fix --parallel',
lint-staged 'npm run format:write -- --uncommitted',
lint-staged 'git add' ] } +3ms
lint-staged:cfg Normalizing config +0ms
lint-staged:cfg Validating config +2ms
Running lint-staged with the following config:
{
linters: {
'{apps,libs}/**/*.{ts,json,md,scss}': [
'npm run affected:lint -- --uncommitted --fix --parallel',
'npm run format:write -- --uncommitted',
'git add'
]
},
concurrent: true,
chunkSize: 9007199254740991,
globOptions: {
matchBase: true,
dot: true
},
ignore: [],
subTaskConcurrency: 1,
renderer: 'verbose'
}
lint-staged:run Running all linter scripts +0ms
lint-staged:run Resolved git directory to be `/Developer/Work/SPA/ngx-starter-kit` +1ms
lint-staged:run Loaded list of staged files in git:
lint-staged:run [ 'package.json',
lint-staged:run 'package-lock.json',
lint-staged:run 'libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts',
lint-staged:run 'libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts',
lint-staged:run 'libs/chat-box/src/lib/services/speech-to-text.service.ts',
lint-staged:run 'PLAYBOOK.md' ] +29ms
lint-staged:gen-tasks Generating linter tasks +0ms
lint-staged:cfg Normalizing config +34ms
lint-staged:gen-tasks Generated task:
lint-staged:gen-tasks { pattern: '{apps,libs}/**/*.{ts,json,md,scss}',
lint-staged:gen-tasks commands:
lint-staged:gen-tasks [ 'npm run affected:lint -- --uncommitted --fix --parallel',
lint-staged:gen-tasks 'npm run format:write -- --uncommitted',
lint-staged:gen-tasks 'git add' ],
lint-staged:gen-tasks fileList:
lint-staged:gen-tasks [ '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts',
lint-staged:gen-tasks '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts',
lint-staged:gen-tasks '/Developer/Work/SPA/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts' ] } +17ms
Stashing changes... [started]
Stashing changes... [skipped]
β No partially staged files found...
Running linters... [started]
Running tasks for {apps,libs}/**/*.{ts,json,md,scss} [started]
lint-staged:make-cmd-tasks Creating listr tasks for commands [ 'npm run affected:lint -- --uncommitted --fix --parallel', 'npm run format:write -- --uncommitted', 'git add' ] +0ms
lint-staged:find-bin Resolving binary for command `npm run affected:lint -- --uncommitted --fix --parallel` +206ms
lint-staged:find-bin Binary for `npm run affected:lint -- --uncommitted --fix --parallel` resolved to `/Developer/Work/SPA/ngx-starter-kit/node_modules/.bin/npm` +3ms
lint-staged:task β OS: darwin; File path chunking unnecessary +0ms
lint-staged:find-bin Resolving binary for command `npm run format:write -- --uncommitted` +0ms
lint-staged:find-bin Resolving binary for `npm` from cache +0ms
lint-staged:task β OS: darwin; File path chunking unnecessary +0ms
lint-staged:find-bin Resolving binary for command `git add` +0ms
lint-staged:find-bin Binary for `git add` resolved to `/usr/local/bin/git` +1ms
lint-staged:task β OS: darwin; File path chunking unnecessary +1ms
npm run affected:lint -- --uncommitted --fix --parallel [started]
lint-staged:task bin: /Developer/Work/SPA/ngx-starter-kit/node_modules/.bin/npm +0ms
lint-staged:task args: [ 'run',
lint-staged:task 'affected:lint',
lint-staged:task '--',
lint-staged:task '--uncommitted',
lint-staged:task '--fix',
lint-staged:task '--parallel',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts' ] +0ms
lint-staged:task opts: { reject: false } +1ms
if i change my command (removed --parallel ) npm run affected:lint -- --uncommitted --fix=true
I am getting following error :
lint-staged:git Error: Error: Command failed: git apply -v --whitespace=nowarn --reject --recount --unidiff-zero
lint-staged:git error: unrecognized input
npx lint-staged -d
lint-staged:bin Running `[email protected]` +0ms
lint-staged:find-bin Loaded package.json using `process.cwd()` +0ms
lint-staged Loading config using `cosmiconfig` +0ms
lint-staged Successfully loaded config from `/Developer/Work/SPA/ngx-starter-kit/package.json`:
lint-staged { '{apps,libs}/**/*.{ts,json,md,scss}':
lint-staged [ 'npm run affected:lint -- --uncommitted --fix --parallel',
lint-staged 'npm run format:write -- --uncommitted',
lint-staged 'git add' ] } +3ms
lint-staged:cfg Normalizing config +0ms
lint-staged:cfg Validating config +2ms
Running lint-staged with the following config:
{
linters: {
'{apps,libs}/**/*.{ts,json,md,scss}': [
'npm run affected:lint -- --uncommitted --fix --parallel',
'npm run format:write -- --uncommitted',
'git add'
]
},
concurrent: true,
chunkSize: 9007199254740991,
globOptions: {
matchBase: true,
dot: true
},
ignore: [],
subTaskConcurrency: 1,
renderer: 'verbose'
}
lint-staged:run Running all linter scripts +0ms
lint-staged:run Resolved git directory to be `/Developer/Work/SPA/ngx-starter-kit` +1ms
lint-staged:run Loaded list of staged files in git:
lint-staged:run [ 'package.json',
lint-staged:run 'package-lock.json',
lint-staged:run 'libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts',
lint-staged:run 'libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts',
lint-staged:run 'libs/chat-box/src/lib/services/speech-to-text.service.ts',
lint-staged:run 'PLAYBOOK.md' ] +29ms
lint-staged:gen-tasks Generating linter tasks +0ms
lint-staged:cfg Normalizing config +34ms
lint-staged:gen-tasks Generated task:
lint-staged:gen-tasks { pattern: '{apps,libs}/**/*.{ts,json,md,scss}',
lint-staged:gen-tasks commands:
lint-staged:gen-tasks [ 'npm run affected:lint -- --uncommitted --fix --parallel',
lint-staged:gen-tasks 'npm run format:write -- --uncommitted',
lint-staged:gen-tasks 'git add' ],
lint-staged:gen-tasks fileList:
lint-staged:gen-tasks [ '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts',
lint-staged:gen-tasks '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts',
lint-staged:gen-tasks '/Developer/Work/SPA/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts' ] } +17ms
Stashing changes... [started]
Stashing changes... [skipped]
β No partially staged files found...
Running linters... [started]
Running tasks for {apps,libs}/**/*.{ts,json,md,scss} [started]
lint-staged:make-cmd-tasks Creating listr tasks for commands [ 'npm run affected:lint -- --uncommitted --fix --parallel', 'npm run format:write -- --uncommitted', 'git add' ] +0ms
lint-staged:find-bin Resolving binary for command `npm run affected:lint -- --uncommitted --fix --parallel` +206ms
lint-staged:find-bin Binary for `npm run affected:lint -- --uncommitted --fix --parallel` resolved to `/Developer/Work/SPA/ngx-starter-kit/node_modules/.bin/npm` +3ms
lint-staged:task β OS: darwin; File path chunking unnecessary +0ms
lint-staged:find-bin Resolving binary for command `npm run format:write -- --uncommitted` +0ms
lint-staged:find-bin Resolving binary for `npm` from cache +0ms
lint-staged:task β OS: darwin; File path chunking unnecessary +0ms
lint-staged:find-bin Resolving binary for command `git add` +0ms
lint-staged:find-bin Binary for `git add` resolved to `/usr/local/bin/git` +1ms
lint-staged:task β OS: darwin; File path chunking unnecessary +1ms
npm run affected:lint -- --uncommitted --fix --parallel [started]
lint-staged:task bin: /Developer/Work/SPA/ngx-starter-kit/node_modules/.bin/npm +0ms
lint-staged:task args: [ 'run',
lint-staged:task 'affected:lint',
lint-staged:task '--',
lint-staged:task '--uncommitted',
lint-staged:task '--fix',
lint-staged:task '--parallel',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts' ] +0ms
lint-staged:task opts: { reject: false } +1ms
^C/Developer/Work/SPA/ngx-starter-kit on develop*
$ npx lint-staged -d
lint-staged:bin Running `[email protected]` +0ms
lint-staged:find-bin Loaded package.json using `process.cwd()` +0ms
lint-staged Loading config using `cosmiconfig` +0ms
lint-staged Successfully loaded config from `/Developer/Work/SPA/ngx-starter-kit/package.json`:
lint-staged { '{apps,libs}/**/*.{ts,json,md,scss}':
lint-staged [ 'npm run affected:lint -- --uncommitted --fix=true',
lint-staged 'npm run format:write -- --uncommitted',
lint-staged 'git add' ] } +4ms
lint-staged:cfg Normalizing config +0ms
lint-staged:cfg Validating config +2ms
Running lint-staged with the following config:
{
linters: {
'{apps,libs}/**/*.{ts,json,md,scss}': [
'npm run affected:lint -- --uncommitted --fix=true',
'npm run format:write -- --uncommitted',
'git add'
]
},
concurrent: true,
chunkSize: 9007199254740991,
globOptions: {
matchBase: true,
dot: true
},
ignore: [],
subTaskConcurrency: 1,
renderer: 'verbose'
}
lint-staged:run Running all linter scripts +0ms
lint-staged:run Resolved git directory to be `/Developer/Work/SPA/ngx-starter-kit` +1ms
lint-staged:run Loaded list of staged files in git:
lint-staged:run [ 'package.json',
lint-staged:run 'package-lock.json',
lint-staged:run 'libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts',
lint-staged:run 'libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts',
lint-staged:run 'libs/chat-box/src/lib/services/speech-to-text.service.ts',
lint-staged:run 'PLAYBOOK.md' ] +29ms
lint-staged:gen-tasks Generating linter tasks +0ms
lint-staged:cfg Normalizing config +34ms
lint-staged:gen-tasks Generated task:
lint-staged:gen-tasks { pattern: '{apps,libs}/**/*.{ts,json,md,scss}',
lint-staged:gen-tasks commands:
lint-staged:gen-tasks [ 'npm run affected:lint -- --uncommitted --fix=true',
lint-staged:gen-tasks 'npm run format:write -- --uncommitted',
lint-staged:gen-tasks 'git add' ],
lint-staged:gen-tasks fileList:
lint-staged:gen-tasks [ '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts',
lint-staged:gen-tasks '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts',
lint-staged:gen-tasks '/Developer/Work/SPA/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts' ] } +15ms
Stashing changes... [started]
lint-staged:git Stashing files... +0ms
lint-staged:git Running git command [ 'write-tree' ] +1ms
lint-staged:git Running git command [ 'add', '.' ] +18ms
lint-staged:git Running git command [ 'write-tree' ] +34ms
lint-staged:git Running git command [ 'read-tree', '9eb8e9c7758c053858533048f8f025038645a6db' ] +16ms
lint-staged:git Running git command [ 'checkout-index', '-af' ] +68ms
lint-staged:git Done stashing files! +803ms
Stashing changes... [completed]
Running linters... [started]
Running tasks for {apps,libs}/**/*.{ts,json,md,scss} [started]
lint-staged:make-cmd-tasks Creating listr tasks for commands [ 'npm run affected:lint -- --uncommitted --fix=true', 'npm run format:write -- --uncommitted', 'git add' ] +0ms
lint-staged:find-bin Resolving binary for command `npm run affected:lint -- --uncommitted --fix=true` +1s
lint-staged:find-bin Binary for `npm run affected:lint -- --uncommitted --fix=true` resolved to `/Developer/Work/SPA/ngx-starter-kit/node_modules/.bin/npm` +3ms
lint-staged:task β OS: darwin; File path chunking unnecessary +0ms
lint-staged:find-bin Resolving binary for command `npm run format:write -- --uncommitted` +0ms
lint-staged:find-bin Resolving binary for `npm` from cache +0ms
lint-staged:task β OS: darwin; File path chunking unnecessary +0ms
lint-staged:find-bin Resolving binary for command `git add` +0ms
lint-staged:find-bin Binary for `git add` resolved to `/usr/local/bin/git` +1ms
lint-staged:task β OS: darwin; File path chunking unnecessary +1ms
npm run affected:lint -- --uncommitted --fix=true [started]
lint-staged:task bin: /Developer/Work/SPA/ngx-starter-kit/node_modules/.bin/npm +1ms
lint-staged:task args: [ 'run',
lint-staged:task 'affected:lint',
lint-staged:task '--',
lint-staged:task '--uncommitted',
lint-staged:task '--fix=true',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts' ] +0ms
lint-staged:task opts: { reject: false } +0ms
npm run affected:lint -- --uncommitted --fix=true [completed]
npm run format:write -- --uncommitted [started]
lint-staged:task bin: /Developer/Work/SPA/ngx-starter-kit/node_modules/.bin/npm +4m
lint-staged:task args: [ 'run',
lint-staged:task 'format:write',
lint-staged:task '--',
lint-staged:task '--uncommitted',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts' ] +0ms
lint-staged:task opts: { reject: false } +0ms
npm run format:write -- --uncommitted [completed]
git add [started]
lint-staged:task bin: /usr/local/bin/git +2s
lint-staged:task args: [ 'add',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts',
lint-staged:task '/Developer/Work/SPA/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts' ] +0ms
lint-staged:task opts: { reject: false } +1ms
git add [completed]
Running tasks for {apps,libs}/**/*.{ts,json,md,scss} [completed]
Running linters... [completed]
Updating stash... [started]
lint-staged:git Running git command [ 'write-tree' ] +4m
Updating stash... [completed]
Restoring local changes... [started]
lint-staged:git Restoring working copy +38ms
lint-staged:git Running git command [ 'read-tree', '7dfe02add6ad13285c9b703a6717e3c5d321b45f' ] +0ms
lint-staged:git Running git command [ 'checkout-index', '-af' ] +40ms
lint-staged:git Restoring index with formatting changes +625ms
lint-staged:git Running git command [ 'read-tree', '9eb8e9c7758c053858533048f8f025038645a6db' ] +0ms
lint-staged:git Generating diff between trees 9eb8e9c7758c053858533048f8f025038645a6db and 9eb8e9c7758c053858533048f8f025038645a6db... +42ms
lint-staged:git Running git command [ 'diff-tree',
'--ignore-submodules',
'--binary',
'--no-color',
'--no-ext-diff',
'--unified=0',
'9eb8e9c7758c053858533048f8f025038645a6db',
'9eb8e9c7758c053858533048f8f025038645a6db' ] +0ms
lint-staged:git Running git command [ 'apply',
'-v',
'--whitespace=nowarn',
'--reject',
'--recount',
'--unidiff-zero' ] +15ms
lint-staged:git Could not apply patch to the stashed files cleanly +13ms
lint-staged:git Error: Error: Command failed: git apply -v --whitespace=nowarn --reject --recount --unidiff-zero
lint-staged:git error: unrecognized input
lint-staged:git
lint-staged:git
lint-staged:git at execGit (/Developer/Work/SPA/ngx-starter-kit/node_modules/lint-staged/src/gitWorkflow.js:27:11)
lint-staged:git at process._tickCallback (internal/process/next_tick.js:68:7) +1ms
lint-staged:git Patch content: +0ms
lint-staged:git
lint-staged:git +0ms
lint-staged:git Found conflicts between formatters and local changes. Formatters changes will be ignored for conflicted hunks. +0ms
lint-staged:git Deleted files and folders:
lint-staged:git +4ms
Restoring local changes... [completed]
lint-staged linters were executed successfully! +4m
Iβm not sure what Is your command is doing. Mind including this as well?
npm run affected:lint -- --uncommitted command will lint only new uncommitted files. --fix option will fix tslint issues. --parallel option enable to run job in parallel
nx docs:
https://blog.nrwl.io/nrwl-nx-6-1-better-dev-ergonomics-faster-builds-3198bb310e39
https://nrwl.io/nx/guide-nx-workspace
my code base: https://github.com/xmlking/ngx-starter-kit
lint-staged:git error: unrecognized input does' t look good to me but the task should have been completed since it looks like it is a no-op: lint-staged:git Generating diff between trees 9eb8e9c7758c053858533048f8f025038645a6db and 9eb8e9c7758c053858533048f8f025038645a6db... +42ms@okonet first thanks for maintaining this great tool.
this command npm run affected:lint -- --uncommitted --fix --parallel itself works without hung issues. but when I invoke npx lint-staged with following setting, it hangs and control never returns even after 30 min.
"lint-staged": {
"{apps,libs}/**/*.{ts,json,md,scss}": [
"npm run affected:lint -- --uncommitted --fix --parallel",
"npm run format:write -- --uncommitted",
"git add"
]
}
no hang issues if I use following settings
```json
"lint-staged": {
"{apps,libs}/**/*.{ts,json,md,scss}": [
"npm run affected:lint -- --uncommitted",
"npm run format:write -- --uncommitted",
"git add"
]
}
I guess nx's affected:lint -parallel option might be interfering with how lint-staged works. I will open issue with https://github.com/nrwl/nx to see, if there is any problem from nx side.
this is not critical, if you like me to close, I can close this issue.
Lyes keep it open until we know the root cause. But from logs it doesnβt look like it is on our side. Lint-staged uses execa to execute commands. Try looking at its repo as well.
Hi guys,
I can confirm I have the same issue with almost the same setup, mine just includes stylelint as an additional linter. What do you need me to provide you?
Running into the same issue. Strange because I have my company monorepo with the same configuration and it's not a problem at all. This is a new package and it just hangs and hangs at the end of the run. Showing complete when I run with -d.
This happened for me as well many times while I was setting up new monorepo. Not sure how it works, but commit with new package usually fails, then if make commit with --no-verify next one could be fine. I guess in my case this could be related to the fact that monorepo setup is unstable.
running into the same issue here as well.. has anyone found a stable solution to address this issue here?!
This might be because the ng command treats the staged filepaths added by lint-staged as flags rather than input files.
For what it's worth, when trying to run the command found in the debug log it also fails:
View logs
~/git/ngx-starter-kit develop*
β― npm run affected:lint -- --uncommitted --fix --parallel /git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts /git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts /git/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts
> [email protected] affected:lint /git/ngx-starter-kit
> nx affected:lint "--uncommitted" "--fix" "--parallel" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts" "/git/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts"
> NX Running target lint for projects:
- chat-box
- dashboard
- webapp
With flags: /git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts /git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts /git/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts --fix=true
βββββββββββββββββββββββββββββββββββββββββββββββ
> [email protected] ng /git/ngx-starter-kit
> ng "lint" "chat-box" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts" "/git/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts" "--fix=true"
> [email protected] ng /git/ngx-starter-kit
> ng "lint" "dashboard" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts" "/git/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts" "--fix=true"
> [email protected] ng /git/ngx-starter-kit
> ng "lint" "webapp" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts" "/git/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts" "--fix=true"
Unknown option: '/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts'
Unknown option: '/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts'
Unknown option: '/git/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] ng: `ng "lint" "chat-box" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts" "/git/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts" "--fix=true"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] ng script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /.npm/_logs/2019-09-17T15_35_42_080Z-debug.log
Unknown option: '/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts'
Unknown option: '/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts'
Unknown option: '/git/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] ng: `ng "lint" "webapp" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts" "/git/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts" "--fix=true"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] ng script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /.npm/_logs/2019-09-17T15_35_42_140Z-debug.log
Unknown option: '/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts'
Unknown option: '/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts'
Unknown option: '/git/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] ng: `ng "lint" "dashboard" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts" "/git/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts" "--fix=true"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] ng script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /.npm/_logs/2019-09-17T15_35_42_358Z-debug.log
βββββββββββββββββββββββββββββββββββββββββββββββ
> NX ERROR Running target "lint" for affected projects failed
Failed projects:
- chat-box
- dashboard
- webapp
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] affected:lint: `nx affected:lint "--uncommitted" "--fix" "--parallel" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts" "/git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/ng-let/ng-let.directive.spec.ts" "/git/ngx-starter-kit/libs/chat-box/src/lib/services/speech-to-text.service.ts"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] affected:lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /.npm/_logs/2019-09-17T15_35_42_384Z-debug.log
I'd wager to get it working you should write the lint-staged config in JS and omit the filenames:
// lint-staged.config.js
module.exports = {
'{apps,libs}/**/*.{ts,json,md,scss}': files => {
const fileArg = files.join(' ')
return [
"npm run affected:lint -- --uncommitted --fix --parallel", // <-- no files
"npm run format:write -- --uncommitted", // <-- no files
`git add ${fileArg}`
]
}
}
This is of course assuming the --uncommitted flag means that the command itself finds the files it will lint and format.
Dear @iiroj ,
thanks for your response. However, as i understood, the --uncommitted flag automatically finds the files that have been changed but not committed yet. It then calls the command for each of those files.
If i run the command as is (i.e., directly copy npm run affected:lint -- --uncommited --fix --parallel and paste it in the terminal) it works fine and does not throw any error! However, if i run this command "automatically" via git (does not matter which client i use, i.e,. GitHub Desktop, normal Git Terminal, ...) it fails with described error..
Yes, npm run affected:lint -- --uncommited --fix --parallel works, but if you append it with the absolute filepaths of staged files (as lint-staged does), it will fail because ng treats them as flags.
So after staging changes in ./libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts, this fails:
npm run affected:lint -- --uncommitted --fix --parallel /git/ngx-starter-kit/libs/ngx-utils/src/lib/directives/router-link-match/router-link-match.directive.spec.ts
Can you try running it with the example configuration I provided?
Dear @iiroj , thanks for coming back with another idea. I tried your approach (i.e., moving the config to a dedicated file and not having it in the package.json).
This separate config file is used - i can see this, because i changed the glob-file-pattern (i.e., i removed the html type). However, it still shows the respective error.
However, when digging into the nx affected:lint command, i found a --files param, that takes a list of all files to be used - this can be used as a replacement for the --uncommited.
In this context, i changed your config file from above to this one here:
module.exports = {
'{apps,libs}/**/*.{ts,json,md,scss,html}': files => {
return [
`npm run affected:lint -- --fix --parallel --files=${files.join(',')}`,
'npm run format:write -- --uncommitted',
`git add ${files.join(' ')}`,
];
},
};
Note that for the affected:lint you need to separate the files by , and for the git command by ' '. For now, this command runs as expected.. I tried a commit that previously failed and it now properly commits. I will keep an eye :eyes: on this :laughing:
Thanks a lot for pointing me into the (hopefully) right direction! You're awesome!
@johannesschobel You are welcome! A lot of issues with Angular seem to be solvable by using the new javascript syntax for configuration.
Apparently this solution no longer works with Nx 9.1.
It seems that affected:lint now expectes to receive relative paths and not absolute ones.
Here's the output that I get (with some debug statements added in):
husky > pre-commit (node v12.4.0)
Executing lint-staged based on lint-staged.config.js
Lint command that will be executed: npm run affected:lint -- --fix --parallel --files=[filename]
Format command that will be executed: npm run format:all
Lint command that will be executed: npm run affected:lint -- --fix --parallel --files=/home/sebastien/wks/didowi/apps/cli/tslint.json,/home/sebastien/wks/didowi/apps/gate/tslint.json,/home/sebastien/wks/didowi/apps/web/tslint.json,/home/sebastien/wks/didowi/libs/gate-api/tslint.json,/home/sebastien/wks/didowi/libs/shared/tslint.json,/home/sebastien/wks/didowi/libs/testing/tslint.json
Format command that will be executed: npm run format:all
Lint command that will be executed: npm run affected:lint -- --fix --parallel --files=[file],[file],[file],[file],[file],[file]
Format command that will be executed: npm run format:all
β Preparing...
β― Running tasks...
β― Running tasks for {apps,libs}/**/*.{ts,json,md,scss,html}
β npm run affected:lint -- --fix --parallel --files=[file]
npm run format:all
β Applying modifications... [skipped]
β Skipped because of errors from tasks.
β Reverting to original state...
β Cleaning up...
β npm found some errors. Please fix them and try committing again.
> [email protected] affected:lint /home/sebastien/wks/didowi
> nx affected:lint "--fix" "--parallel" "--files=/home/sebastien/wks/didowi/apps/cli/tslint.json,/home/sebastien/wks/didowi/apps/gate/tslint.json,/home/sebastien/wks/didowi/apps/web/tslint.json,/home/sebastien/wks/didowi/libs/gate-api/tslint.json,/home/sebastien/wks/didowi/libs/shared/tslint.json,/home/sebastien/wks/didowi/libs/testing/tslint.json"
/home/sebastien/wks/didowi/node_modules/@nrwl/workspace/node_modules/yargs/yargs.js:1109
else throw err
^
RangeError: path should be a `path.relative()`d string, but got "/home/sebastien/wks/didowi/apps/cli/tslint.json"
at throwError (/home/sebastien/wks/didowi/node_modules/@nrwl/workspace/node_modules/ignore/index.js:354:9)
at checkPath (/home/sebastien/wks/didowi/node_modules/@nrwl/workspace/node_modules/ignore/index.js:375:12)
at Ignore._test (/home/sebastien/wks/didowi/node_modules/@nrwl/workspace/node_modules/ignore/index.js:483:5)
at Ignore.ignores (/home/sebastien/wks/didowi/node_modules/@nrwl/workspace/node_modules/ignore/index.js:518:17)
at /home/sebastien/wks/didowi/node_modules/@nrwl/workspace/src/core/file-utils.js:25:43
at Array.filter (<anonymous>)
at Object.calculateFileChanges (/home/sebastien/wks/didowi/node_modules/@nrwl/workspace/src/core/file-utils.js:25:23)
at Object.affected (/home/sebastien/wks/didowi/node_modules/@nrwl/workspace/src/command-line/affected.js:19:78)
at Object.handler (/home/sebastien/wks/didowi/node_modules/@nrwl/workspace/src/command-line/nx-commands.js:46:138)
at Object.runCommand (/home/sebastien/wks/didowi/node_modules/@nrwl/workspace/node_modules/yargs/lib/command.js:235:44)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] affected:lint: `nx affected:lint "--fix" "--parallel" "--files=/home/sebastien/wks/didowi/apps/cli/tslint.json,/home/sebastien/wks/didowi/apps/gate/tslint.json,/home/sebastien/wks/didowi/apps/web/tslint.json,/home/sebastien/wks/didowi/libs/gate-api/tslint.json,/home/sebastien/wks/didowi/libs/shared/tslint.json,/home/sebastien/wks/didowi/libs/testing/tslint.json"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] affected:lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/sebastien/.npm/_logs/2020-03-10T21_16_49_048Z-debug.log
husky > pre-commit hook failed (add --no-verify to bypass)
I could fix it with the following changes:
// lint-staged configuration: https://github.com/okonet/lint-staged
// Workaround for issue with NX: https://github.com/okonet/lint-staged/issues/522
const path = require("path");
const cwd = process.cwd();
console.log("Executing lint-staged based on lint-staged.config.js");
module.exports = {
"{apps,libs}/**/*.{ts,json,md,scss,html}": absolutePaths => {
const relativePaths = absolutePaths.map(file => path.relative(cwd, file))
const filesList = relativePaths.join(",");
const lintCommand = `npm run affected:lint -- --fix --parallel --files=${filesList}`;
console.debug("Lint command that will be executed: ", lintCommand);
const formatCommand = "npm run format:all";
console.debug("Format command that will be executed: ", formatCommand);
return [lintCommand, formatCommand];
},
};
Dear @dsebastien ,
i did something similar. My code, however, looks like this:
const path = require('path');
module.exports = {
'{apps,libs}/**/*.{ts,json,md,scss,html}': files => {
const cwd = process.cwd();
const relPaths = files.map(file => {
return path.relative(cwd, file);
});
return [
`npm run affected:lint -- --fix --parallel --files=${relPaths.join(',')}`,
'npm run format:write -- --uncommitted',
`git add ${files.join(' ')}`,
];
},
};
Note, that my lint-staged script also adds them back to the git. However, the git add command still needs the absolute paths, so i need both.. kind of stupid, but whatever :D
Hi all,
I'm not fully understanding why you nees to run the affected:lint script inside lintstaged. Lintstaged will provide the paths to the files that changed, so we only need to lint these files, not the whole projects affected by these paths, right? By the way, I don't find any use case for affected:lint script. Could someone clarify this?
Hi all,
I'm not fully understanding why you nees to run the affected:lint script inside lintstaged. Lintstaged will provide the paths to the files that changed, so we only need to lint these files, not the whole projects affected by these paths, right? By the way, I don't find any use case for affected:lint script. Could someone clarify this?
Enlightening! You saved my life!
"scripts": {
+ "eslint:fix": "eslint --fix",
},
"lint-staged": {
"**/*.{ts,tsx,js,jsx,json,md,scss,html}": [
- "npm run affected:lint -- --uncommitted --parallel -- --fix",
+ "npm run eslint:fix",
"npm run format:write -- --uncommitted"
]
Lint like flight~~~
Most helpful comment
Dear @iiroj , thanks for coming back with another idea. I tried your approach (i.e., moving the config to a dedicated file and not having it in the package.json).
This separate config file is used - i can see this, because i changed the glob-file-pattern (i.e., i removed the
htmltype). However, it still shows the respective error.However, when digging into the
nx affected:lintcommand, i found a--filesparam, that takes a list of all files to be used - this can be used as a replacement for the--uncommited.In this context, i changed your config file from above to this one here:
Note that for the
affected:lintyou need to separate the files by,and for thegitcommand by' '. For now, this command runs as expected.. I tried a commit that previously failed and it now properly commits. I will keep an eye :eyes: on this :laughing:Thanks a lot for pointing me into the (hopefully) right direction! You're awesome!