Disable no-unused-vars For Unused Parameter

December 20, 2017

no-unused-vars check for variables that are declared and not used anywhere in the code.

Sometimes you have a function parameter which are not used, but you don’t want to remove those.

You can use { “args”: “none” } for such cases.

axios({
  method: 'post',
  url: '/intents/login',
  data: {
    'username': 'test',
    'password': '1234',
  },
})
  /* eslint no-unused-vars: ["error", { "args": "none" }] */
  .then((response) => {
    alert('ok')
  })
  .catch((error) => {
    alert(error.message)
  })

You can also edit .eslintrc.js file in your project directory for global disable.

module.exports = {
  ...
  // add your custom rules here
  'rules': {
    'no-unused-vars': ['error', { "args": "none" }],
  }
}
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.