Skip to content

Commit

Permalink
Merge e20b53d into a23cf25
Browse files Browse the repository at this point in the history
  • Loading branch information
KamiKillertO committed May 17, 2019
2 parents a23cf25 + e20b53d commit 3c76b5e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 1 addition & 3 deletions lib/config.js
@@ -1,5 +1,4 @@
const lodash = require("lodash");
const Issue = require("./issue");
const { isBool } = require("./validate_option");

/**
Expand Down Expand Up @@ -154,8 +153,7 @@ Config.prototype.initOptions = function(opts) {
Object.keys(opts).forEach(
function(name) {
if (!(name in this.options)) {
issues.push(new Issue("E054", [0, 0], { name: name }));
return;
throw new Error(`Rule "${name}" does not exist`);
}
var value = opts[name];
if (value !== false) {
Expand Down
7 changes: 4 additions & 3 deletions test/unit/linter.js
Expand Up @@ -43,9 +43,10 @@ describe("linter", function() {
}
]);

it("should output an issue when given a nonexistent option", async function() {
const issues = await linter.lint("f\nfff", { nonopt: 7 }, "nodefault");
expect(issues).to.have.length(1);
it("Should throw an error when given a nonexistent option", function() {
expect(() => linter.lint("f\nfff", { nonopt: 7 }, "nodefault"))
.to
.throw(`Rule "nonopt" does not exist`);
});

it("should return correct line and column numbers", async function() {
Expand Down

0 comments on commit 3c76b5e

Please sign in to comment.