Skip to content

Commit

Permalink
Breaking: remove deprecated experimentalObjectRestSpread option (#11420)
Browse files Browse the repository at this point in the history
  • Loading branch information
not-an-aardvark committed Apr 1, 2019
1 parent 19248e0 commit 2543f11
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 126 deletions.
4 changes: 0 additions & 4 deletions docs/user-guide/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ Here's an example `.eslintrc.json` file:

Setting parser options helps ESLint determine what is a parsing error. All language options are `false` by default.

### Deprecated

* `ecmaFeatures.experimentalObjectRestSpread` - enable support for the experimental [object rest/spread properties](https://github.com/tc39/proposal-object-rest-spread). This syntax has been supported in `ecmaVersion: 2018`. This option will be removed in the future.

## Specifying Parser

By default, ESLint uses [Espree](https://github.com/eslint/espree) as its parser. You can optionally specify that a different parser should be used in your configuration file so long as the parser meets the following requirements:
Expand Down
9 changes: 0 additions & 9 deletions lib/config/config-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,6 @@ function validateConfigSchema(config, source = null) {
if (Object.hasOwnProperty.call(config, "ecmaFeatures")) {
emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES");
}

if (
(config.parser || "espree") === "espree" &&
config.parserOptions &&
config.parserOptions.ecmaFeatures &&
config.parserOptions.ecmaFeatures.experimentalObjectRestSpread
) {
emitDeprecationWarning(source, "ESLINT_LEGACY_OBJECT_REST_SPREAD");
}
}

/**
Expand Down
10 changes: 0 additions & 10 deletions lib/linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,16 +336,6 @@ function resolveParserOptions(parserName, providedOptions, enabledEnvironments)

mergedParserOptions.ecmaVersion = normalizeEcmaVersion(mergedParserOptions.ecmaVersion, isModule);

// TODO: For backward compatibility. Will remove on v6.0.0.
if (
parserName === DEFAULT_PARSER_NAME &&
mergedParserOptions.ecmaFeatures &&
mergedParserOptions.ecmaFeatures.experimentalObjectRestSpread &&
(!mergedParserOptions.ecmaVersion || mergedParserOptions.ecmaVersion < 9)
) {
mergedParserOptions.ecmaVersion = 9;
}

return mergedParserOptions;
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

68 changes: 0 additions & 68 deletions tests/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -1397,74 +1397,6 @@ describe("Config", () => {
`The 'ecmaFeatures' config file property is deprecated, and has no effect. (found in "tests${path.sep}fixtures${path.sep}config-file${path.sep}ecma-features${path.sep}.eslintrc.yml")`
);
}));

it("should emit a deprecation warning if 'parserOptions.ecmaFeatures.experimentalObjectRestSpread' is given.", () => Promise.resolve()
.then(() => {
const cwd = path.resolve(__dirname, "../fixtures/config-file/experimental-object-rest-spread/basic/");
const config = new Config({ cwd }, linter);

config.getConfig("test.js");

// Wait for "warning" event.
return nextTick();
})
.then(() => {
assert.notStrictEqual(warning, null);
assert.strictEqual(
warning.message,
`The 'parserOptions.ecmaFeatures.experimentalObjectRestSpread' option is deprecated. Use 'parserOptions.ecmaVersion' instead. (found in "tests${path.sep}fixtures${path.sep}config-file${path.sep}experimental-object-rest-spread${path.sep}basic${path.sep}.eslintrc.yml")`
);
}));

it("should emit a deprecation warning if 'parserOptions.ecmaFeatures.experimentalObjectRestSpread' is given in a parent config.", () => Promise.resolve()
.then(() => {
const cwd = path.resolve(__dirname, "../fixtures/config-file/experimental-object-rest-spread/subdir/");
const config = new Config({ cwd }, linter);

config.getConfig("lib/test.js");

// Wait for "warning" event.
return nextTick();
})
.then(() => {
assert.notStrictEqual(warning, null);
assert.strictEqual(
warning.message,
`The 'parserOptions.ecmaFeatures.experimentalObjectRestSpread' option is deprecated. Use 'parserOptions.ecmaVersion' instead. (found in "tests${path.sep}fixtures${path.sep}config-file${path.sep}experimental-object-rest-spread${path.sep}subdir${path.sep}.eslintrc.yml")`
);
}));

it("should emit a deprecation warning if 'parserOptions.ecmaFeatures.experimentalObjectRestSpread' is given in a shareable config.", () => Promise.resolve()
.then(() => {
const cwd = path.resolve(__dirname, "../fixtures/config-file/experimental-object-rest-spread/extends/");
const config = new Config({ cwd }, linter);

config.getConfig("test.js");

// Wait for "warning" event.
return nextTick();
})
.then(() => {
assert.notStrictEqual(warning, null);
assert.strictEqual(
warning.message,
`The 'parserOptions.ecmaFeatures.experimentalObjectRestSpread' option is deprecated. Use 'parserOptions.ecmaVersion' instead. (found in "tests${path.sep}fixtures${path.sep}config-file${path.sep}experimental-object-rest-spread${path.sep}extends${path.sep}common.yml")`
);
}));

it("should NOT emit a deprecation warning even if 'parserOptions.ecmaFeatures.experimentalObjectRestSpread' is given, if parser is not espree.", () => Promise.resolve()
.then(() => {
const cwd = path.resolve(__dirname, "../fixtures/config-file/experimental-object-rest-spread/another-parser/");
const config = new Config({ cwd }, linter);

config.getConfig("test.js");

// Wait for "warning" event.
return nextTick();
})
.then(() => {
assert.strictEqual(warning, null);
}));
});
});

Expand Down
9 changes: 0 additions & 9 deletions tests/lib/linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3545,15 +3545,6 @@ describe("Linter", () => {
linter.verify("x", { rules: { "foo-bar-baz": "error" } });
assert(spy.calledOnce);
});

it("should parse ES2018 code for backward compatibility if 'parserOptions.ecmaFeatures.experimentalObjectRestSpread' is given.", () => {
const messages = linter.verify(
"async function* f() { let {a, ...rest} = { a, ...obj }; }",
{ parserOptions: { ecmaFeatures: { experimentalObjectRestSpread: true } } }
);

assert(messages.length === 0);
});
});

describe("context.getScope()", () => {
Expand Down

0 comments on commit 2543f11

Please sign in to comment.