ESLint: Enable rule no-named-as-default (#10879)

* Enable rule no-named-as-default

* Fix wrong import
This commit is contained in:
Kamil Gabryjelski 2020-09-18 22:41:01 +02:00 committed by GitHub
parent 91fd06e093
commit 557a303cc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 21 additions and 33 deletions

View File

@ -86,7 +86,6 @@ module.exports = {
'.json': 'always', '.json': 'always',
}, },
], ],
'import/no-named-as-default': 0,
'import/no-named-as-default-member': 0, 'import/no-named-as-default-member': 0,
'import/prefer-default-export': 0, 'import/prefer-default-export': 0,
indent: 0, indent: 0,
@ -200,7 +199,6 @@ module.exports = {
}, },
], ],
'import/no-cycle': 0, // re-enable up for discussion, might require some major refactors 'import/no-cycle': 0, // re-enable up for discussion, might require some major refactors
'import/no-named-as-default': 0,
'import/prefer-default-export': 0, 'import/prefer-default-export': 0,
indent: 0, indent: 0,
'jsx-a11y/anchor-is-valid': 0, // disabled temporarily 'jsx-a11y/anchor-is-valid': 0, // disabled temporarily

View File

@ -25,7 +25,7 @@ import { shallow } from 'enzyme';
import getInitialState from 'src/explore/reducers/getInitialState'; import getInitialState from 'src/explore/reducers/getInitialState';
import ExploreViewContainer from 'src/explore/components/ExploreViewContainer'; import ExploreViewContainer from 'src/explore/components/ExploreViewContainer';
import QueryAndSaveBtns from 'src/explore/components/QueryAndSaveBtns'; import QueryAndSaveBtns from 'src/explore/components/QueryAndSaveBtns';
import ControlPanelsContainer from 'src/explore/components/ControlPanelsContainer'; import ConnectedControlPanelsContainer from 'src/explore/components/ControlPanelsContainer';
import ChartContainer from 'src/explore/components/ExploreChartPanel'; import ChartContainer from 'src/explore/components/ExploreChartPanel';
import * as featureFlags from 'src/featureFlags'; import * as featureFlags from 'src/featureFlags';
@ -72,7 +72,7 @@ describe('ExploreViewContainer', () => {
}); });
it('renders ControlPanelsContainer', () => { it('renders ControlPanelsContainer', () => {
expect(wrapper.find(ControlPanelsContainer)).toExist(); expect(wrapper.find(ConnectedControlPanelsContainer)).toExist();
}); });
it('renders ChartContainer', () => { it('renders ChartContainer', () => {

View File

@ -25,7 +25,7 @@ import {
} from 'src/SqlLab/constants'; } from 'src/SqlLab/constants';
import AceEditorWrapper from 'src/SqlLab/components/AceEditorWrapper'; import AceEditorWrapper from 'src/SqlLab/components/AceEditorWrapper';
import LimitControl from 'src/SqlLab/components/LimitControl'; import LimitControl from 'src/SqlLab/components/LimitControl';
import SouthPane from 'src/SqlLab/components/SouthPane'; import ConnectedSouthPane from 'src/SqlLab/components/SouthPane';
import SqlEditor from 'src/SqlLab/components/SqlEditor'; import SqlEditor from 'src/SqlLab/components/SqlEditor';
import SqlEditorLeftBar from 'src/SqlLab/components/SqlEditorLeftBar'; import SqlEditorLeftBar from 'src/SqlLab/components/SqlEditorLeftBar';
@ -64,15 +64,15 @@ describe('SqlEditor', () => {
const wrapper = shallow(<SqlEditor {...mockedProps} />); const wrapper = shallow(<SqlEditor {...mockedProps} />);
expect(wrapper.find(AceEditorWrapper)).toExist(); expect(wrapper.find(AceEditorWrapper)).toExist();
}); });
it('render an SouthPane', () => { it('render a SouthPane', () => {
const wrapper = shallow(<SqlEditor {...mockedProps} />); const wrapper = shallow(<SqlEditor {...mockedProps} />);
expect(wrapper.find(SouthPane)).toExist(); expect(wrapper.find(ConnectedSouthPane)).toExist();
}); });
it('does not overflow the editor window', () => { it('does not overflow the editor window', () => {
const wrapper = shallow(<SqlEditor {...mockedProps} />); const wrapper = shallow(<SqlEditor {...mockedProps} />);
const totalSize = const totalSize =
parseFloat(wrapper.find(AceEditorWrapper).props().height) + parseFloat(wrapper.find(AceEditorWrapper).props().height) +
wrapper.find(SouthPane).props().height + wrapper.find(ConnectedSouthPane).props().height +
SQL_TOOLBAR_HEIGHT + SQL_TOOLBAR_HEIGHT +
SQL_EDITOR_GUTTER_MARGIN * 2 + SQL_EDITOR_GUTTER_MARGIN * 2 +
SQL_EDITOR_GUTTER_HEIGHT; SQL_EDITOR_GUTTER_HEIGHT;
@ -83,7 +83,7 @@ describe('SqlEditor', () => {
wrapper.setState({ height: 450 }); wrapper.setState({ height: 450 });
const totalSize = const totalSize =
parseFloat(wrapper.find(AceEditorWrapper).props().height) + parseFloat(wrapper.find(AceEditorWrapper).props().height) +
wrapper.find(SouthPane).props().height + wrapper.find(ConnectedSouthPane).props().height +
SQL_TOOLBAR_HEIGHT + SQL_TOOLBAR_HEIGHT +
SQL_EDITOR_GUTTER_MARGIN * 2 + SQL_EDITOR_GUTTER_MARGIN * 2 +
SQL_EDITOR_GUTTER_HEIGHT; SQL_EDITOR_GUTTER_HEIGHT;

View File

@ -169,5 +169,4 @@ function mapDispatchToProps(dispatch) {
}; };
} }
export { App };
export default connect(mapStateToProps, mapDispatchToProps)(App); export default connect(mapStateToProps, mapDispatchToProps)(App);

View File

@ -128,7 +128,6 @@ function mapDispatchToProps(dispatch) {
}; };
} }
export { ExploreCtasResultsButton };
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps, mapDispatchToProps,

View File

@ -253,7 +253,6 @@ function mapDispatchToProps(dispatch) {
}; };
} }
export { ExploreResultsButton };
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps, mapDispatchToProps,

