Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

[resolver] use webpack-resolver for core logic #15

Merged
merged 18 commits into from
Jun 1, 2017
Merged

[resolver] use webpack-resolver for core logic #15

merged 18 commits into from
Jun 1, 2017

Conversation

spalger
Copy link
Contributor

@spalger spalger commented May 31, 2017

This PR removes the custom resolver logic and instead wraps the eslint-import-resolver-webpack module, feeding it a custom configuration so that the resolver behaves like Kibana's internal version of webpack.

This also adds three settings:

  • rootPackageName: the name of the package that should be considered the "root" package, useful for packages like Kibana which contain multiple packages so that a file like src/core_plugins/console/index.js resolves as a child of kibana rather than the console plugin package.
  • pluginPaths: an array of paths to plugin folders
  • pluginDirs: an array of paths (relative to the project root) that contain multiple plugin folders

@w33ble w33ble self-assigned this May 31, 2017
index.js Outdated
pluginPaths: [],
pluginDirs: [
'../kibana/plugins',
'../kibana/core_plugins',
Copy link
Contributor

@w33ble w33ble Jun 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path is wrong, it's kibana/src/core_plugins

index.js Outdated
const matches = glob.sync(globPattern, globOptions);
debug(`checking in ${checkPath}, matched ${matches.length}`);
const getRootPackageDir = (dir) => {
const pkgFile = pkgUp.sync(dir);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need pkgUp for this? We're basically already doing what it is doing in this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Start at the path and recursively look for package.json files that match the rootPackageName or just exist if there isn't a rootPackageName.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose you're right, we kinda don't...

index.js Outdated
};

/*
* Resolves the path to Kibana, either from default setting or config
*/
function getKibanaPath(config, file, rootPath) {
function getKibanaPath(config, rootPath) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename rootPath to projectRoot?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants