Skip to content

Commit

Permalink
codemod
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkopycinski committed Nov 27, 2019
1 parent 1b953db commit 00857d3
Show file tree
Hide file tree
Showing 64 changed files with 66 additions and 66 deletions.
2 changes: 1 addition & 1 deletion packages/eslint-config-kibana/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = {

rules: {
'block-scoped-var': 'error',
camelcase: [ 'error', { properties: 'never' } ],
camelcase: [ 'error', { properties: 'never', allow: ['^UNSAFE_'] } ],
'comma-dangle': 'off',
'comma-spacing': ['error', { before: false, after: true }],
'comma-style': [ 'error', 'last' ],
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-kibana/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ module.exports = {
'@typescript-eslint/camelcase': ['error', {
'properties': 'never',
'ignoreDestructuring': true,
'allow': ['^[A-Z0-9_]+$']
'allow': ['^[A-Z0-9_]+$', '^UNSAFE_']
}],
'@typescript-eslint/class-name-casing': 'error',
'@typescript-eslint/explicit-member-accessibility': ['error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class GuideNav extends Component {
});
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
const currentRoute = nextProps.routes[1];
const nextRoute = this.props.getNextRoute(currentRoute.name);
const previousRoute = this.props.getPreviousRoute(currentRoute.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function mapDispatchToProps(dispatch) {
}

class GuideSandboxComponent extends Component {
componentWillMount() {
UNSAFE_componentWillMount() {
this.props.openSandbox();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class GuideSection extends Component {
this.props.openCodeViewer(this.props.source, this.props.title);
}

componentWillMount() {
UNSAFE_componentWillMount() {
this.props.registerSection(this.getId(), this.props.title);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-framework/doc_site/src/views/app_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class AppView extends Component {
});
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
// Only force the chrome to be hidden if we're navigating from a non-sandbox to a sandbox.
if (!this.props.isSandbox && nextProps.isSandbox) {
this.setState({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class FieldSelectUi extends Component {
this.loadFields(this.state.indexPatternId);
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (this.props.indexPatternId !== nextProps.indexPatternId) {
this.loadFields(nextProps.indexPatternId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class TutorialUi extends React.Component {
}
}

componentWillMount() {
UNSAFE_componentWillMount() {
this._isMounted = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class IndicesList extends Component {
this.pager = new Pager(props.indices.length, this.state.perPage, this.state.page);
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.indices.length !== this.props.indices.length) {
this.pager.setTotalItems(nextProps.indices.length);
this.resetPageTo0();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class StepIndexPattern extends Component {
this.lastQuery = null;
}

async componentWillMount() {
async UNSAFE_componentWillMount() {
this.fetchExistingIndexPatterns();
if (this.state.query) {
this.lastQuery = this.state.query;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class CreateIndexPatternWizard extends Component {
};
}

async componentWillMount() {
async UNSAFE_componentWillMount() {
this.fetchData();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class IndexedFieldsTable extends Component {
};
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.fields !== this.props.fields) {
this.setState({
fields: this.mapFields(nextProps.fields)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class ScriptedFieldsTable extends Component {
};
}

componentWillMount() {
UNSAFE_componentWillMount() {
this.fetchFields();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class SourceFiltersTable extends Component {
};
}

componentWillMount() {
UNSAFE_componentWillMount() {
this.updateFilters();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ export class Relationships extends Component {
};
}

componentWillMount() {
UNSAFE_componentWillMount() {
this.getRelationshipData();
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.savedObject.id !== this.props.savedObject.id) {
this.getRelationshipData();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class AdvancedSettings extends Component {
}, {});
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
const { config } = nextProps;
const { query } = this.state;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class Field extends PureComponent {
this.changeImageForm = null;
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
const { unsavedValue } = this.state;
const { type, value, defVal } = nextProps.setting;
const editableValue = this.getEditableValue(type, value, defVal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class TelemetryForm extends Component {
queryMatches: null,
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
const {
query
} = nextProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
} from '@elastic/eui';

export class CalculationAgg extends Component {
componentWillMount() {
UNSAFE_componentWillMount() {
if (!this.props.model.variables) {
this.props.onChange(
_.assign({}, this.props.model, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
import { FormattedMessage } from '@kbn/i18n/react';

export class MathAgg extends Component {
componentWillMount() {
UNSAFE_componentWillMount() {
if (!this.props.model.variables) {
this.props.onChange(
_.assign({}, this.props.model, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const RESTRICT_FIELDS = [KBN_FIELD_TYPES.NUMBER];
export class PercentileAgg extends Component {
// eslint-disable-line react/no-multi-comp

componentWillMount() {
UNSAFE_componentWillMount() {
if (!this.props.model.percentiles) {
this.props.onChange(
_.assign({}, this.props.model, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class GaugePanelConfigUi extends Component {
this.state = { selectedTab: 'data' };
}

componentWillMount() {
UNSAFE_componentWillMount() {
const { model } = this.props;
const parts = {};
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class MetricPanelConfig extends Component {
this.state = { selectedTab: 'data' };
}

componentWillMount() {
UNSAFE_componentWillMount() {
const { model } = this.props;
if (
!model.background_color_rules ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class TablePanelConfig extends Component {
this.state = { selectedTab: 'data' };
}

componentWillMount() {
UNSAFE_componentWillMount() {
const { model } = this.props;
const parts = {};
if (!model.bar_color_rules || (model.bar_color_rules && model.bar_color_rules.length === 0)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class TopNPanelConfig extends Component {
this.state = { selectedTab: 'data' };
}

componentWillMount() {
UNSAFE_componentWillMount() {
const { model } = this.props;
const parts = {};
if (!model.bar_color_rules || (model.bar_color_rules && model.bar_color_rules.length === 0)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const SPLIT_MODES = {
};

export class Split extends Component {
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
const { model } = nextProps;
if (model.split_mode === 'filters' && !model.split_filters) {
this.props.onChange({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { getDefaultQueryLanguage } from '../../lib/get_default_query_language';

import { QueryBarWrapper } from '../../query_bar_wrapper';
class TableSeriesConfigUI extends Component {
componentWillMount() {
UNSAFE_componentWillMount() {
const { model } = this.props;
if (!model.color_rules || (model.color_rules && model.color_rules.length === 0)) {
this.props.onChange({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class Gauge extends Component {
this.handleResize = this.handleResize.bind(this);
}

componentWillMount() {
UNSAFE_componentWillMount() {
const check = () => {
this.timeout = setTimeout(() => {
const newState = calculateCoordinates(this.inner, this.resize, this.state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class GaugeVis extends Component {
this.handleResize = this.handleResize.bind(this);
}

componentWillMount() {
UNSAFE_componentWillMount() {
const check = () => {
this.timeout = setTimeout(() => {
const newState = calculateCoordinates(this.inner, this.resize, this.state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class Metric extends Component {
this.handleResize = this.handleResize.bind(this);
}

componentWillMount() {
UNSAFE_componentWillMount() {
const check = () => {
this.timeout = setTimeout(() => {
const newState = calculateCoordinates(this.inner, this.resize, this.state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface Props {
}

export class ExitFullScreenButton extends PureComponent<Props> {
public componentWillMount() {
public UNSAFE_componentWillMount() {
chrome.setVisible(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class IndexPatternSelect extends Component<IndexPatternSelectProps> {
this.fetchSelectedIndexPattern(this.props.indexPatternId);
}

componentWillReceiveProps(nextProps: IndexPatternSelectProps) {
UNSAFE_componentWillReceiveProps(nextProps: IndexPatternSelectProps) {
if (nextProps.indexPatternId !== this.props.indexPatternId) {
this.fetchSelectedIndexPattern(nextProps.indexPatternId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class EmbeddablePanel extends React.Component<Props, State> {
}
}

public componentWillMount() {
public UNSAFE_componentWillMount() {
this.mounted = true;
const { embeddable } = this.props;
const { parent } = embeddable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ExitFullScreenButtonUi extends PureComponent<ExitFullScreenButtonProps> {
}
};

public componentWillMount() {
public UNSAFE_componentWillMount() {
document.addEventListener('keydown', this.onKeyDown, false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class TableListView extends React.Component<TableListViewProps, TableListViewSta
};
}

componentWillMount() {
UNSAFE_componentWillMount() {
this._isMounted = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CodeEditor extends Component<
setValue(defaultValue || '');
}

public componentWillReceiveProps(nextProps: ComponentProps) {
public UNSAFE_componentWillReceiveProps(nextProps: ComponentProps) {
if (nextProps.isFormSubmitted()) {
this.showError();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class FieldText extends Component<
}
}

public componentWillReceiveProps(nextProps: ComponentProps) {
public UNSAFE_componentWillReceiveProps(nextProps: ComponentProps) {
if (nextProps.isFormSubmitted()) {
this.showError();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class MultiFieldText extends Component<
}
}

public componentWillReceiveProps(nextProps: ComponentProps) {
public UNSAFE_componentWillReceiveProps(nextProps: ComponentProps) {
if (nextProps.isFormSubmitted()) {
this.showError();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class FieldSelect extends Component<
}
}

public componentWillReceiveProps(nextProps: ComponentProps) {
public UNSAFE_componentWillReceiveProps(nextProps: ComponentProps) {
if (nextProps.isFormSubmitted()) {
this.showError();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class BeatDetailPageUi extends React.PureComponent<PageProps, PageState> {
};
}

public async componentWillMount() {
public async UNSAFE_componentWillMount() {
const tags = await this.props.libs.tags.getTagsWithIds(this.props.beat.tags);
const blocksResult = await this.props.libs.configBlocks.getForTags(
this.props.beat.tags,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class BeatTagsPage extends React.PureComponent<BeatTagsPageProps, BeatTag
};
}

public componentWillMount() {
public UNSAFE_componentWillMount() {
this.updateBeatsData();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class TagEditPageComponent extends React.PureComponent<
};
}

public componentWillMount() {
public UNSAFE_componentWillMount() {
this.loadTag();
this.loadAttachedBeats();
this.loadConfigBlocks();
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/beats_management/public/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class AppRouter extends Component<RouterProps, RouterState> {
};
}

public async componentWillMount() {
public async UNSAFE_componentWillMount() {
if (this.state.loading === true) {
try {
await this.props.beatsContainer.reload();
Expand Down
Loading

0 comments on commit 00857d3

Please sign in to comment.