Skip to content

v2.0.0: Update custom rules to match HTML Academy codeguide#115

Open
meritt wants to merge 11 commits into
mainfrom
next
Open

v2.0.0: Update custom rules to match HTML Academy codeguide#115
meritt wants to merge 11 commits into
mainfrom
next

Conversation

@meritt
Copy link
Copy Markdown
Member

@meritt meritt commented Jan 25, 2026

Major update of LintHTML custom rules aligned with htmlacademy/linthtml-config-htmlacademy#28 and htmlacademy/codeguide#75.

  • Rename rule req-source-width-height → replaced-elements-req-dimensions with expanded
    scope (now covers img, svg, video, iframe)
  • Update req-webp-in-picture rule to also accept AVIF format
  • Simplify a-target-rel rule: require only noopener (removed noreferrer requirement)

@meritt
Copy link
Copy Markdown
Member Author

meritt commented Jan 25, 2026

@nikolai-shabalin ку-ку

Comment thread docs/CONTRIBUTING.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо восстановить

Comment thread docs/list-of-rules.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хотелось бы восстановить

const requiredAttributes = {
// todo вынести в конфиг правила
rel: ['noreferrer', 'noopener']
rel: ['noopener']
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не нужно исправлять. Это работает

@@ -1,10 +1,10 @@
# htmlacademy/a-target-rel
Правило проверяет наличие атрибута `rel` со значениями `noreferrer` и `noopener` у ссылок` <a>` с атрибутом `target="_blank"`. Правило принимает значения true или false.
This rule checks that `<a>` links with `target="_blank"` have a `rel` attribute with both `noreferrer` and `noopener` values. Accepts `true` or `false`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо вернуть все переводы назад. И подумать на .en-.ru версиями


module.exports = {
name: 'htmlacademy/img-svg-req-dimensions',
name: 'htmlacademy/replaced-elements-req-dimensions',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вернуть название как было, так как replaced-elements, про куда больший ассортимент тегов, чем конкретный список svg и img

@@ -1,11 +1,11 @@
# htmlacademy/img-svg-req-dimensions
# htmlacademy/replaced-elements-req-dimensions
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вернуть имя правила

}

const hasWebpSource = sourceElements.some((source) => attribute_has_value(source, 'type', 'image/webp'));
const hasAvifSource = sourceElements.some((source) => attribute_has_value(source, 'type', 'image/avif'));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AVIF сделать отдельным правилом и не добавлять в WEBP

Comment thread CHANGELOG.md
@@ -1,5 +1,14 @@
# Changelog

## 2.0.0 — ???
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update deps

Comment thread index.js

const rulesDir = path.join(__dirname, './rules');
const ruleFiles = fs.readdirSync(rulesDir);
const ruleFiles = fs.readdirSync(rulesDir).filter((file) => !file.startsWith('.'));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это лишнее внутри ./rules/ нет таких файлов и папок

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants