Skip to content
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

Fix end positions for selector-*-no-unknown #6046

Merged
merged 3 commits into from Apr 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions lib/rules/selector-pseudo-class-no-unknown/__tests__/index.js
Expand Up @@ -124,72 +124,96 @@ testRule({
message: messages.rejected(':unknown'),
line: 1,
column: 2,
endLine: 1,
endColumn: 10,
},
{
code: 'a:Unknown { }',
message: messages.rejected(':Unknown'),
line: 1,
column: 2,
endLine: 1,
endColumn: 10,
},
{
code: 'a:uNkNoWn { }',
message: messages.rejected(':uNkNoWn'),
line: 1,
column: 2,
endLine: 1,
endColumn: 10,
},
{
code: 'a:UNKNOWN { }',
message: messages.rejected(':UNKNOWN'),
line: 1,
column: 2,
endLine: 1,
endColumn: 10,
},
{
code: 'a:pseudo-class { }',
message: messages.rejected(':pseudo-class'),
line: 1,
column: 2,
endLine: 1,
endColumn: 15,
},
{
code: 'body:not(div):noot(span) {}',
message: messages.rejected(':noot'),
line: 1,
column: 14,
endLine: 1,
endColumn: 19,
},
{
code: 'a:unknown::before { }',
message: messages.rejected(':unknown'),
line: 1,
column: 2,
endLine: 1,
endColumn: 10,
},
{
code: 'a,\nb > .foo:error { }',
message: messages.rejected(':error'),
line: 2,
column: 9,
endLine: 2,
endColumn: 15,
},
{
code: '::-webkit-scrollbar-button:horizontal:unknown {}',
message: messages.rejected(':unknown'),
line: 1,
column: 38,
endLine: 1,
endColumn: 46,
},
{
code: ':first { }',
message: messages.rejected(':first'),
line: 1,
column: 1,
endLine: 1,
endColumn: 7,
},
{
code: '@page :blank:unknown { }',
message: messages.rejected(':unknown'),
line: 1,
column: 13,
endLine: 1,
endColumn: 21,
},
{
code: '@page foo:unknown { }',
message: messages.rejected(':unknown'),
line: 1,
column: 10,
endLine: 1,
endColumn: 18,
},
{
code: ':horizontal:decrement {}',
Expand All @@ -198,11 +222,15 @@ testRule({
message: messages.rejected(':horizontal'),
line: 1,
column: 1,
endLine: 1,
endColumn: 12,
},
{
message: messages.rejected(':decrement'),
line: 1,
column: 12,
endLine: 1,
endColumn: 22,
},
],
},
Expand Down
1 change: 1 addition & 0 deletions lib/rules/selector-pseudo-class-no-unknown/index.js
Expand Up @@ -121,6 +121,7 @@ const rule = (primary, secondaryOptions) => {
index,
ruleName,
result,
word: value,
});
});
});
Expand Down
14 changes: 14 additions & 0 deletions lib/rules/selector-pseudo-element-no-unknown/__tests__/index.js
Expand Up @@ -115,42 +115,56 @@ testRule({
message: messages.rejected('::pseudo'),
line: 1,
column: 2,
endLine: 1,
endColumn: 10,
},
{
code: 'a::Pseudo { }',
message: messages.rejected('::Pseudo'),
line: 1,
column: 2,
endLine: 1,
endColumn: 10,
},
{
code: 'a::pSeUdO { }',
message: messages.rejected('::pSeUdO'),
line: 1,
column: 2,
endLine: 1,
endColumn: 10,
},
{
code: 'a::PSEUDO { }',
message: messages.rejected('::PSEUDO'),
line: 1,
column: 2,
endLine: 1,
endColumn: 10,
},
{
code: 'a::element { }',
message: messages.rejected('::element'),
line: 1,
column: 2,
endLine: 1,
endColumn: 11,
},
{
code: 'a:hover::element { }',
message: messages.rejected('::element'),
line: 1,
column: 8,
endLine: 1,
endColumn: 17,
},
{
code: 'a,\nb > .foo::error { }',
message: messages.rejected('::error'),
line: 2,
column: 9,
endLine: 2,
endColumn: 16,
},
],
});
Expand Down
1 change: 1 addition & 0 deletions lib/rules/selector-pseudo-element-no-unknown/index.js
Expand Up @@ -83,6 +83,7 @@ const rule = (primary, secondaryOptions) => {
index: pseudoNode.sourceIndex,
ruleName,
result,
word: value,
});
});
});
Expand Down
22 changes: 22 additions & 0 deletions lib/rules/selector-type-no-unknown/__tests__/index.js
Expand Up @@ -143,69 +143,91 @@ testRule({
message: messages.rejected('unknown'),
line: 1,
column: 1,
endLine: 1,
endColumn: 8,
},
{
code: 'uNkNoWn {}',
message: messages.rejected('uNkNoWn'),
line: 1,
column: 1,
endLine: 1,
endColumn: 8,
},
{
code: 'UNKNOWN {}',
message: messages.rejected('UNKNOWN'),
line: 1,
column: 1,
endLine: 1,
endColumn: 8,
},
{
code: 'ul unknown {}',
message: messages.rejected('unknown'),
line: 1,
column: 4,
endLine: 1,
endColumn: 11,
},
{
code: 'unknown[target] {}',
message: messages.rejected('unknown'),
line: 1,
column: 1,
endLine: 1,
endColumn: 8,
},
{
code: 'unknown:nth-child(even) {}',
message: messages.rejected('unknown'),
line: 1,
column: 1,
endLine: 1,
endColumn: 8,
},
{
code: '@media only screen and (min-width: 35em) { unknown {} }',
message: messages.rejected('unknown'),
line: 1,
column: 44,
endLine: 1,
endColumn: 51,
},
{
code: 'input:not(unknown) {}',
message: messages.rejected('unknown'),
line: 1,
column: 11,
endLine: 1,
endColumn: 18,
},
{
code: 'x-Foo {}',
description: 'invalid custom element',
message: messages.rejected('x-Foo'),
line: 1,
column: 1,
endLine: 1,
endColumn: 6,
},
{
code: 'X-foo {}',
description: 'invalid custom element',
message: messages.rejected('X-foo'),
line: 1,
column: 1,
endLine: 1,
endColumn: 6,
},
{
code: 'X-FOO {}',
description: 'invalid custom element',
message: messages.rejected('X-FOO'),
line: 1,
column: 1,
endLine: 1,
endColumn: 6,
},
],
});
Expand Down
1 change: 1 addition & 0 deletions lib/rules/selector-type-no-unknown/index.js
Expand Up @@ -105,6 +105,7 @@ const rule = (primary, secondaryOptions) => {
index: tagNode.sourceIndex,
ruleName,
result,
word: tagName,
});
});
});
Expand Down