Skip to content

Commit

Permalink
Refactor not implemented option warning
Browse files Browse the repository at this point in the history
Report an error through eslint instead of throw.
  • Loading branch information
renatho committed Sep 13, 2020
1 parent 771d550 commit 38b8b9d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/rules/checkLinesAlignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ export default iterateJsdoc(({
indent,
}) => {
if (context.options[0] === 'never') {
throw new Error('The `never` option is not yet implemented for this rule.');
report('The `never` option is not yet implemented for this rule.');

return;
}

if (context.options[0] !== 'always') {
Expand Down
24 changes: 24 additions & 0 deletions test/rules/assertions/checkLinesAlignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,26 @@ export default {
*/
`,
},
{
code: `
/**
* Not implemented yet.
*
* @param {string} lorem Description.
* @param {int} sit Description multi words.
*/
const fn = ( lorem, sit ) => {}
`,
errors: [
{
message: 'The `never` option is not yet implemented for this rule.',
type: 'Block',
},
],
options: [
'never',
],
},
],
valid: [
{
Expand Down Expand Up @@ -533,7 +553,11 @@ export default {
code: `
/**
* Not validating without option.
*
* @param {string} lorem Description.
* @param {int} sit Description multi words.
*/
const fn = ( lorem, sit ) => {}
`,
},
],
Expand Down

0 comments on commit 38b8b9d

Please sign in to comment.