xojs / SublimeLinter-contrib-xo

SublimeLinter plugin for XO
https://github.com/xojs/xo
MIT License
55 stars 7 forks source link

xo config `globals` in package.json are ignored #17

Closed nstanard closed 3 years ago

nstanard commented 5 years ago

I've been trying to get this to work with my project but have been having a bit of a rough time. I finally got it linting files that I open in sublime but it seems rather slow. Is it linting just the file I have open or the entire directory tree?

The variables I defined in the globals area of my package.json file are ignored as well. Is there something I need to do to get the sublime package to look at each package.json file and use the globals/ignores/rules values?

package.json example:

...

    "xo": {
        "globals": [
            "angular",
            "Highcharts",
            "$",
            "jquery",
            "jQuery",
            "moment",
            "Raven"
        ],
        "ignores": [
            "vendor/",
            "src/app/global.js",
            "src/common/status-io/status-page.js",
            "config/webpack.conf.js",
            "src/index.js",
            "src/vendor.js",
            "src/common/jvectormap-2.0.3-fork/jvectormap-2.0.3-fork.js",
            "src/test/_register.js",
            "src/common/jvectormap-2.0.3-fork/",
            "src/common/image-preview/image-preview.js"
        ],
        "rules": {
            "import/no-unassigned-import": 0,
            "no-var": 0,
            "func-names": 0,
            "no-unused-vars": 0,
            "import/extensions": 0,
            "import/order": 0,
            "default-case": 0,
            "no-negated-condition": 0,
            "no-undef": 0,
            "prefer-spread": 0,
            "max-params": 0,
            "new-cap": 0,
            "eqeqeq": 0,
            "unicorn/explicit-length-check": 0,
            "no-unused-expressions": 0,
            "func-name-matching": 0,
            "no-useless-concat": 0,
            "no-mixed-operators": 0,
            "no-useless-escape": 0,
            "camelcase": 0,
            "no-eq-null": 0,
            "no-case-declarations": 0,
            "no-prototype-builtins": 0,
            "no-script-url": 0,
            "unicorn/prefer-starts-ends-with": 0,
            "unicorn/filename-case": 0,
            "array-callback-return": 0,
            "operator-assignment": 0,
            "no-return-assign": 0,
            "no-inner-declarations": 0,
            "no-multi-assign": 0,
            "no-self-compare": 0,
            "prefer-const": 0,
            "prefer-rest-params": 0,
            "no-extend-native": 0
        }
    }

...

Sublime Linter Settings:

{
    "linters": {
        "xo": {
            "working_dir": "${folder:$PATH_ENV_VARIABLE}",
            "lint_mode": "load_save",
            "selector": "source.js"
        }
    }
}
dersimn commented 3 years ago

Same.

I'm trying to figure out why, but it seems that when passing code to xo via --stdin it ignores most of the configurations made by package.json, but respects defined rules.