Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e649efa
add `declaration-block-nesting-at-rule-required-list`
sw1tch3roo Jul 22, 2025
d51f557
Merge branch 'main' into feature/declaration-block-nesting-at-rule-re…
sw1tch3roo Jul 22, 2025
3c04e94
fix the type in index.d.ts
sw1tch3roo Jul 22, 2025
3fe8df7
Refactor rule to check entire rules instead of individual declarations
sw1tch3roo Jul 23, 2025
016b16e
Merge branch 'main' into feature/declaration-block-nesting-at-rule-re…
sw1tch3roo Jul 24, 2025
cbade06
changes after review: change code style, delete unnecessary tests, up…
sw1tch3roo Jul 24, 2025
52c7654
Merge branch 'main' into feature/declaration-block-nesting-at-rule-re…
sw1tch3roo Jul 24, 2025
e048d14
suggestions from code review
sw1tch3roo Jul 24, 2025
18b7ec7
Merge branch 'main' into feature/declaration-block-nesting-at-rule-re…
sw1tch3roo Jul 25, 2025
2bdb301
build cjs file
sw1tch3roo Jul 25, 2025
db6523f
use typeGuards utils
sw1tch3roo Jul 25, 2025
892693a
Merge branch 'main' into feature/declaration-block-nesting-at-rule-re…
sw1tch3roo Jul 25, 2025
d90f473
enhance the expected messages
sw1tch3roo Jul 28, 2025
fb24ded
Merge branch 'main' into feature/declaration-block-nesting-at-rule-re…
sw1tch3roo Jul 28, 2025
e79ff39
change the examples in README.md
sw1tch3roo Jul 28, 2025
9f765c3
Merge branch 'main' into feature/declaration-block-nesting-at-rule-re…
sw1tch3roo Jul 29, 2025
fa64d61
Merge branch 'main' into feature/declaration-block-nesting-at-rule-re…
sw1tch3roo Jul 30, 2025
dd2a7ff
fix expected message type in `d.ts` declaration
sw1tch3roo Aug 2, 2025
554ecd6
reuse the type of args
sw1tch3roo Aug 2, 2025
5dca318
change expected message type in `d.ts`
sw1tch3roo Aug 2, 2025
c0c5591
Merge branch 'main' into feature/declaration-block-nesting-at-rule-re…
sw1tch3roo Aug 4, 2025
f4000e8
Merge branch 'main' into feature/declaration-block-nesting-at-rule-re…
sw1tch3roo Aug 5, 2025
6260d46
Merge branch 'main' into feature/declaration-block-nesting-at-rule-re…
sw1tch3roo Aug 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use typeGuards utils
  • Loading branch information
sw1tch3roo committed Jul 25, 2025
commit db6523fe89e5f2c22c901e1a81fa89bd97d0bffb
8 changes: 6 additions & 2 deletions lib/rules/rule-nesting-at-rule-required-list/index.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions lib/rules/rule-nesting-at-rule-required-list/index.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { isAtRule, isRoot } from '../../utils/typeGuards.mjs';
import { isRegExp, isString } from '../../utils/validateTypes.mjs';
import isStandardSyntaxRule from '../../utils/isStandardSyntaxRule.mjs';
import matchesStringOrRegExp from '../../utils/matchesStringOrRegExp.mjs';
import report from '../../utils/report.mjs';
import ruleMessages from '../../utils/ruleMessages.mjs';
Expand Down Expand Up @@ -27,6 +29,8 @@ const rule = (primary) => {
if (!validOptions) return;

root.walkRules((ruleNode) => {
if (!isStandardSyntaxRule(ruleNode)) return;

// Skip if rule already has a required at-rule ancestor
if (hasRequiredAtRuleAncestor(ruleNode, primary)) return;

Expand Down Expand Up @@ -54,14 +58,14 @@ function hasRequiredAtRuleAncestor(ruleNode, requiredAtRules) {

while (current) {
// Check if current node is an at-rule (e.g., @layer, @scope, @supports)
if (current.type === 'atrule') {
if (isAtRule(current)) {
const atRuleName = current.name;

// Check if at-rule name matches any of the required patterns
if (matchesStringOrRegExp(atRuleName, requiredAtRules)) return true;
}

if (current.type === 'root') break;
if (isRoot(current)) break;

current = current.parent;
}
Expand Down
Loading