Skip to content

Commit ffb734b

Browse files
authored
Breaking: change test-case-property-ordering default options (fixes #79) (#93)
defaults to ['filename','code','output','options','parser', 'parserOptions','globals','env','errors']
1 parent 59ddffc commit ffb734b

File tree

3 files changed

+31
-14
lines changed

3 files changed

+31
-14
lines changed

lib/rules/test-case-property-ordering.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,17 @@ module.exports = {
3131
// Public
3232
// ----------------------------------------------------------------------
3333
const message = 'The properties of a test case should be placed in a consistent order: [{{order}}].';
34-
const order = context.options[0] || ['code', 'output', 'options', 'parserOptions', 'errors'];
34+
const order = context.options[0] || [
35+
'filename',
36+
'code',
37+
'output',
38+
'options',
39+
'parser',
40+
'parserOptions',
41+
'globals',
42+
'env',
43+
'errors',
44+
];
3545
const sourceCode = context.getSourceCode();
3646

3747
return {

tests/lib/rules/require-meta-docs-url.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ tester.run('require-meta-docs-url', rule, {
5555
}],
5656
},
5757
{
58+
filename: 'test-rule',
5859
code: `
5960
module.exports = {
6061
meta: {docs: {url: "path/to/test-rule.md"}},
@@ -64,7 +65,6 @@ tester.run('require-meta-docs-url', rule, {
6465
options: [{
6566
pattern: 'path/to/{{name}}.md',
6667
}],
67-
filename: 'test-rule',
6868
},
6969
],
7070

@@ -396,6 +396,7 @@ tester.run('require-meta-docs-url', rule, {
396396
// pattern option with filename
397397
// -------------------------------------------------------------------------
398398
{
399+
filename: 'test.js',
399400
code: `
400401
module.exports = function() {}
401402
`,
@@ -404,9 +405,9 @@ tester.run('require-meta-docs-url', rule, {
404405
pattern: 'plugin-name/{{ name }}.md',
405406
}],
406407
errors: ['Rules should export a `meta.docs.url` property.'],
407-
filename: 'test.js',
408408
},
409409
{
410+
filename: 'test.js',
410411
code: `
411412
module.exports = {
412413
meta,
@@ -418,9 +419,9 @@ tester.run('require-meta-docs-url', rule, {
418419
pattern: 'plugin-name/{{ name }}.md',
419420
}],
420421
errors: ['Rules should export a `meta.docs.url` property.'],
421-
filename: 'test.js',
422422
},
423423
{
424+
filename: 'test.js',
424425
code: `
425426
module.exports = {
426427
meta: 100,
@@ -432,9 +433,9 @@ tester.run('require-meta-docs-url', rule, {
432433
pattern: 'plugin-name/{{ name }}.md',
433434
}],
434435
errors: ['Rules should export a `meta.docs.url` property.'],
435-
filename: 'test.js',
436436
},
437437
{
438+
filename: 'test.js',
438439
code: `
439440
module.exports = {
440441
meta: {},
@@ -455,9 +456,9 @@ url: "plugin-name/test.md"
455456
pattern: 'plugin-name/{{ name }}.md',
456457
}],
457458
errors: ['Rules should export a `meta.docs.url` property.'],
458-
filename: 'test.js',
459459
},
460460
{
461+
filename: 'test.js',
461462
code: `
462463
module.exports = {
463464
meta: {
@@ -481,9 +482,9 @@ url: "plugin-name/test.md"
481482
pattern: 'plugin-name/{{ name }}.md',
482483
}],
483484
errors: ['Rules should export a `meta.docs.url` property.'],
484-
filename: 'test.js',
485485
},
486486
{
487+
filename: 'test.js',
487488
code: `
488489
module.exports = {
489490
meta: {
@@ -507,9 +508,9 @@ url: "plugin-name/test.md"
507508
pattern: 'plugin-name/{{ name }}.md',
508509
}],
509510
errors: ['Rules should export a `meta.docs.url` property.'],
510-
filename: 'test.js',
511511
},
512512
{
513+
filename: 'test.js',
513514
code: `
514515
module.exports = {
515516
meta: {
@@ -523,9 +524,9 @@ url: "plugin-name/test.md"
523524
pattern: 'plugin-name/{{ name }}.md',
524525
}],
525526
errors: ['Rules should export a `meta.docs.url` property.'],
526-
filename: 'test.js',
527527
},
528528
{
529+
filename: 'test.js',
529530
code: `
530531
module.exports = {
531532
meta: {
@@ -548,9 +549,9 @@ url: "plugin-name/test.md"
548549
pattern: 'plugin-name/{{ name }}.md',
549550
}],
550551
errors: ['Rules should export a `meta.docs.url` property.'],
551-
filename: 'test.js',
552552
},
553553
{
554+
filename: 'test.js',
554555
code: `
555556
module.exports = {
556557
meta: {
@@ -576,9 +577,9 @@ url: "plugin-name/test.md"
576577
pattern: 'plugin-name/{{ name }}.md',
577578
}],
578579
errors: ['Rules should export a `meta.docs.url` property.'],
579-
filename: 'test.js',
580580
},
581581
{
582+
filename: 'test.js',
582583
code: `
583584
module.exports = {
584585
meta: {
@@ -604,9 +605,9 @@ url: "plugin-name/test.md",
604605
pattern: 'plugin-name/{{ name }}.md',
605606
}],
606607
errors: ['Rules should export a `meta.docs.url` property.'],
607-
filename: 'test.js',
608608
},
609609
{
610+
filename: 'test.js',
610611
code: `
611612
module.exports = {
612613
meta: {
@@ -631,9 +632,9 @@ url: "plugin-name/test.md",
631632
pattern: 'plugin-name/{{ name }}.md',
632633
}],
633634
errors: ['`meta.docs.url` property must be `plugin-name/test.md`.'],
634-
filename: 'test.js',
635635
},
636636
{
637+
filename: 'test.js',
637638
code: `
638639
module.exports = {
639640
meta: {
@@ -659,7 +660,6 @@ url: "plugin-name/test.md"
659660
pattern: 'plugin-name/{{ name }}.md',
660661
}],
661662
errors: ['Rules should export a `meta.docs.url` property.'],
662-
filename: 'test.js',
663663
},
664664
],
665665
});

tests/lib/rules/test-case-property-ordering.js

+7
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ ruleTester.run('test-case-property-ordering', rule, {
3333
]
3434
});
3535
`,
36+
`
37+
new RuleTester().run('foo', bar, {
38+
valid: [
39+
{ filename: '', code: '', output: '', options: '', parser: '', parserOptions: '', globals: '', env: '', errors: '' },
40+
]
41+
});
42+
`,
3643
{
3744
code: `
3845
new RuleTester().run('foo', bar, {

0 commit comments

Comments
 (0)