Skip to content

Commit

Permalink
testing(check-examples): add configFile test
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Jun 26, 2021
1 parent f03fec4 commit d73787c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,16 @@ function quux2 () {
*/
function quux2 () {

}
// "jsdoc/check-examples": ["error"|"warn", {"configFile":".eslintrc.json","matchingFileName":"../../jsdocUtils.js"}]
// Message: @example warning (id-length): Identifier name 'i' is too short (< 2).

/**
* @example const i = 5;
* quux2()
*/
function quux2 () {

}
// Message: @example warning (id-length): Identifier name 'i' is too short (< 2).

Expand Down
25 changes: 25 additions & 0 deletions test/rules/assertions/checkExamples.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,31 @@ export default {
message: '@example error (semi): Missing semicolon.',
},
],
options: [{
configFile: '.eslintrc.json',
matchingFileName: '../../jsdocUtils.js',
}],
},
{
code: `
/**
* @example const i = 5;
* quux2()
*/
function quux2 () {
}
`,
errors: [
{
line: 3,
message: '@example warning (id-length): Identifier name \'i\' is too short (< 2).',
},
{
line: 4,
message: '@example error (semi): Missing semicolon.',
},
],
filename: 'test/rules/data/jsdocUtils.js',
},
{
Expand Down

0 comments on commit d73787c

Please sign in to comment.