Ant-design-pro: git commit 不了

Created on 4 May 2018  ·  6Comments  ·  Source: ant-design/ant-design-pro

执行yarn lint

yarn run v1.3.2
$ eslint --ext .js src mock tests && npm run lint:style

E:\developer\work_test\ant-design-pro\src\routes\Dashboard\Analysis.js
  255:34  warning  Dangerous property 'dangerouslySetInnerHTML' found  react/no-danger
  456:21  warning  Dangerous property 'dangerouslySetInnerHTML' found  react/no-danger
  462:43  warning  Dangerous property 'dangerouslySetInnerHTML' found  react/no-danger

✖ 3 problems (0 errors, 3 warnings)


> [email protected] lint:style E:\developer\work_test\ant-design-pro
> stylelint "src/**/*.less" --syntax less

Done in 37.20s.

执行yarn prettier也没报错

yarn run v1.3.2
$ prettier --write ./src/**/**/**/*
src\common\menu.js 172ms
src\common\router.js 493ms
...
src\utils\utils.js 125ms
src\utils\utils.less 31ms
Done in 20.02s.

执行git commit就是不行

husky > npm run -s precommit (node v9.5.0)

25lRunning tasks for **/*.{js,jsx,less} [started]
Running tasks for **/*.{js,jsx} [started]
Running tasks for **/*.less [started]
Running tasks for **/*.less [skipped]
→ No staged files match **/*.less
prettier --wirter [started]
lint-staged:js [started]
prettier --wirter [failed]
→ × prettier --wirter found some errors. Please fix them and try committing again.
Running tasks for **/*.{js,jsx,less} [failed]
→ × prettier --wirter found some errors. Please fix them and try committing again.
lint-staged:js [failed]
→ × lint-staged:js found some errors. Please fix them and try committing again.
Running tasks for **/*.{js,jsx} [failed]
→ × lint-staged:js found some errors. Please fix them and try committing again.
25h× prettier --wirter found some errors. Please fix them and try committing again.
× lint-staged:js found some errors. Please fix them and try committing again.
25h
husky > pre-commit hook failed (add --no-verify to bypass)

又看不出来到底哪里有问题

Most helpful comment

增加一项

**/*.ejs

image

All 6 comments

Translation of this issue:


git commit not

Execute yarn lint

Yarn run v1.3.2
$ eslint --ext .js src mock tests && npm run lint:style

E:\developer\work_test\ant-design-pro\src\routes\Dashboard\Analysis.js
  255:34 warning Dangerous property 'dangerouslySetInnerHTML' found react/no-danger
  456:21 warning Dangerous property 'dangerouslySetInnerHTML' found react/no-danger
  462:43 warning Dangerous property 'dangerouslySetInnerHTML' found react/no-danger

✖ 3 problems (0 errors, 3 warnings)


> [email protected] lint:style E:\developer\work_test\ant-design-pro
> stylelint "src/**/*.less" --syntax less

Done in 37.20s.

No problem with executing yarn prettier

Yarn run v1.3.2
$ prettier --write ./src/**/**/**/*
Src\common\menu.js 172ms
Src\common\router.js 493ms
...
Src\utils\utils.js 125ms
Src\utils\utils.less 31ms
Done in 20.02s.

Execute git commit is not

Husky > npm run -s precommit (node ​​v9.5.0)

25lRunning tasks for **/*.{js,jsx,less} [started]
Running tasks for **/*.{js,jsx} [started]
Running tasks for **/*.less [started]
Running tasks for **/*.less [skipped]
→ No staged files match **/*.less
Prettier --wirter [started]
Lint-staged:js [started]
Prettier --wirter [failed]
→ × prettier --wirter found some errors. Please fix them and try committing again.
Running tasks for **/*.{js,jsx,less} [failed]
→ × prettier --wirter found some errors. Please fix them and try committing again.
Lint-staged:js [failed]
→ × lint-staged:js found some errors. Please fix them and try committing again.
Running tasks for **/*.{js,jsx} [failed]
→ × lint-staged:js found some errors. Please fix them and try committing again.
25h× prettier --wirter found some errors. Please fix them and try committing again.
× lint-staged:js found some errors. Please fix them and try committing again.
25h
Husky > pre-commit hook failed (add --no-verify to bypass)

Can't see where there is a problem

yarn lint-staged:js

1429 look here.

回显这个,这是要指定文件吧?

yarn run v1.3.2
$ eslint --ext .js
eslint [options] file.js [file.js] [dir]

Basic configuration:
  --no-eslintrc                  Disable use of configuration from .eslintrc.*
  -c, --config path::String      Use this configuration, overriding .eslintrc.* config options if
                                 present
  --env [String]                 Specify environments
  --ext [String]                 Specify JavaScript file extensions - default: .js
  --global [String]              Define global variables
  --parser String                Specify the parser to be used
  --parser-options Object        Specify parser options

Specifying rules and plugins:
  --rulesdir [path::String]      Use additional rules from this directory
  --plugin [String]              Specify plugins
  --rule Object                  Specify rules

Fixing problems:
  --fix                          Automatically fix problems
  --fix-dry-run                  Automatically fix problems without saving the changes to the file
                                 system

Ignoring files:
  --ignore-path path::String     Specify path of ignore file
  --no-ignore                    Disable use of ignore files and patterns
  --ignore-pattern [String]      Pattern of files to ignore (in addition to those in .eslintignore)

Using stdin:
  --stdin                        Lint code provided on <STDIN> - default: false
  --stdin-filename String        Specify filename to process STDIN as

Handling warnings:
  --quiet                        Report errors only - default: false
  --max-warnings Int             Number of warnings to trigger nonzero exit code - default: -1

Output:
  -o, --output-file path::String  Specify file to write report to
  -f, --format String            Use a specific output format - default: stylish
  --color, --no-color            Force enabling/disabling of color

Inline configuration comments:
  --no-inline-config             Prevent comments from changing config or rules
  --report-unused-disable-directives  Adds reported errors for unused eslint-disable directives

Caching:
  --cache                        Only check changed files - default: false
  --cache-file path::String      Path to the cache file. Deprecated: use --cache-location - default:
                                 .eslintcache
  --cache-location path::String  Path to the cache file or directory

Miscellaneous:
  --init                         Run config initialization wizard - default: false
  --debug                        Output debugging information
  -h, --help                     Show help
  -v, --version                  Output the version number
  --print-config path::String    Print the configuration for the given file
Done in 1.91s.

执行 yarn lint-staged:js */.{js,jsx}

yarn run v1.3.2
$ eslint --ext .js **/*.{js,jsx}

E:\developer\work_test\ant-design-pro\src\routes\Dashboard\Analysis.js
  255:34  warning  Dangerous property 'dangerouslySetInnerHTML' found  react/no-danger
  456:21  warning  Dangerous property 'dangerouslySetInnerHTML' found  react/no-danger
  462:43  warning  Dangerous property 'dangerouslySetInnerHTML' found  react/no-danger

✖ 3 problems (0 errors, 3 warnings)

Done in 23.13s.

增加一项

**/*.ejs

image

@mingjunyang It's worked for me, thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

2uncle-code picture 2uncle-code  ·  3Comments

suifan picture suifan  ·  3Comments

renyi818 picture renyi818  ·  3Comments

lvzheng0404 picture lvzheng0404  ·  3Comments

ghost picture ghost  ·  3Comments