From 45bd336e647a6fa8a502488e5cbd27ba02712083 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sun, 26 May 2019 04:06:50 +0900 Subject: [PATCH] Docs: add about RuleTester's parser to migration guide (fixes #11728) (#11761) --- docs/user-guide/migrating-to-6.0.0.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/user-guide/migrating-to-6.0.0.md b/docs/user-guide/migrating-to-6.0.0.md index 955b5b83882..1d401fb1bfe 100644 --- a/docs/user-guide/migrating-to-6.0.0.md +++ b/docs/user-guide/migrating-to-6.0.0.md @@ -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 @@ -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) +## `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) + ## 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.