Add AirBnb TypeScript overrides for linting

AirBnb only imports JavaScript rules and some fail for TypeScript files.
This commit overrides those rules with TypeScript equivalents.

Changes here can be mostly replaced when Vue natively support TypeScript
for Airbnb (vuejs/eslint-config-airbnb#23).

Enables @typescript-eslint/indent even though it's broken and it will
not be fixed typescript-eslint/typescript-eslint#1824 until prettifier
is used, because it is still useful.

Change broken rules with TypeScript variants:
  - `no-useless-constructor`
      eslint/eslint#14118
      typescript-eslint/typescript-eslint#873
  - `no-shadow`
      eslint/eslint#13044
      typescript-eslint/typescript-eslint#2483
      typescript-eslint/typescript-eslint#325
      typescript-eslint/typescript-eslint#2552
      typescript-eslint/typescript-eslint#2484
      typescript-eslint/typescript-eslint#2466
This commit is contained in:
undergroundwires
2022-01-19 22:28:33 +01:00
parent 2354f0ba9f
commit 834ce8cf9e
12 changed files with 193 additions and 18 deletions

View File

@@ -3,15 +3,15 @@ import { AsyncLazy } from '@/infrastructure/Threading/AsyncLazy';
import { IApplicationFactory } from './IApplicationFactory';
import { parseApplication } from './Parser/ApplicationParser';
export type ApplicationGetter = () => IApplication;
const ApplicationGetter: ApplicationGetter = parseApplication;
export type ApplicationGetterType = () => IApplication;
const ApplicationGetter: ApplicationGetterType = parseApplication;
export class ApplicationFactory implements IApplicationFactory {
public static readonly Current: IApplicationFactory = new ApplicationFactory(ApplicationGetter);
private readonly getter: AsyncLazy<IApplication>;
protected constructor(costlyGetter: ApplicationGetter) {
protected constructor(costlyGetter: ApplicationGetterType) {
if (!costlyGetter) {
throw new Error('undefined getter');
}

View File

@@ -10,8 +10,8 @@ export interface IReadOnlyApplicationContext {
}
export interface IApplicationContext extends IReadOnlyApplicationContext {
readonly state: ICategoryCollectionState;
changeContext(os: OperatingSystem): void;
readonly state: ICategoryCollectionState;
changeContext(os: OperatingSystem): void;
}
export interface IApplicationContextChangedEvent {

View File

@@ -12,7 +12,7 @@ export class Expression implements IExpression {
public readonly position: ExpressionPosition,
public readonly evaluator: ExpressionEvaluator,
public readonly parameters
: IReadOnlyFunctionParameterCollection = new FunctionParameterCollection(),
: IReadOnlyFunctionParameterCollection = new FunctionParameterCollection(),
) {
if (!position) {
throw new Error('undefined position');

View File

@@ -14,7 +14,7 @@ import { setupAutoUpdater } from './Update/Updater';
const isDevelopment = process.env.NODE_ENV !== 'production';
// Path of static assets, magic variable populated by electron
// eslint-disable-next-line no-underscore-dangle
// eslint-disable-next-line @typescript-eslint/naming-convention, no-underscore-dangle
declare const __static: string; // https://github.com/electron-userland/electron-webpack/issues/172
// Keep a global reference of the window object, if you don't, the window will