Skip to content

Commit b2b2530

Browse files
boktorbbkavilla
authored andcommitted
Renames kbn-eslint-import-resolver-kibana to osd-eslint-import-resolver-opensearch-dashboards (#37) (#45)
Signed-off-by: Bishoy Boktor <boktorbb@amazon.com>
1 parent 435b174 commit b2b2530

12 files changed

+40
-40
lines changed

packages/kbn-eslint-import-resolver-kibana/README.md packages/osd-eslint-import-resolver-opensearch-dashboards/README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# @kbn/eslint-import-resolver-kibana
1+
# @osd/eslint-import-resolver-opensearch-dashboards
22

3-
Resolver for Kibana imports, meant to be used with [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import).
3+
Resolver for OpenSearch Dashboards imports, meant to be used with [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import).
44

55
## Installation
66

7-
To install this utility use `yarn` to link to the package from the Kibana project:
7+
To install this utility use `yarn` to link to the package from the OpenSearch Dashboards project:
88

99
```sh
10-
yarn add --dev link:../../kibana/packages/kbn-eslint-import-resolver-kibana
10+
yarn add --dev link:../../opensearchDashboards/packages/osd-eslint-import-resolver-opensearch-dashboards
1111
```
1212

1313
## Usage
@@ -17,7 +17,7 @@ Specify this resolver with the `import/resolver` setting in your eslint config f
1717
```yml
1818
# .eslintrc.yml
1919
settings:
20-
import/resolver: "@kbn/eslint-import-resolver-kibana"
20+
import/resolver: "@osd/eslint-import-resolver-opensearch-dashboards"
2121
```
2222
2323
## Settings
@@ -27,9 +27,9 @@ settings:
2727
Property | Default | Description
2828
-------- | ------- | -----------
2929
rootPackageName | `null` | The `"name"` property of the root `package.json` file. If your project has multiple `package.json` files then specify this setting to tell the resolver which `package.json` file sits at the root of your project.
30-
pluginPaths | `[]` if `rootPackageName` is set, otherwise `[.]` | Array of relative paths which contain a Kibana plugin. Plugins must contain a `package.json` file to be valid.
31-
pluginDirs | `[]` | Array of relative paths pointing to directories which contain Kibana plugins. Plugins must contain a `package.json` file to be valid.
32-
pluginMap | `{}` | A map of plugin ids to relative paths, explicitly pointing to the location where Kibana should map `plugin/{pluginId}` import statements. Directories do not need to contain a `package.json` file to work.
30+
pluginPaths | `[]` if `rootPackageName` is set, otherwise `[.]` | Array of relative paths which contain a OpenSearch Dashboards plugin. Plugins must contain a `package.json` file to be valid.
31+
pluginDirs | `[]` | Array of relative paths pointing to directories which contain OpenSearch Dashboards plugins. Plugins must contain a `package.json` file to be valid.
32+
pluginMap | `{}` | A map of plugin ids to relative paths, explicitly pointing to the location where OpenSearch Dashboards should map `plugin/{pluginId}` import statements. Directories do not need to contain a `package.json` file to work.
3333

3434
## Settings Usage
3535
To specify additional config add a `:` after the resolver name and specify the argument as key-value pairs:
@@ -38,7 +38,7 @@ To specify additional config add a `:` after the resolver name and specify the a
3838
# .eslintrc.yml
3939
settings:
4040
import/resolver:
41-
"@kbn/eslint-import-resolver-kibana":
41+
"@osd/eslint-import-resolver-opensearch-dashboards":
4242
# if your project has multiple package.json files
4343
rootPackageName: my-project
4444
@@ -51,7 +51,7 @@ settings:
5151
# if all of your plugins have the same parent directory you can specify
5252
# that directory and we will look for plugins there
5353
pluginDirs:
54-
- ./kibana-plugins
54+
- ./opensearch-dashboards-plugins
5555

5656
# if you have some other special configuration supply a map of plugin
5757
# ids to the directory containing their code
@@ -64,6 +64,6 @@ See [the resolvers docs](https://github.com/benmosher/eslint-plugin-import#resol
6464
6565
## Debugging
6666
67-
For debugging output from this resolver, run your linter with `DEBUG=eslint-plugin-import:resolver:kibana`.
67+
For debugging output from this resolver, run your linter with `DEBUG=eslint-plugin-import:resolver:opensearchDashboards`.
6868

6969
This resolver defers to [*eslint-import-resolver-node*](https://www.npmjs.com/package/eslint-import-resolver-node) and [*eslint-import-resolver-webpack*](https://www.npmjs.com/package/eslint-import-resolver-webpack) for all of it's actual resolution logic. To get debugging output from all resolvers use `DEBUG=eslint-plugin-import:resolver:*`.

packages/kbn-eslint-import-resolver-kibana/import_resolver_kibana.js packages/osd-eslint-import-resolver-opensearch-dashboards/import_resolver_opensearch_dashboards.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const webpackResolver = require('eslint-import-resolver-webpack');
2323
const nodeResolver = require('eslint-import-resolver-node');
2424

2525
const {
26-
getKibanaPath,
26+
getOpenSearchDashboardsPath,
2727
getProjectRoot,
2828
getWebpackConfig,
2929
isFile,
@@ -39,8 +39,8 @@ function initContext(file, config) {
3939
}
4040

4141
const projectRoot = getProjectRoot(file, config);
42-
const kibanaPath = getKibanaPath(config, projectRoot);
43-
const webpackConfig = getWebpackConfig(kibanaPath, projectRoot, config);
42+
const opensearchDashboardsPath = getOpenSearchDashboardsPath(config, projectRoot);
43+
const webpackConfig = getWebpackConfig(opensearchDashboardsPath, projectRoot, config);
4444
const aliasEntries = Object.entries(webpackConfig.resolve.alias || {});
4545

4646
context = {
@@ -65,7 +65,7 @@ function tryNodeResolver(importRequest, file, config) {
6565
);
6666
}
6767

68-
exports.resolve = function resolveKibanaPath(importRequest, file, config) {
68+
exports.resolve = function resolveOpenSearchDashboardsPath(importRequest, file, config) {
6969
config = config || {};
7070

7171
if (config.forceNode) {

packages/kbn-eslint-import-resolver-kibana/lib/debug.js packages/osd-eslint-import-resolver-opensearch-dashboards/lib/debug.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
* under the License.
1818
*/
1919

20-
exports.debug = require('debug')('eslint-plugin-import:resolver:kibana');
20+
exports.debug = require('debug')('eslint-plugin-import:resolver:opensearchDashboards');

packages/kbn-eslint-import-resolver-kibana/lib/get_kibana_path.js packages/osd-eslint-import-resolver-opensearch-dashboards/lib/get_opensearch_dashboards_path.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,25 @@ const { debug } = require('./debug');
2424
const DEFAULT_PLUGIN_PATH = '../..';
2525

2626
/*
27-
* Resolves the path to Kibana, either from default setting or config
27+
* Resolves the path to OpenSearch Dashboards, either from default setting or config
2828
*/
29-
exports.getKibanaPath = function (config, projectRoot) {
30-
const inConfig = config != null && config.kibanaPath;
29+
exports.getOpenSearchDashboardsPath = function (config, projectRoot) {
30+
const inConfig = config != null && config.opensearchDashboardsPath;
3131

32-
// We only allow `.` in the config as we need it for Kibana itself
33-
if (inConfig && config.kibanaPath !== '.') {
32+
// We only allow `.` in the config as we need it for OpenSearch Dashboards itself
33+
if (inConfig && config.opensearchDashboardsPath !== '.') {
3434
throw new Error(
35-
'The `kibanaPath` option has been removed from `eslint-import-resolver-kibana`. ' +
36-
'During development your plugin must live in `./plugins/{pluginName}` ' +
37-
'inside the Kibana folder or `../kibana-extra/{pluginName}` ' +
38-
'relative to the Kibana folder to work with this package.'
35+
'The `opensearchDashboardsPath` option has been removed from `eslint-import-resolver-opensearch-dashboards`. ' +
36+
'During development your plugin must live in `./plugins/{pluginName}` ' +
37+
'inside the OpenSearch Dashboards folder or `../opensearch-dashboards-extra/{pluginName}` ' +
38+
'relative to the OpenSearch Dashboards folder to work with this package.'
3939
);
4040
}
4141

42-
const kibanaPath = inConfig
43-
? resolve(projectRoot, config.kibanaPath)
42+
const opensearchDashboardsPath = inConfig
43+
? resolve(projectRoot, config.opensearchDashboardsPath)
4444
: resolve(projectRoot, DEFAULT_PLUGIN_PATH);
4545

46-
debug(`Resolved Kibana path: ${kibanaPath}`);
47-
return kibanaPath;
46+
debug(`Resolved OpenSearch Dashboards path: ${opensearchDashboardsPath}`);
47+
return opensearchDashboardsPath;
4848
};

packages/kbn-eslint-import-resolver-kibana/lib/get_path_type.js packages/osd-eslint-import-resolver-opensearch-dashboards/lib/get_path_type.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const LRU = require('lru-cache');
2323

2424
const DIR = Symbol('dir');
2525
const FILE = Symbol('file');
26-
const cache = process.env.KIBANA_RESOLVER_HARD_CACHE ? new Map() : new LRU({ maxAge: 1000 });
26+
const cache = process.env.OPENSEARCH_DASHBOARDS_RESOLVER_HARD_CACHE ? new Map() : new LRU({ maxAge: 1000 });
2727

2828
function getPathType(path) {
2929
const cached = cache.get(path);

packages/kbn-eslint-import-resolver-kibana/lib/get_webpack_config.js packages/osd-eslint-import-resolver-opensearch-dashboards/lib/get_webpack_config.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@
1919

2020
const { resolve } = require('path');
2121

22-
exports.getWebpackConfig = function (kibanaPath) {
22+
exports.getWebpackConfig = function (opensearchDashboardsPath) {
2323
return {
24-
context: kibanaPath,
24+
context: opensearchDashboardsPath,
2525
resolve: {
2626
extensions: ['.js', '.json', '.ts', '.tsx'],
2727
mainFields: ['browser', 'main'],
28-
modules: ['node_modules', resolve(kibanaPath, 'node_modules')],
28+
modules: ['node_modules', resolve(opensearchDashboardsPath, 'node_modules')],
2929
alias: {
3030
// Dev defaults for test bundle https://github.com/elastic/kibana/blob/6998f074542e8c7b32955db159d15661aca253d7/src/core_plugins/tests_bundle/index.js#L73-L78
31-
fixtures: resolve(kibanaPath, 'src/fixtures'),
32-
test_utils: resolve(kibanaPath, 'src/test_utils/public'),
31+
fixtures: resolve(opensearchDashboardsPath, 'src/fixtures'),
32+
test_utils: resolve(opensearchDashboardsPath, 'src/test_utils/public'),
3333
},
3434
unsafeCache: true,
3535
},

packages/kbn-eslint-import-resolver-kibana/lib/index.js packages/osd-eslint-import-resolver-opensearch-dashboards/lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
module.exports = Object.assign(
2121
{},
22-
require('./get_kibana_path'),
22+
require('./get_opensearch_dashboards_path'),
2323
require('./get_project_root'),
2424
require('./get_webpack_config'),
2525
require('./get_path_type'),

packages/kbn-eslint-import-resolver-kibana/package.json packages/osd-eslint-import-resolver-opensearch-dashboards/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "@kbn/eslint-import-resolver-kibana",
3-
"description": "eslint-plugin-import resolver for Kibana",
2+
"name": "@osd/eslint-import-resolver-opensearch-dashboards",
3+
"description": "eslint-plugin-import resolver for OpenSearch Dashboards",
44
"private": true,
55
"version": "2.0.0",
6-
"main": "import_resolver_kibana.js",
6+
"main": "import_resolver_opensearch_dashboards.js",
77
"license": "Apache-2.0",
8-
"kibana": {
8+
"opensearchDashboards": {
99
"devOnly": true
1010
},
1111
"repository": {

0 commit comments

Comments
 (0)