Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

space-unary-ops allow space for words #44

Open
swashata opened this issue Mar 16, 2018 · 0 comments
Open

space-unary-ops allow space for words #44

swashata opened this issue Mar 16, 2018 · 0 comments

Comments

@swashata
Copy link
Contributor

Right now with the space-unary-ops settings, unary words like yield throw error saying

file: 'file:///Volumes/Development/vagrant/www/es6/public_html/wesbos-js-es6/16%20-%20Generators/indes.js'
severity: 'Error'
message: 'Unexpected space after unary word operator 'yield'. (space-unary-ops)'
at: '2,2'
source: 'eslint'
code: 'space-unary-ops'

Example code:

function* listPeople() {
	yield 'Swas';
	yield 'Sonali';
	const myArray = new Array( 1, 2, 3 );
}

Strangely, it doesn't throw error for line 4 with const myArray = new Array( 1, 2, 3 );.

Overriding the space-unary-ops rule like this

        "space-unary-ops": [
            'error', {
                "words": true,
                "nonwords": false,
                "overrides": {
                    "!": true
                }
            }
        ]

does solve the problem. Should we go ahead and implement that?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant