Skip to content

Feat/NEWCLICKUI-4391 add new rule #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aychernov
Copy link

@aychernov aychernov commented May 20, 2025

Добавлено правило, которое запрещает импорт vars.css в проектах.
Учтено использование вместе с @mixin / @include .

checkDarkColorsUsage() - убраны неиспользуемые параметры.

Мотивация и контекст

Выполнено в рамках задачи - NEWCLICKUI-4391 "Нужно запретить импорт @import '../../vars.css' в css-модулях".
Для модулей, в которых есть миксины, импорт разрешаем

@@ -12,6 +12,7 @@ const RULE_USE_MIXINS = 'stylelint-core-vars/use-mixins';
const RULE_USE_ONE_OF_MIXINS = 'stylelint-core-vars/use-one-of-mixins';
const RULE_DO_NOT_USE_DARK_COLORS = 'stylelint-core-vars/do-not-use-dark-colors';
const RULE_DO_NOT_USE_OLD_VARS = 'stylelint-core-vars/do-not-use-old-vars';
const RULE_NO_USELESS_VARS_IMPORT = 'stylelint-core-vars/no-useless-vars-import';
Copy link
Collaborator

Choose a reason for hiding this comment

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

А оно точно везде useless?

Copy link
Author

Choose a reason for hiding this comment

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

В контексте названия имеешь ввиду? Там где срабатывает - да, а где vars импорят совместно с миксинами, правило же как раз и не будет ругаться. Или на что-то лучше заменить?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Я про то что во всех ли проектах компании это так, библиотека же глобальная

Copy link
Author

Choose a reason for hiding this comment

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

@reme3d2y @SiebenSieben Привет!
Подскажите пожалуйста, ок ли вам по такому правилу?

Choose a reason for hiding this comment

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

Нам бы обновить кодоунеров, reme3d2y уже с нами не работает, и я по факту не занимаюсь поддержкой линтера

Choose a reason for hiding this comment

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

По вопросу не уверен, что везде будет ок, предлагаю спросить в рокетчате javascript

@kiskv kiskv requested a review from a team May 21, 2025 16:41
@@ -174,6 +180,46 @@ const checkDarkColorsUsage = (decl, result, context, ruleName) => {
}
};

const checkVarsImportUsage = (root, result, context, ruleName) => {
const isVarsCssImport = (params) => /\/?vars\.css(['"])?\s*;?$/.test(params);
Copy link

Choose a reason for hiding this comment

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

Может стоит ограничить конкретным местом? Какая мотивация ограничения для всех vars.css?

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.

4 participants