question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spacing in object passed as function argument

See original GitHub issue

Tell us about your environment

  • ESLint Version: eslint@next (v4.0.0-rc.0)
  • Node Version: v8.0.0 (Win x86_64)
  • npm Version: 5.0.0

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration:

{
	"env" : {
		"browser" : true,
		"jquery" : true
	},
	"rules" : {
		"brace-style" : [ "error", "1tbs", {} ],
		"comma-spacing" : [ "error", { "before" : false, "after" : true } ],
		"comma-style" : [ "error", "last" ],
		"space-in-parens" : [ "error", "always" ],
		"object-curly-spacing" : [ "error", "always" ]
	}
}

What did you do? Please include the actual source code causing the issue. I have some historically grown code. Tabs and spaces are mixed, commas in front. I called eslint --fix on that file.

$.ajax(
{ 	url : '/ajax.cfc?method=myMethod&_cf_nodebug=true'
,	type : 'POST'
,	data : {}
,	success : function( data )
	{
	console.dir(data);
}
,	async : false
} );

What did you expect to happen? There’s a space and a tab after the curly brace in line 2. I expect one of these gone.

What actually happened? Please include the actual, raw output from ESLint.

$.ajax(
{ 	url : '/ajax.cfc?method=myMethod&_cf_nodebug=true',
	type : 'POST',
	data : {},
	success : function( data ) {
	console.dir( data );
},
	async : false
} );

The --fixed version does not look differently than the input. Tab and space remained there. In the last line curly brace and bracket are beautifully aligned separated by one space. I expect bracket and curly brace to from line one and two to be united on one line separated by one space. I expect the extra space after the curly brace in line two gone.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
kaicataldocommented, Jul 13, 2017

Ah, I see. So currently, no-mixed-spaces-and-tabs only checks for leading whitespace on each line, but doesn’t anything after that. In that case, yes, this is really a feature request - either making a new rule that checks this or enhancing no-mixed-spaces-and-tabs with an option that would check this.

1reaction
bardwarecommented, Jun 10, 2017

Is your code block the input, or the output?

The input! I updated my issue to also contain the output. They differ in the position of the comma. White spaces are identical.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to allow space in function parameter? - python
Python's syntax requires a keyword argument to be a valid identifier, which does not permit whitespace. You'll need to unpack an explicit ...
Read more >
Chapter 7. Object arguments: functions working with objects
Just as passing objects to functions as arguments is an efficient way of moving information to where it's needed, so is using objects...
Read more >
How to pass argument with spaces to a shell script function?
Closed 8 years ago. I'm trying to pass multiple argument to a function, but one of them is consist of two words and...
Read more >
Five Python function parameters you should know and use
Solution: Don't pass any argument. The first parameter, named “sep”, has a default value of None. And when it has a value of...
Read more >
Parsing arguments and building values — Python 3.11.1 ...
where object is the Python object to be converted and address is the void* argument that was passed to the PyArg_Parse* function. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found