HTMLHint icon indicating copy to clipboard operation
HTMLHint copied to clipboard

Configuration not found when using the CLI

Open sinedied opened this issue 8 years ago • 14 comments

I have a strange behavior with the CLI and configuration file. I have a .htmlhintrc file at the root of my project.

When I run htmlhint src, it finds the config file and correctly lint my html files, but when I run htmlhint src/**/*.html I have an error saying that the configuration is not found?

sinedied avatar Jan 18 '17 13:01 sinedied

I have a similarly related issue.

I don't receive an error that the configuration wasn't found, but if I run htmlhint src/*.html src/**/*.html it doesn't use my .htmlhintrc file - it's using "something else", maybe the built-in defaults. If I run htmlhint src/*.html src/**/*.html --config .htmlhintrc it works as expected.

This was literally working last week. HTMLHint hasn't been updated, still using htmlhint 0.9.13, but I did do a fresh install of my project this week so dependencies have been updated. I'm not sure how to troubleshoot the issue, so I'm continuing to specify --config.

Environment:

  • Windows 8.1
  • nvm-windows 1.1.1
  • Node.js 6.9.4
  • npm 3.10.10
  • htmlhint 0.9.13

mitorez avatar Jan 31 '17 17:01 mitorez

@mitorez You could do htmlhint ./src/**/*.html adding the ./ fixes the issue for me. Should we just add some code that prepends it to base in the getConfig function?

ianwalter avatar Feb 01 '17 04:02 ianwalter

@ianwalter Unfortunately pre-pending ./ didn't work for me. I ran htmlhint ./src/*.html ./src/**/*.html just now and it still failed to load the ~~.htmlhint~~ .htmlhintrc at the root of the project.

mitorez avatar Feb 01 '17 14:02 mitorez

@mitorez Do you mean .htmlhintrc? Or did you name it incorrectly?

ianwalter avatar Feb 01 '17 14:02 ianwalter

@ianwalter You had me second-guessing myself there for a second :wink: That was a typo on my part. My configuration file is named correctly (.htmlhintrc) at the project root.

mitorez avatar Feb 01 '17 15:02 mitorez

On windows platforms, .htmlhintrc is not found whatever I try.

htmlhint src or htmlhint ./src fails, but htmlhint src --config .htmlhintrc works.

sinedied avatar May 04 '17 08:05 sinedied

This has been working for me on Windows: htmlhint src/**/*.html --config .htmlhintrc

mitorez avatar May 05 '17 03:05 mitorez

@mitorez yes using the --config option works, but it misses the point. You shouldn't have to add this option in the first place, that's the issue.

sinedied avatar May 05 '17 06:05 sinedied

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 14 '20 03:05 stale[bot]

Not sure using a stale bot will help resolution ongoing bugs :/

sinedied avatar May 15 '20 07:05 sinedied

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 14 '20 08:07 stale[bot]

This bot is annoying 😒

Shinigami92 avatar Jul 14 '20 08:07 Shinigami92

What's the status on this? I seem to be facing the same issue. It doesn't seem to work even with the config option. Is there some issue with the config file?

{
"alt-require" : true,
"attr-lowercase" : true,
"attr-sorted" : true,
"attr-no-duplication" : true,
"attr-unsafe-chars" : true,
"attr-value-double-quotes" : true,
"attr-value-not-empty" : true,
"attr-value-single-quotes" : false,
"attr-whitespace" : true,
"doctype-first" : true,
"doctype-html5" : true,
"head-script-disabled" : false,
"href-abs-or-rel" : false,
"html-lang-require" : true,
"id-class-ad-disabled" : true,
"id-class-value" : underline,
"id-unique" : true,
"inline-script-disabled" : true,
"inline-style-disabled" : true,
"input-requires-label" : true,
"script-disabled" : false,
"space-tab-mixed-disabled" : space,
"spec-char-escape" : true,
"src-not-empty" : true,
"style-disabled" : true,
"tag-pair" : true,
"tag-self-close" : true,
"empty-tag-not-self-closed" : false,
"tagname-lowercase" : true,
"tagname-specialchars" : true,
"title-require" : true,
"tags-check" : true,
"attr-no-unnecessary-whitespace" : true
}

The file resides in the repository https://github.com/linusjf/LearnHTML5

linusjf avatar Jan 31 '24 00:01 linusjf

The htmlhint version is 1.1.4.

linusjf avatar Feb 04 '24 02:02 linusjf