diff --git a/conf/default-config-options.js b/conf/default-config-options.js index 63d28c48b66..96fe25ce6f1 100644 --- a/conf/default-config-options.js +++ b/conf/default-config-options.js @@ -25,9 +25,5 @@ module.exports = deepFreeze({ rules: {}, settings: {}, parser: "espree", - parserOptions: { - ecmaVersion: 5, - sourceType: "script", - ecmaFeatures: {} - } + parserOptions: {} }); diff --git a/lib/linter.js b/lib/linter.js index 0b0d06a8663..d2f1f46574c 100755 --- a/lib/linter.js +++ b/lib/linter.js @@ -455,8 +455,8 @@ function normalizeEcmaVersion(ecmaVersion, isModule) { */ function prepareConfig(config, envContext) { config.globals = config.globals || {}; - const copiedRules = Object.assign({}, defaultConfig.rules); - let parserOptions = Object.assign({}, defaultConfig.parserOptions); + const copiedRules = {}; + let parserOptions = {}; if (typeof config.rules === "object") { Object.keys(config.rules).forEach(k => { diff --git a/tests/fixtures/parsers/throws-with-options.js b/tests/fixtures/parsers/throws-with-options.js new file mode 100644 index 00000000000..95857751a75 --- /dev/null +++ b/tests/fixtures/parsers/throws-with-options.js @@ -0,0 +1,10 @@ +"use strict"; + +const espree = require("espree"); + +exports.parse = (sourceText, options) => { + if (options.ecmaVersion) { + throw new Error("Expected no parserOptions to be used"); + } + return espree.parse(sourceText, options); +}; diff --git a/tests/lib/linter.js b/tests/lib/linter.js index 01eec7bba29..4acc46b3f02 100644 --- a/tests/lib/linter.js +++ b/tests/lib/linter.js @@ -3905,6 +3905,13 @@ describe("eslint", () => { assert.equal(messages[0].message, errorPrefix + require(parser).expectedError); }); + it("should not pass any default parserOptions to the parser", () => { + const parser = path.join(parserFixtures, "throws-with-options.js"); + + const messages = linter.verify(";", { parser }, "filename"); + + assert.strictEqual(messages.length, 0); + }); }); }