Skip to content

Instantly share code, notes, and snippets.

@tlhunter
Last active August 16, 2017 17:34
Show Gist options
  • Save tlhunter/94d672f8d77c180727b46a509ba94eff to your computer and use it in GitHub Desktop.
Save tlhunter/94d672f8d77c180727b46a509ba94eff to your computer and use it in GitHub Desktop.
/**
* Proposing a new rule for no-unused-vars.args
* See http://eslint.org/docs/rules/no-unused-vars#args
* It would behave similar to after-used, except arguments with `error` sounding names should cause errors if ignored
* Configuring this manually with an array would be great
*/
/*eslint no-unused-vars: ["error", { "args": "after-used-and-errors", "errors": ["e", "err", "error"] }]*/
asyncWork((err, data) => { // e.g. args: all
// In this case I want eslint to error as I'm not handling my error
data.xyz = true;
callback(null, data);
});
asyncWork((err, ignorable, data) => {
// Ignoring `ignorable` should be okay
if (err) {
return callback(err);
}
data.xyz = true;
callback(null, data);
});
function somethingSync(ignorable, realData) { // e.g. args: after-used
// Here I don't want eslint to error, I need to ignore `ignorable` to get to realData
return realData++;
}
@tlhunter
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment