Skip to content

Commit

Permalink
Docs: add about RuleTester's parser to migration guide (fixes #11728) (
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea authored and ilyavolodin committed May 25, 2019
1 parent 1374be4 commit 45bd336
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/user-guide/migrating-to-6.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The lists below are ordered roughly by the number of users each change is expect

1. [Plugin authors may need to update installation instructions](#plugin-documentation)
1. [`RuleTester` now validates against invalid `default` keywords in rule schemas](#rule-tester-defaults)
1. [`RuleTester` now requires an absolute path on `parser` option](#rule-tester-parser)
1. [The `eslintExplicitGlobalComment` scope analysis property has been removed](#eslintExplicitGlobalComment)

### Breaking changes for integration developers
Expand Down Expand Up @@ -283,6 +284,14 @@ In some cases, rule schemas can use the `default` keyword to automatically speci

**Related issue(s):** [eslint/eslint#11473](https://github.com/eslint/eslint/issues/11473)

## <a name="rule-tester-parser"></a> `RuleTester` now requires an absolute path on `parser` option

To use custom parsers in tests, we could use `parser` property with a package name or file path. However, if a package name was given, it's unclear where the tester should load the parser package from because the tester doesn't know which files are running the tester. In ESLint v6.0.0, `RuleTester` disallows `parser` property with a package name.

**To address:** If you use `parser` property with package names in test cases, update it with `require.resolve()` function to resolve the package name to the absolute path to the package.

**Related issue(s):** [eslint/eslint#11728](https://github.com/eslint/eslint/issues/11728), [eslint/eslint#10125](https://github.com/eslint/eslint/issues/10125), [eslint/rfcs#7](https://github.com/eslint/rfcs/pull/7)

## <a name="eslintExplicitGlobalComment"></a> The `eslintExplicitGlobalComment` scope analysis property has been removed

Previously, ESLint would add an `eslintExplicitGlobalComment` property to `Variable` objects in scope analysis to indicate that a variable was introduced as a result of a `/* global */` comment. This property was undocumented, and the ESLint team was unable to find any usage of the property outside of ESLint core. The property has been removed in ESLint v6, and replaced with the `eslintExplicitGlobalComments` property, which can contain a list of all `/* global */` comments if a variable was declared with more than one of them.
Expand Down

0 comments on commit 45bd336

Please sign in to comment.