Skip to content

Commit

Permalink
disable fix for namespace exports including types
Browse files Browse the repository at this point in the history
  • Loading branch information
spalger committed Sep 1, 2021
1 parent be40b32 commit 92b7951
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions packages/kbn-eslint-plugin-eslint/rules/no_export_all.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ module.exports = {
};

const exportSet = getExportNamesDeep(parser, context.getFilename(), tsnode);
const isTypeExport = esNode.exportKind === 'type';
const isNamespaceExportWithTypes =
tsnode.exportClause &&
ts.isNamespaceExport(tsnode.exportClause) &&
(isTypeExport || exportSet.types.size);

/** @param {Fixer} fixer */
const fix = (fixer) => {
const source = /** @type EsTreeStringLiteral */ (esNode.source);
const isTypeExport = esNode.exportKind === 'type';

if (tsnode.exportClause && ts.isNamespaceExport(tsnode.exportClause)) {
if (isTypeExport || exportSet.types.size) {
throw new Error('unable to automatically fix namespace exports of types');
}

return fixer.replaceText(
node,
getExportNamedNamespaceCode(
Expand All @@ -76,7 +76,7 @@ module.exports = {
context.report({
message: ERROR_MSG,
loc: node.loc,
fix: exportSet?.size ? fix : undefined,
fix: exportSet?.size && !isNamespaceExportWithTypes ? fix : undefined,
});
},
};
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/timelines/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { createContext } from 'react';

/* eslint-disable @kbn/eslint/no_export_all */

import { createContext } from 'react';

import { PluginInitializerContext } from '../../../../src/core/public';

import { TimelinesPlugin } from './plugin';
Expand Down

0 comments on commit 92b7951

Please sign in to comment.