chore(NA): enable @typescript-eslint/explicit-member-accessibility rule (#41422) (#41579)

This commit is contained in:
Tiago Costa 2019-07-19 17:48:47 +01:00 committed by GitHub
parent 0dad705423
commit 1332b359e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 44 additions and 36 deletions

View file

@ -15,8 +15,8 @@
},
"homepage": "https://github.com/elastic/eslint-config-kibana#readme",
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "1.11.0",
"@typescript-eslint/parser": "1.11.0",
"@typescript-eslint/eslint-plugin": "1.12.0",
"@typescript-eslint/parser": "1.12.0",
"babel-eslint": "10.0.2",
"eslint": "5.16.0",
"eslint-plugin-babel": "5.3.0",

View file

@ -80,10 +80,16 @@ module.exports = {
'allow': ['^[A-Z0-9_]+$']
}],
'@typescript-eslint/class-name-casing': 'error',
// TODO: disable this rule until a PR with more options to configure
// get merged and we can then reproduce the old behaviour
// https://github.com/typescript-eslint/typescript-eslint/pull/322
// '@typescript-eslint/explicit-member-accessibility': 'error',
'@typescript-eslint/explicit-member-accessibility': ['error',
{
accessibility: 'off',
overrides: {
accessors: 'explicit',
constructors: 'no-public',
parameterProperties: 'explicit'
}
}
],
'indent': 'off',
'@typescript-eslint/indent': [ 'error', 2, { SwitchCase: 1 } ],
'@typescript-eslint/prefer-function-type': 'error',

View file

