htmlhint / HTMLHint

โš™๏ธ The static code analysis tool you need for your HTML
https://htmlhint.com
MIT License
3.09k stars 382 forks source link

Use cosmiconfig for configuration loading #126

Open thasmo opened 8 years ago

thasmo commented 8 years ago

Would be awesome if HTMLHint used cosmiconfig for loading the configuration.

yaniswang commented 8 years ago

Can you show the feature of cosmiconfig?

thasmo commented 8 years ago

Their docs are very easy to grasp, but basically it does this:

Find and load a configuration object from
- a package.json property (anywhere down the file tree)
- a JSON or YAML "rc file" (anywhere down the file tree)
- a .config.js CommonJS module (anywhere down the file tree)
- a CLI --config argument

It supports rc files with optional file-type extension, e.g. .sasslintrc.yml or .sasslintrc.json and, as mentioned, it can also read configuration from the package.json file - an option which gains more and more interest lately.

And:

Additionally, all of these search locations are configurable: you can customize filenames or turn off any location.

yaniswang commented 8 years ago

I don't see it is very necessary to use cosmiconfig.

thasmo commented 8 years ago

It's more a suggestion to greatly improve dev/user experience imo, no necessity in the first place.

gforcada commented 7 years ago

๐Ÿ‘ on that, rather than spreading my configurations on 1000 files I prefer to have everything in a single place: package.json, this way I have JS dependencies, eslint and styleling rules, The only thing missing right now is htmlhint ๐Ÿ˜ž

thasmo commented 7 years ago

Indeed. cosmiconfig supports using your preferred method.

Kristinita commented 5 years ago

+1.

1. Summary

It would be nice, if HTMLHint will support YAML configuration files. htmllintrc.yaml for example.

2. Argumentation

JSON โ€” is not a good idea for user-editing files. Main reason โ€” user can't write comments, why he uses those or other options. Another arguments:

Also, look at related issue.

Thanks.

ryansully commented 5 years ago

To add my two cents, I prefer .js config files supported by cosmiconfig so that I can break configuration into separate CommonJS module files as needed, as well as document them with comments. I've seen far too many config files with settings that have no explanation as to their purpose or reason for why a particular value was chosen for that setting.

stale[bot] commented 4 years ago

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.

Kristinita commented 4 years ago

The problem still exists.

Thanks.

Shinigami92 commented 4 years ago

I will work on this after https://github.com/htmlhint/HTMLHint/issues/279

ghost commented 2 years ago

ๆˆ‘ๅšๆŒๆˆ‘็š„็œ‹ๆณ•ใ€‚ ๅœจๆˆ‘็œ‹ๆฅ๏ผŒ่ฎฉ HTMLHint ๅŽŸ็”Ÿๆ”ฏๆŒ .js ๅŽ็ผ€็š„้…็ฝฎๆ–‡ไปถๆ˜ฏ็†ๆ‰€ๅฝ“็„ถ็š„ไบ‹ๆƒ…ใ€‚

gian1200 commented 1 year ago

If this is implemented, then autocomplete could be used (like in ESLint) in configfile with .js, .ts, .mjs or .cjs extensions.

.eslintrc.cjs image