This plugin has various rules for non-js/ts files.
But there is no preset for them, so we must explicitly list those rules for the appropriate file types, possibly duplicating them multiple times:
{
files: ['**/*.json'],
plugins: { json, unicorn },
language: 'json/json',
extends: [json.configs.recommended],
rules: {
'unicorn/comment-content': 'error',
'unicorn/filename-case': 'error',
'unicorn/no-abusive-eslint-disable': 'error',
'unicorn/prefer-https': 'error',
'unicorn/expiring-todo-comments': 'error',
'unicorn/no-empty-file': 'error',
'unicorn/no-manually-wrapped-comments': 'error',
},
},
// depending on how the config is structured, possible also repeat for jsonc, css, md, html...
It would be simpler and less error prone (and DRY) if we could do this instead:
{
files: ['**/*.json'],
plugins: { json, unicorn },
language: 'json/json',
extends: [
json.configs.recommended,
unicorn.configs.recommendedJson,
],
},
Please consider exposing more presets:
unicorn.configs.recommendedJson
unicorn.configs.recommendedCss
unicorn.configs.recommendedMarkdown
unicorn.configs.recommendedHtml
- possibly also
unicorn.configs.agnostic for those rules which work on any file type (comment-content, filename-case, no-abusive-eslint-disable, prefer-https)
Thanks for considering it!
This plugin has various rules for non-js/ts files.
But there is no preset for them, so we must explicitly list those rules for the appropriate file types, possibly duplicating them multiple times:
It would be simpler and less error prone (and DRY) if we could do this instead:
Please consider exposing more presets:
unicorn.configs.recommendedJsonunicorn.configs.recommendedCssunicorn.configs.recommendedMarkdownunicorn.configs.recommendedHtmlunicorn.configs.agnosticfor those rules which work on any file type (comment-content,filename-case,no-abusive-eslint-disable,prefer-https)Thanks for considering it!