@ -85,7 +85,7 @@ export class Project {
this.scripts = this.json.scripts || {};
}
get name(): string {
public get name(): string {
return this.json.name;
}

View file

@ -88,7 +88,7 @@ export class ChromeService {
private readonly navLinks = new NavLinksService();
private readonly recentlyAccessed = new RecentlyAccessedService();
public constructor({ browserSupportsCsp }: ConstructorParams) {
constructor({ browserSupportsCsp }: ConstructorParams) {
this.browserSupportsCsp = browserSupportsCsp;
}

View file

@ -46,7 +46,7 @@ class LocalStorageMock implements Storage {
return [...this.store.keys()][index] || null;
}
get length() {
public get length() {
return this.store.size;
}
}

View file

@ -20,7 +20,7 @@
export class HttpInterceptController {
private _halted = false;
get halted() {
public get halted() {
return this._halted;
}

View file

@ -37,11 +37,11 @@ export class BasePathProxyServer {
private server?: Server;
private httpsAgent?: HttpsAgent;
get basePath() {
public get basePath() {
return this.httpConfig.basePath;
}
get targetPort() {
public get targetPort() {
return this.devConfig.basePathProxyTargetPort;
}

View file

@ -50,7 +50,7 @@ export class ApplyFiltersPopover extends Component<Props, State> {
filters: [],
};
public constructor(props: Props) {
constructor(props: Props) {
super(props);
this.state = {
isFilterSelected: props.filters.map(() => true),

View file

@ -74,7 +74,7 @@ interface State {
}
class FilterEditorUI extends Component<Props, State> {
public constructor(props: Props) {
constructor(props: Props) {
super(props);
this.state = {
selectedIndexPattern: this.getIndexPatternFromFilter(),

View file

@ -41,7 +41,7 @@ interface Props {
}
class RangeValueInputUI extends Component<Props> {
public constructor(props: Props) {
constructor(props: Props) {
super(props);
}

View file

@ -150,7 +150,7 @@ import {
export class Cluster {
public callWithRequest: CallClusterWithRequest;
public callWithInternalUser: CallCluster;
public constructor(config: ClusterConfig);
constructor(config: ClusterConfig);
}
export interface ClusterConfig {

View file

@ -37,7 +37,7 @@ export class HelloWorldContainerComponent extends Component<Props, State> {
private inputSubscription?: Subscription;
private outputSubscription?: Subscription;
public constructor(props: Props) {
constructor(props: Props) {
super(props);
Object.values(this.props.container.getInput().panels).forEach(panelState => {

View file

@ -27,7 +27,7 @@ export class StubBrowserStorage {
// Browser-specific methods.
// -----------------------------------------------------------------------------------------------
get length() {
public get length() {
return this.keys.length;
}

View file

@ -43,7 +43,7 @@ export class DashboardContainerExample extends React.Component<{}, State> {
private mounted = false;
private container: DashboardContainer | ErrorEmbeddable | undefined;
public constructor() {
constructor() {
super({});
this.state = {
viewMode: ViewMode.VIEW,

View file

@ -36,7 +36,7 @@ export class HelloWorldContainerExample extends React.Component<Props, { lastNam
private mounted: boolean = false;
private subscription?: Subscription;
public constructor(props: Props) {
constructor(props: Props) {
super(props);
this.container = new HelloWorldContainer(

View file

@ -23,7 +23,7 @@ import { HelloWorldEmbeddable } from '../../../../../../src/legacy/core_plugins/
export class ContactCardEmbeddableExample extends React.Component<{}> {
private embeddable: HelloWorldEmbeddable;
public constructor() {
constructor() {
super({});
this.embeddable = new HelloWorldEmbeddable({ id: 'hello' });
}

View file

@ -53,14 +53,14 @@ export class BackendFrameworkLib {
/**
* Expired `null` happens when we have no xpack info
*/
get license() {
public get license() {
return {
type: this.adapter.info ? this.adapter.info.license.type : 'unknown',
expired: this.adapter.info ? this.adapter.info.license.expired : null,
};
}
get securityIsEnabled() {
public get securityIsEnabled() {
return this.adapter.info ? this.adapter.info.security.enabled : false;
}

View file

@ -33,7 +33,7 @@ export class TopBar extends React.Component<Props, { value: string }> {
value: decodeRevisionString(this.props.routeParams.revision),
};
get branch() {
public get branch() {
return this.getBranch(this.state.value);
}
@ -50,7 +50,7 @@ export class TopBar extends React.Component<Props, { value: string }> {
}
};
get branchOptions() {
public get branchOptions() {
return this.props.branches.map(b => ({
value: b.name,
text: b.name,

View file

@ -16,7 +16,7 @@ import { InitializeOptions, RequestExpander } from './request_expander';
const GO_LANG_DETACH_PORT = 2091;
export class GoServerLauncher extends AbstractLauncher {
public constructor(
constructor(
readonly targetHost: string,
readonly options: ServerOptions,
readonly loggerFactory: LoggerFactory

View file

@ -21,7 +21,7 @@ const JAVA_LANG_DETACH_PORT = 2090;
export class JavaLauncher extends AbstractLauncher {
private needModuleArguments: boolean = true;
public constructor(
constructor(
readonly targetHost: string,
readonly options: ServerOptions,
readonly loggerFactory: LoggerFactory

View file

@ -17,7 +17,7 @@ import { InitializeOptions, RequestExpander } from './request_expander';
const TS_LANG_DETACH_PORT = 2089;
export class TypescriptServerLauncher extends AbstractLauncher {
public constructor(
constructor(
readonly targetHost: string,
readonly options: ServerOptions,
readonly loggerFactory: LoggerFactory

View file

@ -40,7 +40,8 @@ export class QueryTemplate<
tiebreaker?: string
) => FetchMoreOptionsArgs<TData, TVariables>;
public constructor(props: T) {
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
constructor(props: T) {
super(props);
}

View file

@ -37,7 +37,8 @@ export class QueryTemplatePaginated<
private fetchMoreOptions!: (newActivePage: number) => FetchMoreOptionsArgs<TData, TVariables>;
public constructor(props: T) {
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
constructor(props: T) {
super(props);
}

View file

@ -12,7 +12,7 @@ class HttpService {
this.addBasePath = chrome.addBasePath.bind(chrome);
}
get httpClient(): any {
public get httpClient(): any {
return this.client;
}
}

View file

@ -46,7 +46,7 @@ export class TaskManager {
* enabling the task manipulation methods, and beginning the background polling
* mechanism.
*/
public constructor(kbnServer: any, server: any, config: any) {
constructor(kbnServer: any, server: any, config: any) {
this.maxWorkers = config.get('xpack.task_manager.max_workers');
this.overrideNumWorkers = config.get('xpack.task_manager.override_num_workers');
this.definitions = {};

View file

@ -41,7 +41,7 @@ export class TaskPool {
/**
* Gets how many workers are currently in use.
*/
get occupiedWorkers() {
public get occupiedWorkers() {
const running = Array.from(this.running); // get array from a Set
return running.reduce((total, { numWorkers }) => (total += numWorkers), 0);
}
@ -49,7 +49,7 @@ export class TaskPool {
/**
* Gets how many workers are currently available.
*/
get availableWorkers() {
public get availableWorkers() {
return this.maxWorkers - this.occupiedWorkers;
}

View file

@ -211,7 +211,7 @@ export class TaskStore {
return templateResult;
}
get isInitialized() {
public get isInitialized() {
return this._isInitialized;
}

View file

@ -6,7 +6,7 @@
import { createOptionalPlugin } from './optional_plugin';
class FooPlugin {
get aProp() {
public get aProp() {
return 'a prop';
}