Skip to content

Commit 9ced297

Browse files
committed
fix: Adjust for updated linter rules
1 parent d1f195b commit 9ced297

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

fluent-langneg/src/negotiate_languages.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {filterMatches} from "./matches.js";
1+
import { filterMatches } from "./matches.js";
22

33
export interface NegotiateLanguagesOptions {
44
strategy?: "filtering" | "matching" | "lookup";
@@ -51,22 +51,19 @@ export interface NegotiateLanguagesOptions {
5151
export function negotiateLanguages(
5252
requestedLocales: Readonly<Array<string>>,
5353
availableLocales: Readonly<Array<string>>,
54-
{
55-
strategy = "filtering",
56-
defaultLocale,
57-
}: NegotiateLanguagesOptions = {}
54+
{ strategy = "filtering", defaultLocale }: NegotiateLanguagesOptions = {}
5855
): Array<string> {
59-
6056
const supportedLocales = filterMatches(
61-
Array.from(Object(requestedLocales)).map(String),
62-
Array.from(Object(availableLocales)).map(String),
57+
Array.from(requestedLocales ?? []).map(String),
58+
Array.from(availableLocales ?? []).map(String),
6359
strategy
6460
);
6561

6662
if (strategy === "lookup") {
6763
if (defaultLocale === undefined) {
6864
throw new Error(
69-
"defaultLocale cannot be undefined for strategy `lookup`");
65+
"defaultLocale cannot be undefined for strategy `lookup`"
66+
);
7067
}
7168
if (supportedLocales.length === 0) {
7269
supportedLocales.push(defaultLocale);

fluent-syntax/src/ast.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export abstract class BaseNode {
5757
}
5858
return value;
5959
}
60+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
6061
const clone = Object.create(this.constructor.prototype) as BaseNode;
6162
for (const prop of Object.keys(this)) {
6263
clone[prop] = visit(this[prop]);

fluent-syntax/src/visitor.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export abstract class Transformer extends Visitor {
106106
} else if (Array.isArray(prop)) {
107107
let newVals: Array<AST.BaseNode> = [];
108108
for (let element of prop) {
109-
let newVal = this.visit(element);
109+
let newVal = this.visit(element as AST.BaseNode);
110110
if (newVal !== undefined) {
111111
newVals.push(newVal);
112112
}
@@ -127,10 +127,12 @@ export abstract class Transformer extends Visitor {
127127
visitNumberLiteral?(node: AST.NumberLiteral): AST.BaseNode | undefined;
128128
visitMessageReference?(node: AST.MessageReference): AST.BaseNode | undefined;
129129
visitTermReference?(node: AST.TermReference): AST.BaseNode | undefined;
130-
visitVariableReference?(node: AST.VariableReference):
131-
AST.BaseNode | undefined;
132-
visitFunctionReference?(node: AST.FunctionReference):
133-
AST.BaseNode | undefined;
130+
visitVariableReference?(
131+
node: AST.VariableReference
132+
): AST.BaseNode | undefined;
133+
visitFunctionReference?(
134+
node: AST.FunctionReference
135+
): AST.BaseNode | undefined;
134136
visitSelectExpression?(node: AST.SelectExpression): AST.BaseNode | undefined;
135137
visitCallArguments?(node: AST.CallArguments): AST.BaseNode | undefined;
136138
visitAttribute?(node: AST.Attribute): AST.BaseNode | undefined;

0 commit comments

Comments
 (0)