microsoft / microsoft/AdaptiveCards

[nodejs] can't commit changes because of nodejs.husky\pre-commit hook

Open
#6,895 0 comments 0 reactions 1 assignee View on GitHub

@licanhua is already working on this.

Since Jan 20, 2022.

High Priority
Dominant language
C#
Stars
2k
Forks
595
Avg merge
1d 19h
Merged PRs (30d)
1

Description

we didn't eslint format all files very well and it caused that the user is not able to commit change locally.

Example of error caused by the adaptivecards\source\nodejs.husky\pre-commit hook:

(node:39416) ExperimentalWarning: The ESM module loader is experimental.
internal/process/esm_loader.js:90
internalBinding('errors').triggerUncaughtException(
^



Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. Received protocol 'node:'
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:730:11)
at Loader.resolve (internal/modules/esm/loader.js:100:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:246:28)
at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:47:40)
at link (internal/modules/esm/module_job.js:46:36) {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

There more than 400 errors when I format all files:

c:\repo\adaptivecards\source\nodejs>npx eslint --fix --max-warnings=0 *\src\*.ts

c:\repo\adaptivecards\source\nodejs\ac-typed-schema\src\Schema.ts
   7:12  error  A `require()` style import is forbidden                            @typescript-eslint/no-require-imports
   7:12  error  Require statement not part of import statement                     @typescript-eslint/no-var-requires
   8:14  error  A `require()` style import is forbidden                            @typescript-eslint/no-require-imports
   8:14  error  Require statement not part of import statement                     @typescript-eslint/no-var-requires
  49:34  error  Parameter name `value` must have one of the following prefixes: _  @typescript-eslint/naming-convention
...
c:\repo\adaptivecards\source\nodejs\spec-generator\src\spec-generator.ts
    5:12  error  A `require()` style import is forbidden                                 @typescript-eslint/no-require-imports
    5:12  error  Require statement not part of import statement                          @typescript-eslint/no-var-requires
   11:5   error  Unexpected console statement                                            no-console
   24:5   error  Unexpected console statement                                            no-console
   25:5   error  Unexpected console statement                                            no-console
   31:9   error  Unexpected console statement                                            no-console
   32:9   error  Unexpected console statement                                            no-console
   33:9   error  Unexpected console statement                                            no-console
   34:9   error  Unexpected console statement                                            no-console
   39:32  error  Promise returned in function argument where a void return was expected  @typescript-eslint/no-misused-promises
   40:38  error  Promise returned in function argument where a void return was expected  @typescript-eslint/no-misused-promises
   40:57  error  Async arrow function has no 'await' expression                          @typescript-eslint/require-await
   57:5   error  Unexpected console statement                                            no-console
   58:5   error  Unexpected console statement                                            no-console
   62:23  error  Unexpected `await` of a non-Promise (non-"Thenable") value              @typescript-eslint/await-thenable
   64:9   error  Unexpected console statement                                            no-console
   65:9   error  Unexpected console statement                                            no-console
   66:9   error  Unexpected console statement                                            no-console
   67:9   error  Unexpected console statement                                            no-console
   70:32  error  Promise returned in function argument where a void return was expected  @typescript-eslint/no-misused-promises
   71:38  error  Promise returned in function argument where a void return was expected  @typescript-eslint/no-misused-promises
  105:30  error  Expected '!==' and instead saw '!='                                     eqeqeq

✖ 433 problems (432 errors, 1 warning)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.