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

space-unary-ops allow space for words #44

Open
@swashata

Description

@swashata

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions