Skip to content

Commit

Permalink
Add ranges for warnings (#5725)
Browse files Browse the repository at this point in the history
  • Loading branch information
adalinesimonian committed Apr 11, 2022
1 parent 238f917 commit 1d94bb0
Show file tree
Hide file tree
Showing 104 changed files with 1,845 additions and 163 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@ node_modules
.coverage
.eslintcache
yarn.lock
.vscode/settings.json
2 changes: 2 additions & 0 deletions docs/developer-guide/formatters.md
Expand Up @@ -23,6 +23,8 @@ Where the first argument (`results`) is an array of Stylelint result objects (ty
{
"line": 3,
"column": 12,
"endLine": 4,
"endColumn": 15,
"rule": "block-no-empty",
"severity": "error",
"text": "You should not have an empty block (block-no-empty)"
Expand Down
8 changes: 6 additions & 2 deletions docs/developer-guide/plugins.md
Expand Up @@ -155,7 +155,9 @@ testRule({
fixed: ".my-class {}",
message: messages.expected(),
line: 1,
column: 1
column: 1,
endLine: 1,
endColumn: 9
}
]
});
Expand Down Expand Up @@ -266,7 +268,9 @@ function myPluginRule(primaryOption, secondaryOptionObject) {
result: postcssResult,
node: warning.node,
line: warning.line,
column: warning.column
column: warning.column,
endLine: warning.endLine,
endColumn: warning.endColumn
});
}
);
Expand Down
24 changes: 24 additions & 0 deletions lib/__tests__/descriptionlessDisables.test.js
Expand Up @@ -45,20 +45,26 @@ it('descriptionlessDisables', async () => {
{
line: 12,
column: 1,
endLine: 12,
endColumn: 23,
rule: '--report-descriptionless-disables',
severity: 'error',
text: 'Disable for "all" is missing a description',
},
{
line: 16,
column: 7,
endLine: 16,
endColumn: 49,
rule: '--report-descriptionless-disables',
severity: 'error',
text: 'Disable for "block-no-empty" is missing a description',
},
{
line: 18,
column: 1,
endLine: 18,
endColumn: 48,
rule: '--report-descriptionless-disables',
severity: 'error',
text: 'Disable for "block-no-empty" is missing a description',
Expand Down Expand Up @@ -108,20 +114,26 @@ it('descriptionlessDisables from config', async () => {
{
line: 12,
column: 1,
endLine: 12,
endColumn: 23,
rule: '--report-descriptionless-disables',
severity: 'error',
text: 'Disable for "all" is missing a description',
},
{
line: 16,
column: 7,
endLine: 16,
endColumn: 49,
rule: '--report-descriptionless-disables',
severity: 'error',
text: 'Disable for "block-no-empty" is missing a description',
},
{
line: 18,
column: 1,
endLine: 18,
endColumn: 48,
rule: '--report-descriptionless-disables',
severity: 'error',
text: 'Disable for "block-no-empty" is missing a description',
Expand Down Expand Up @@ -171,13 +183,17 @@ it('descriptionlessDisables true except', async () => {
{
line: 12,
column: 1,
endLine: 12,
endColumn: 23,
rule: '--report-descriptionless-disables',
severity: 'error',
text: 'Disable for "all" is missing a description',
},
{
line: 18,
column: 1,
endLine: 18,
endColumn: 48,
rule: '--report-descriptionless-disables',
severity: 'error',
text: 'Disable for "block-no-empty" is missing a description',
Expand Down Expand Up @@ -227,6 +243,8 @@ it('descriptionlessDisables false except', async () => {
{
line: 16,
column: 7,
endLine: 16,
endColumn: 51,
rule: '--report-descriptionless-disables',
severity: 'error',
text: 'Disable for "invalid-hex-case" is missing a description',
Expand Down Expand Up @@ -276,20 +294,26 @@ it('descriptionlessDisables severity', async () => {
{
line: 12,
column: 1,
endLine: 12,
endColumn: 23,
rule: '--report-descriptionless-disables',
severity: 'warning',
text: 'Disable for "all" is missing a description',
},
{
line: 16,
column: 7,
endLine: 16,
endColumn: 49,
rule: '--report-descriptionless-disables',
severity: 'warning',
text: 'Disable for "block-no-empty" is missing a description',
},
{
line: 18,
column: 1,
endLine: 18,
endColumn: 48,
rule: '--report-descriptionless-disables',
severity: 'warning',
text: 'Disable for "block-no-empty" is missing a description',
Expand Down
24 changes: 24 additions & 0 deletions lib/__tests__/invalidScopeDisables.test.js
Expand Up @@ -38,13 +38,17 @@ it('invalidScopeDisables simple case', async () => {
{
line: 1,
column: 1,
endLine: 1,
endColumn: 38,
rule: '--report-invalid-scope-disables',
text: 'Rule "block-no-empty" isn\'t enabled',
severity: 'error',
},
{
line: 5,
column: 7,
endLine: 5,
endColumn: 49,
rule: '--report-invalid-scope-disables',
text: 'Rule "block-no-empty" isn\'t enabled',
severity: 'error',
Expand Down Expand Up @@ -80,13 +84,17 @@ it('invalidScopeDisables from config', async () => {
{
line: 1,
column: 1,
endLine: 1,
endColumn: 38,
rule: '--report-invalid-scope-disables',
text: 'Rule "block-no-empty" isn\'t enabled',
severity: 'error',
},
{
line: 5,
column: 7,
endLine: 5,
endColumn: 49,
rule: '--report-invalid-scope-disables',
text: 'Rule "block-no-empty" isn\'t enabled',
severity: 'error',
Expand Down Expand Up @@ -117,6 +125,8 @@ it('invalidScopeDisables complex case', async () => {
{
line: 1,
column: 1,
endLine: 1,
endColumn: 35,
rule: '--report-invalid-scope-disables',
text: 'Rule "color-named" isn\'t enabled',
severity: 'error',
Expand All @@ -126,6 +136,8 @@ it('invalidScopeDisables complex case', async () => {
{
line: 5,
column: 6,
endLine: 5,
endColumn: 45,
rule: '--report-invalid-scope-disables',
text: 'Rule "color-named" isn\'t enabled',
severity: 'error',
Expand Down Expand Up @@ -154,6 +166,8 @@ it('invalidScopeDisables ignored case', async () => {
{
line: 5,
column: 1,
endLine: 5,
endColumn: 38,
rule: '--report-invalid-scope-disables',
text: 'Rule "block-no-empty" isn\'t enabled',
severity: 'error',
Expand Down Expand Up @@ -186,6 +200,8 @@ it('invalidScopeDisables for config file', async () => {
{
line: 4,
column: 1,
endLine: 4,
endColumn: 27,
rule: '--report-invalid-scope-disables',
text: 'Rule "foo" isn\'t enabled',
severity: 'error',
Expand Down Expand Up @@ -221,6 +237,8 @@ it('invalidScopeDisables true except', async () => {
{
line: 1,
column: 1,
endLine: 1,
endColumn: 38,
rule: '--report-invalid-scope-disables',
text: 'Rule "block-no-empty" isn\'t enabled',
severity: 'error',
Expand Down Expand Up @@ -256,6 +274,8 @@ it('invalidScopeDisables false except', async () => {
{
line: 5,
column: 7,
endLine: 5,
endColumn: 51,
rule: '--report-invalid-scope-disables',
text: 'Rule "invalid-hex-case" isn\'t enabled',
severity: 'error',
Expand Down Expand Up @@ -291,13 +311,17 @@ it('invalidScopeDisables severity', async () => {
{
line: 1,
column: 1,
endLine: 1,
endColumn: 38,
rule: '--report-invalid-scope-disables',
text: 'Rule "block-no-empty" isn\'t enabled',
severity: 'warning',
},
{
line: 5,
column: 7,
endLine: 5,
endColumn: 49,
rule: '--report-invalid-scope-disables',
text: 'Rule "block-no-empty" isn\'t enabled',
severity: 'warning',
Expand Down

0 comments on commit 1d94bb0

Please sign in to comment.