Skip to content

Commit 2958c0a

Browse files
committed
Declare a JSON schema in 'default' for each rule
1 parent d885065 commit 2958c0a

26 files changed

+74
-25
lines changed

rules/assertion-arguments.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ const schema = [{
141141
enum: [
142142
'always',
143143
'never'
144-
]
144+
],
145+
default: null
145146
}
146147
}
147148
}];

rules/assertion-message.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ const schema = [{
6161
enum: [
6262
'always',
6363
'never'
64-
]
64+
],
65+
default: 'always'
6566
}];
6667

6768
module.exports = {

rules/max-asserts.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ const create = context => {
5656
};
5757

5858
const schema = [{
59-
type: 'integer'
59+
title: 'maximum number of assertions for each test',
60+
type: 'integer',
61+
minimum: 0,
62+
default: 5
6063
}];
6164

6265
module.exports = {

rules/no-async-fn-without-await.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ module.exports = {
5353
meta: {
5454
docs: {
5555
url: util.getDocsUrl(__filename)
56-
}
56+
},
57+
schema: []
5758
}
5859
};

rules/no-cb-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = {
2626
meta: {
2727
docs: {
2828
url: util.getDocsUrl(__filename)
29-
}
29+
},
30+
schema: []
3031
}
3132
};

rules/no-duplicate-modifiers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ module.exports = {
4747
meta: {
4848
docs: {
4949
url: util.getDocsUrl(__filename)
50-
}
50+
},
51+
schema: []
5152
}
5253
};

rules/no-identical-title.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ module.exports = {
6464
meta: {
6565
docs: {
6666
url: util.getDocsUrl(__filename)
67-
}
67+
},
68+
schema: []
6869
}
6970
};

rules/no-ignored-test-files.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,21 @@ const create = context => {
8080
};
8181

8282
const schema = [{
83+
title: 'one option: files',
84+
$comment: 'the default value of option `files` is from package.json or ava.config.js',
8385
type: 'object',
8486
properties: {
8587
files: {
86-
type: 'array'
88+
type: 'array',
89+
minItems: 0,
90+
uniqueItems: true,
91+
items: {
92+
type: 'string'
93+
},
94+
examples: [
95+
['lib/**/*.test.js', 'utils/**/*.test.js']
96+
],
97+
default: null
8798
}
8899
}
89100
}];

rules/no-import-test-files.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,21 @@ const create = context => {
6969
};
7070

7171
const schema = [{
72+
title: 'one option: files',
73+
$comment: 'the default value of option `files` is from package.json or ava.config.js',
7274
type: 'object',
7375
properties: {
7476
files: {
75-
type: 'array'
77+
type: 'array',
78+
minItems: 0,
79+
uniqueItems: true,
80+
items: {
81+
type: 'string'
82+
},
83+
examples: [
84+
['lib/**/*.test.js', 'utils/**/*.test.js']
85+
],
86+
default: null
7687
}
7788
}
7889
}];

rules/no-invalid-end.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ module.exports = {
3030
meta: {
3131
docs: {
3232
url: util.getDocsUrl(__filename)
33-
}
33+
},
34+
schema: []
3435
}
3536
};

rules/no-nested-tests.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module.exports = {
3535
meta: {
3636
docs: {
3737
url: util.getDocsUrl(__filename)
38-
}
38+
},
39+
schema: []
3940
}
4041
};

rules/no-only-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module.exports = {
3535
docs: {
3636
url: util.getDocsUrl(__filename)
3737
},
38-
fixable: 'code'
38+
fixable: 'code',
39+
schema: []
3940
}
4041
};

rules/no-skip-assert.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = {
2626
meta: {
2727
docs: {
2828
url: util.getDocsUrl(__filename)
29-
}
29+
},
30+
schema: []
3031
}
3132
};

rules/no-skip-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module.exports = {
3535
docs: {
3636
url: util.getDocsUrl(__filename)
3737
},
38-
fixable: 'code'
38+
fixable: 'code',
39+
schema: []
3940
}
4041
};

rules/no-statement-after-end.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ module.exports = {
9595
meta: {
9696
docs: {
9797
url: util.getDocsUrl(__filename)
98-
}
98+
},
99+
schema: []
99100
}
100101
};

rules/no-todo-implementation.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = {
2626
meta: {
2727
docs: {
2828
url: util.getDocsUrl(__filename)
29-
}
29+
},
30+
schema: []
3031
}
3132
};

rules/no-todo-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = {
2626
meta: {
2727
docs: {
2828
url: util.getDocsUrl(__filename)
29-
}
29+
},
30+
schema: []
3031
}
3132
};

rules/no-unknown-modifiers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ module.exports = {
4545
meta: {
4646
docs: {
4747
url: util.getDocsUrl(__filename)
48-
}
48+
},
49+
schema: []
4950
}
5051
};

rules/prefer-async-await.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ module.exports = {
5353
meta: {
5454
docs: {
5555
url: util.getDocsUrl(__filename)
56-
}
56+
},
57+
schema: []
5758
}
5859
};

rules/prefer-power-assert.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ module.exports = {
8484
meta: {
8585
docs: {
8686
url: util.getDocsUrl(__filename)
87-
}
87+
},
88+
schema: []
8889
}
8990
};

rules/test-ended.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ module.exports = {
4545
meta: {
4646
docs: {
4747
url: util.getDocsUrl(__filename)
48-
}
48+
},
49+
schema: []
4950
}
5051
};

rules/test-title.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const create = context => {
3434
};
3535

3636
const schema = [{
37+
type: 'string',
38+
default: 'if-multiple',
3739
enum: [
3840
'always',
3941
'if-multiple'

rules/use-t-well.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ module.exports = {
107107
meta: {
108108
docs: {
109109
url: util.getDocsUrl(__filename)
110-
}
110+
},
111+
schema: []
111112
}
112113
};

rules/use-t.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module.exports = {
4242
meta: {
4343
docs: {
4444
url: util.getDocsUrl(__filename)
45-
}
45+
},
46+
schema: []
4647
}
4748
};

rules/use-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module.exports = {
4242
meta: {
4343
docs: {
4444
url: util.getDocsUrl(__filename)
45-
}
45+
},
46+
schema: []
4647
}
4748
};

rules/use-true-false.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ module.exports = {
8989
meta: {
9090
docs: {
9191
url: util.getDocsUrl(__filename)
92-
}
92+
},
93+
schema: []
9394
}
9495
};

0 commit comments

Comments
 (0)