Skip to content

Extend global jshint.globals config, merge arrays#84

Open
appfeel wants to merge 1 commit intocfjedimaster:masterfrom
appfeel:master
Open

Extend global jshint.globals config, merge arrays#84
appfeel wants to merge 1 commit intocfjedimaster:masterfrom
appfeel:master

Conversation

@appfeel
Copy link
Copy Markdown

@appfeel appfeel commented Oct 1, 2015

When defined "extends": "jshint.globals" in .jshintrc, it will extend global configuration, not just override it.
Also it will merge array properties. Consider this situation:

brackets.son:

    "jshint.options": {
        "bitwise": true,
        "browser": true,
        "curly": true,
        "debug": true,
        "devel": true,
        "evil": true,
        "forin": true,
        "latedef": "nofunc",
        "node": true,
        "nomen": true,
        "nonbsp": true,
        "nonew": true,
        "undef": true,
        "unused": true,
        "predef": [ "angular", "ionic" ]
    },

.jshintrc:

{
    "extends": "jshint.globals",
    "predef": ["analytics", "admob"]
}

The result configuration will be:

{
    "bitwise": true,
    "browser": true,
    "curly": true,
    "debug": true,
    "devel": true,
    "evil": true,
    "forin": true,
    "latedef": "nofunc",
    "node": true,
    "nomen": true,
    "nonbsp": true,
    "nonew": true,
    "undef": true,
    "unused": true,
    "predef": [ "angular", "ionic", "analytics", "admob" ]
}

When defined `"extends": "jshint.globals"` in .jshintrc, it will extend global configuration, not just override it.
Also it will merge array properties. Consider this situation:

brackets.son:
```json
    "jshint.options": {
        "bitwise": true,
        "browser": true,
        "curly": true,
        "debug": true,
        "devel": true,
        "evil": true,
        "forin": true,
        "latedef": "nofunc",
        "node": true,
        "nomen": true,
        "nonbsp": true,
        "nonew": true,
        "undef": true,
        "unused": true,
        "predef": [ "angular", "ionic" ]
    },
```

.jshintrc:
```json
{
    "extends": "jshint.globals",
    "predef": ["analytics", "admob"]
}
```

The result configuration will be:
```json
{
    "bitwise": true,
    "browser": true,
    "curly": true,
    "debug": true,
    "devel": true,
    "evil": true,
    "forin": true,
    "latedef": "nofunc",
    "node": true,
    "nomen": true,
    "nonbsp": true,
    "nonew": true,
    "undef": true,
    "unused": true,
    "predef": [ "angular", "ionic", "analytics", "admob" ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant