Inline js inside a form
You seem to be trying to use method for adding settings. I believe this is the correct way as stated on the docs:

$form['#attached']['js'] = array(
  'jQuery(function() { console.log("test"); });' =&gt; array(
    'type' =&gt; 'inline',
  ),
);


Docs: #attached