View File

@ -40,7 +40,7 @@ import Hotkeys from 'src/components/Hotkeys';
import LimitControl from './LimitControl'; import LimitControl from './LimitControl';
import TemplateParamsEditor from './TemplateParamsEditor'; import TemplateParamsEditor from './TemplateParamsEditor';
import SouthPane from './SouthPane'; import ConnectedSouthPane from './SouthPane';
import SaveQuery from './SaveQuery'; import SaveQuery from './SaveQuery';
import ScheduleQueryButton from './ScheduleQueryButton'; import ScheduleQueryButton from './ScheduleQueryButton';
import EstimateQueryCostButton from './EstimateQueryCostButton'; import EstimateQueryCostButton from './EstimateQueryCostButton';
@ -389,7 +389,7 @@ class SqlEditor extends React.PureComponent {
/> />
{this.renderEditorBottomBar(hotkeys)} {this.renderEditorBottomBar(hotkeys)}
</div> </div>
<SouthPane <ConnectedSouthPane
editorQueries={this.props.editorQueries} editorQueries={this.props.editorQueries}
latestQueryId={this.props.latestQuery && this.props.latestQuery.id} latestQueryId={this.props.latestQuery && this.props.latestQuery.id}
dataPreviewQueries={this.props.dataPreviewQueries} dataPreviewQueries={this.props.dataPreviewQueries}

View File

@ -439,6 +439,4 @@ function mapDispatchToProps(dispatch) {
}; };
} }
export { TabbedSqlEditors };
export default connect(mapStateToProps, mapDispatchToProps)(TabbedSqlEditors); export default connect(mapStateToProps, mapDispatchToProps)(TabbedSqlEditors);

View File

@ -246,7 +246,7 @@ const defaultProps = {
onChange: () => {}, onChange: () => {},
}; };
export class DatasourceEditor extends React.PureComponent { class DatasourceEditor extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {

View File

@ -23,7 +23,7 @@ import { t } from '@superset-ui/core';
import URLShortLinkButton from '../../components/URLShortLinkButton'; import URLShortLinkButton from '../../components/URLShortLinkButton';
import EmbedCodeButton from './EmbedCodeButton'; import EmbedCodeButton from './EmbedCodeButton';
import DisplayQueryButton from './DisplayQueryButton'; import ConnectedDisplayQueryButton from './DisplayQueryButton';
import { exportChart, getExploreLongUrl } from '../exploreUtils'; import { exportChart, getExploreLongUrl } from '../exploreUtils';
const propTypes = { const propTypes = {
@ -100,7 +100,7 @@ export default function ExploreActionButtons({
<i className="fa fa-file-text-o" /> .csv <i className="fa fa-file-text-o" /> .csv
</a> </a>
)} )}
<DisplayQueryButton <ConnectedDisplayQueryButton
chartHeight={chartHeight} chartHeight={chartHeight}
queryResponse={queryResponse} queryResponse={queryResponse}
latestQueryFormData={latestQueryFormData} latestQueryFormData={latestQueryFormData}

View File

@ -22,7 +22,7 @@ import { ParentSize } from '@vx/responsive';
import { styled } from '@superset-ui/core'; import { styled } from '@superset-ui/core';
import { chartPropShape } from '../../dashboard/util/propShapes'; import { chartPropShape } from '../../dashboard/util/propShapes';
import ChartContainer from '../../chart/ChartContainer'; import ChartContainer from '../../chart/ChartContainer';
import ExploreChartHeader from './ExploreChartHeader'; import ConnectedExploreChartHeader from './ExploreChartHeader';
const propTypes = { const propTypes = {
actions: PropTypes.object.isRequired, actions: PropTypes.object.isRequired,
@ -110,7 +110,7 @@ class ExploreChartPanel extends React.PureComponent {
} }
const header = ( const header = (
<ExploreChartHeader <ConnectedExploreChartHeader
actions={this.props.actions} actions={this.props.actions}
addHistory={this.props.addHistory} addHistory={this.props.addHistory}
can_overwrite={this.props.can_overwrite} can_overwrite={this.props.can_overwrite}

View File

@ -24,7 +24,7 @@ import { connect } from 'react-redux';
import { styled, logging, t } from '@superset-ui/core'; import { styled, logging, t } from '@superset-ui/core';
import ExploreChartPanel from './ExploreChartPanel'; import ExploreChartPanel from './ExploreChartPanel';
import ControlPanelsContainer from './ControlPanelsContainer'; import ConnectedControlPanelsContainer from './ControlPanelsContainer';
import SaveModal from './SaveModal'; import SaveModal from './SaveModal';
import QueryAndSaveBtns from './QueryAndSaveBtns'; import QueryAndSaveBtns from './QueryAndSaveBtns';
import { getExploreLongUrl } from '../exploreUtils'; import { getExploreLongUrl } from '../exploreUtils';
@ -352,7 +352,7 @@ class ExploreViewContainer extends React.Component {
errorMessage={this.renderErrorMessage()} errorMessage={this.renderErrorMessage()}
datasourceType={this.props.datasource_type} datasourceType={this.props.datasource_type}
/> />
<ControlPanelsContainer <ConnectedControlPanelsContainer
actions={this.props.actions} actions={this.props.actions}
form_data={this.props.form_data} form_data={this.props.form_data}
controls={this.props.controls} controls={this.props.controls}
@ -416,8 +416,6 @@ function mapDispatchToProps(dispatch) {
}; };
} }
export { ExploreViewContainer };
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps, mapDispatchToProps,

View File

@ -250,5 +250,4 @@ function mapStateToProps({ explore, saveModal }) {
}; };
} }
export { SaveModal };
export default connect(mapStateToProps, () => ({}))(SaveModal); export default connect(mapStateToProps, () => ({}))(SaveModal);

