Skip to content

Commit df26df3

Browse files
thecalamiitynzakas
andauthored
feat: allow custom descriptors in no-invalid-at-rules (eslint#128)
* feat: allow custom descriptors in no-invalid-at-rules * Update src/rules/no-invalid-at-rules.js * Update src/rules/no-invalid-at-rules.js * Update src/rules/no-invalid-at-rules.js --------- Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
1 parent 3ccfd7c commit df26df3

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/rules/no-invalid-at-rules.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ export default {
121121
},
122122

123123
"AtRule > Block > Declaration"(node) {
124+
// skip custom descriptors
125+
if (node.property.startsWith("--")) {
126+
return;
127+
}
128+
124129
// get at rule node
125130
const atRule = /** @type {AtrulePlain} */ (
126131
sourceCode.getParent(sourceCode.getParent(node))

tests/rules/no-invalid-at-rules.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,19 @@ ruleTester.run("no-invalid-at-rules", rule, {
6767
customSyntax: tailwindSyntax,
6868
},
6969
},
70+
{
71+
code: `@custom-rule {
72+
--foo: red;
73+
--bar: blue;
74+
}`,
75+
languageOptions: {
76+
customSyntax: {
77+
atrules: {
78+
"custom-rule": {},
79+
},
80+
},
81+
},
82+
},
7083
],
7184
invalid: [
7285
{

0 commit comments

Comments
 (0)