Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup warning noise from eslint #20684

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,26 @@ module.exports = {
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{
// these are the settings recommneded by typescript-eslint to follow
// typescript's own default unused variable naming policies.
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],

// these default to 'warn' in @typescript-eslint/recommended. But
// warnings just get ignored and allowed to generate noise. We should
// either commit to makign them errors or leave them off.
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',

// TODO: Enable and fix these rules
// Typescript provides better types with these rules enabled
Expand Down
2 changes: 1 addition & 1 deletion packages/@ember/-internals/container/lib/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if (DEBUG) {
};
})();
}
} catch (e) {
} catch (_e) {
// ignore
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@ember/-internals/glimmer/lib/components/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if (hasDOM) {
try {
INPUT_ELEMENT.type = type;
isValid = INPUT_ELEMENT.type === type;
} catch (e) {
} catch (_e) {
isValid = false;
} finally {
INPUT_ELEMENT.type = 'text';
Expand Down
2 changes: 0 additions & 2 deletions packages/@ember/-internals/glimmer/lib/components/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,10 @@ export default class InternalComponent {
}
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected isSupportedArgument(_name: string): boolean {
return false;
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected onUnsupportedArgument(_name: string): void {}

toString(): string {
Expand Down
1 change: 0 additions & 1 deletion packages/@ember/-internals/glimmer/lib/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ export function helper<S>(
export function helper(
helperFn: (positional: unknown[], named: object) => unknown
// At the implementation site, we don't care about the actual underlying type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): FunctionBasedHelper<any> {
// SAFETY: this is completely lies, in two ways:
//
Expand Down
2 changes: 1 addition & 1 deletion packages/@ember/-internals/metal/lib/namespace_search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function tryIsNamespace(lookup: { [k: string]: any }, prop: string): Namespace |
obj.isNamespace &&
obj
);
} catch (e) {
} catch (_e) {
// continue
}
}
4 changes: 2 additions & 2 deletions packages/@ember/controller/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ const ControllerMixin = Mixin.create(ActionHandler, {
@uses Ember.ControllerMixin
@public
*/
interface Controller<T = unknown> extends FrameworkObject, ControllerMixin<T> {}
class Controller<T = unknown> extends FrameworkObject.extend(ControllerMixin) {}
interface Controller<_T = unknown> extends FrameworkObject, ControllerMixin<_T> {}
class Controller<_T = unknown> extends FrameworkObject.extend(ControllerMixin) {}

/**
Creates a property that lazily looks up another controller in the container.
Expand Down
1 change: 0 additions & 1 deletion packages/@ember/engine/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class EngineInstance extends EmberObject.extend(RegistryProxyMixin, ContainerPro
// This is effectively an "abstract" method: it defines the contract a
// subclass (e.g. `ApplicationInstance`) must follow to implement this
// behavior, but an `EngineInstance` has no behavior of its own here.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
static setupRegistry(_registry: Registry, _options?: BootOptions) {}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/internal-test-helpers/lib/system/synthetic-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function buildMouseEvent(type: string, options: MouseEventInit = {}) {
let event;
try {
event = new MouseEvent(type, { ...DEFAULT_EVENT_OPTIONS, ...options });
} catch (e) {
} catch (_e) {
event = buildBasicEvent(type, options);
}
return event;
Expand All @@ -147,7 +147,7 @@ function buildKeyboardEvent(type: string, options: KeyboardEventInit = {}) {
let event;
try {
event = new KeyboardEvent(type, { ...DEFAULT_EVENT_OPTIONS, ...options });
} catch (e) {
} catch (_e) {
event = buildBasicEvent(type, options);
}
return event;
Expand Down
Loading