View File

@ -34,8 +34,9 @@ import SelectControl from './SelectControl';
import TextControl from './TextControl'; import TextControl from './TextControl';
import CheckboxControl from './CheckboxControl'; import CheckboxControl from './CheckboxControl';
import ANNOTATION_TYPES, { import {
ANNOTATION_SOURCE_TYPES, ANNOTATION_SOURCE_TYPES,
ANNOTATION_TYPES,
ANNOTATION_TYPES_METADATA, ANNOTATION_TYPES_METADATA,
DEFAULT_ANNOTATION_TYPE, DEFAULT_ANNOTATION_TYPE,
requiresQuery, requiresQuery,

View File

@ -501,4 +501,3 @@ export const controls = {
}), }),
}, },
}; };
export default controls;

View File

@ -19,7 +19,7 @@
/* eslint camelcase: 0 */ /* eslint camelcase: 0 */
import { getChartControlPanelRegistry } from '@superset-ui/core'; import { getChartControlPanelRegistry } from '@superset-ui/core';
import { getAllControlsState, getFormDataFromControls } from './controlUtils'; import { getAllControlsState, getFormDataFromControls } from './controlUtils';
import controls from './controls'; import { controls } from './controls';
function handleDeprecatedControls(formData) { function handleDeprecatedControls(formData) {
// Reacffectation / handling of deprecated controls // Reacffectation / handling of deprecated controls

View File

@ -77,5 +77,3 @@ export function applyNativeColumns(annotation) {
} }
return annotation; return annotation;
} }
export default ANNOTATION_TYPES;

View File

@ -19,7 +19,7 @@
import memoize from 'lodash/memoize'; import memoize from 'lodash/memoize';
import { getChartControlPanelRegistry } from '@superset-ui/core'; import { getChartControlPanelRegistry } from '@superset-ui/core';
import controls from '../explore/controls'; import { controls } from '../explore/controls';
const getControlsForVizType = memoize(vizType => { const getControlsForVizType = memoize(vizType => {
const controlsMap = {}; const controlsMap = {};

View File

@ -29,7 +29,7 @@ import FormLabel from 'src/components/FormLabel';
import DateFilterControl from 'src/explore/components/controls/DateFilterControl'; import DateFilterControl from 'src/explore/components/controls/DateFilterControl';
import ControlRow from 'src/explore/components/ControlRow'; import ControlRow from 'src/explore/components/ControlRow';
import Control from 'src/explore/components/Control'; import Control from 'src/explore/components/Control';
import controls from 'src/explore/controls'; import { controls } from 'src/explore/controls';
import { getExploreUrl } from 'src/explore/exploreUtils'; import { getExploreUrl } from 'src/explore/exploreUtils';
import OnPasteSelect from 'src/components/Select/OnPasteSelect'; import OnPasteSelect from 'src/components/Select/OnPasteSelect';
import { getDashboardFilterKey } from 'src/dashboard/util/getDashboardFilterKey'; import { getDashboardFilterKey } from 'src/dashboard/util/getDashboardFilterKey';