Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New: Plugin Loading Improvement #47

Merged
merged 7 commits into from
Dec 14, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix implementation description
  • Loading branch information
mysticatea committed Nov 19, 2019
commit 9a224dd5ac6a030a5e40526d73574738bd3f2d43
2 changes: 1 addition & 1 deletion designs/2019-plugin-loading-improvement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ If the plugins of the personal config conflict with `--plugin` option or somethi
The implementation will be simple.

- Modify [ConfigArrayFactory](https://github.com/eslint/eslint/blob/62623f9f611a3adb79696304760a2fd14be8afbc/lib/cli-engine/config-array-factory.js) to load plugins relatively `basePath`. If `resolvePluginsRelativeTo` constructor option is present, it ignores the `basePath` and loads from the `resolvePluginsRelativeTo`. The `basePath` is:
- `options.basePath` if the `create(data, options)` method is called. Defaults to `cwd`.
- the directory of `options.filePath` if the `create(data, options)` method is called. It's `cwd` if `options.filePath` is not present.
- the directory of `filePath` if the `loadFile(filePath, options)` method is called.
- the `directoryPath` if the `loadInDirectory(directoryPath, options)` method is called.
- Modify [the `mergePlugins` function in ConfigArray](https://github.com/eslint/eslint/blob/62623f9f611a3adb79696304760a2fd14be8afbc/lib/cli-engine/config-array/config-array.js#L163) to throw a clear error if a plugin conflict was found. The conflict is `sourceValue.filePath !== targetValue.filePath`. Both `sourceValue` and `targetValue` are [ConfigDependency](https://github.com/eslint/eslint/blob/62623f9f611a3adb79696304760a2fd14be8afbc/lib/cli-engine/config-array/config-dependency.js) objects, so the error object can have the importer's info as the template data easily.
Expand Down