Skip to content

Commit

Permalink
Fix: space-in-parens crash (#9655)
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea authored and not-an-aardvark committed Nov 26, 2017
1 parent 92171cc commit e13d439
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/rules/space-in-parens.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ module.exports = {
const MISSING_SPACE_MESSAGE = "There must be a space inside this paren.",
REJECTED_SPACE_MESSAGE = "There should be no spaces inside this paren.",
ALWAYS = context.options[0] === "always",

exceptionsArrayOptions = (context.options.length === 2) ? context.options[1].exceptions : [],
exceptionsArrayOptions = (context.options[1] && context.options[1].exceptions) || [],
options = {};
let exceptions;

Expand Down
3 changes: 2 additions & 1 deletion tests/lib/rules/space-in-parens.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ ruleTester.run("space-in-parens", rule, {
{ code: "foo( ); bar( {bar:'baz'} ); baz( [1,2] )", options: ["never", { exceptions: ["{}", "[]", "empty"] }] },

// faulty exceptions option
{ code: "foo( { bar: 'baz' } )", options: ["always", { exceptions: [] }] }
{ code: "foo( { bar: 'baz' } )", options: ["always", { exceptions: [] }] },
{ code: "foo( { bar: 'baz' } )", options: ["always", {}] }
],

invalid: [
Expand Down

0 comments on commit e13d439

Please sign in to comment.