Roots Discourse

Excluding eslint rule from package.json


#1

I have succesfully excluded some stylelint rules before by adding this to my theme’s package.json file:

  ...
  "stylelint": {
    "extends": "stylelint-config-standard",
    "rules": {
      "no-empty-source": null
    }
  },
  ...

I’m trying to do the same as I have a function in my common.js route that is called from a wp plugin (and not from my own script).

I tried adding this to my package.json file:

  "eslintConfig": {
    "extends": "eslint:recommended",
    "rules": {
      "no-unused-vars": "off"
    }
  },

Also tried the above with eslint instead of eslintConfig.

And I added eslint comment to my function:

var myfunction = function() {
      console.log('Hello World!');
    }; // eslint-disable-line no-unused-vars

But none of the above works, my .js keeps from compiling. Any thoughts?


#2

wrong file i think? have you tried this one? https://github.com/roots/sage/blob/master/.eslintrc.js