Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 3 additions & 10 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import mochaPlugin from "eslint-plugin-mocha";
import globals from "globals";

import tseslint from "typescript-eslint";
Expand Down Expand Up @@ -109,32 +108,26 @@ export default [
{
files: ["*/test/**"],
languageOptions: {
globals: { ...globals.mocha, ...globals.node },
globals: { ...globals.node, ...globals.vitest },
ecmaVersion: 2020,
},
plugins: { mocha: mochaPlugin },
rules: {
"mocha/no-exclusive-tests": "error",
"mocha/no-identical-title": "error",
"no-console": "off",
"prefer-arrow-callback": "off",
},
},
{
files: ["fluent-dom/test/*"],
languageOptions: { globals: { ...globals.browser } },
languageOptions: { globals: { ...globals.browser, ...globals.vitest } },
},
{
files: ["fluent-react/test/**"],
languageOptions: {
globals: { ...globals.browser, ...globals.jest },
globals: { ...globals.browser, ...globals.vitest },
ecmaVersion: 2020,
parserOptions: { ecmaFeatures: { jsx: true } },
},
plugins: { mocha: mochaPlugin },
rules: {
"mocha/no-exclusive-tests": "error",
"mocha/no-identical-title": "error",
"no-unused-vars": "off",
},
},
Expand Down
2 changes: 0 additions & 2 deletions fluent-bundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ The undocumented `_parse` export was also removed in favor of
- Rename `MessageContext` to `FluentBundle`. (#222)

The following renames have been made to the public API:

- Rename `MessageContext` to `FluentBundle`.
- Rename `MessageArgument` to `FluentType`.
- Rename `MessageNumberArgument` to `FluentNumber`.
Expand Down Expand Up @@ -492,7 +491,6 @@ The undocumented `_parse` export was also removed in favor of
## fluent 0.6.0 (January 31, 2018)

- Implement Fluent Syntax 0.5.

- Add support for terms.
- Add support for `#`, `##` and `###` comments.
- Remove support for tags.
Expand Down
3 changes: 1 addition & 2 deletions fluent-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
],
"scripts": {
"build": "tsc",
"postbuild": "rollup -c ../rollup.config.mjs",
"test": "mocha 'test/*_test.js'"
"postbuild": "rollup -c ../rollup.config.mjs"
},
"engines": {
"node": ">=18.0.0",
Expand Down
10 changes: 5 additions & 5 deletions fluent-bundle/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Scope } from "./scope.js";
// In addition to this minimal interface, these objects are also expected
// to be supported by Intl.DateTimeFormat
interface TemporalInstant {
epochMilliseconds: number
epochMilliseconds: number;
toString(): string;
}
interface TemporalDateTypes {
Expand All @@ -14,12 +14,12 @@ interface TemporalDateTypes {
toString(): string;
}
interface TemporalPlainTime {
hour: number
minute: number
second: number
hour: number;
minute: number;
second: number;
toString(): string;
}
type TemporalObject = TemporalInstant | TemporalDateTypes | TemporalPlainTime
type TemporalObject = TemporalInstant | TemporalDateTypes | TemporalPlainTime;

export type FluentValue = FluentType<unknown> | string;

Expand Down
52 changes: 26 additions & 26 deletions fluent-bundle/test/arguments_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { FluentType, FluentNumber, FluentDateTime } from "../esm/types.js";
suite("Variables", function () {
let bundle, errs;

setup(function () {
beforeEach(function () {
errs = [];
});

suite("in values", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand Down Expand Up @@ -58,7 +58,7 @@ suite("Variables", function () {
});

suite("in selectors", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand All @@ -78,7 +78,7 @@ suite("Variables", function () {
});

suite("in function calls", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand All @@ -96,7 +96,7 @@ suite("Variables", function () {
});

suite("simple errors", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand Down Expand Up @@ -158,7 +158,7 @@ suite("Variables", function () {
suite("and strings", function () {
let args;

suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand All @@ -179,7 +179,7 @@ suite("Variables", function () {
});

suite("and numbers", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand Down Expand Up @@ -207,7 +207,7 @@ suite("Variables", function () {
suite("and dates", function () {
let dtf;

suiteSetup(function () {
beforeAll(function () {
dtf = new Intl.DateTimeFormat("en-US");
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
Expand Down Expand Up @@ -243,33 +243,33 @@ suite("Variables", function () {
}
}

suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
foo = { $arg }
bar = { foo }
`)
);
});

const args = {
// CustomType is a wrapper around the value
arg: new CustomType(),
};
const args = {
// CustomType is a wrapper around the value
arg: new CustomType(),
};

test("interpolation", function () {
const msg = bundle.getMessage("foo");
const value = bundle.formatPattern(msg.value, args, errs);
assert.strictEqual(value, "CUSTOM");
assert.strictEqual(errs.length, 0);
});

test("interpolation", function () {
const msg = bundle.getMessage("foo");
const value = bundle.formatPattern(msg.value, args, errs);
assert.strictEqual(value, "CUSTOM");
assert.strictEqual(errs.length, 0);
});

test("nested interpolation", function () {
const msg = bundle.getMessage("bar");
const value = bundle.formatPattern(msg.value, args, errs);
assert.strictEqual(value, "CUSTOM");
assert.strictEqual(errs.length, 0);
});
test("nested interpolation", function () {
const msg = bundle.getMessage("bar");
const value = bundle.formatPattern(msg.value, args, errs);
assert.strictEqual(value, "CUSTOM");
assert.strictEqual(errs.length, 0);
});
});
});
10 changes: 5 additions & 5 deletions fluent-bundle/test/attributes_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { FluentResource } from "../esm/resource.js";
suite("Attributes", function () {
let bundle, args, errs;

setup(function () {
beforeEach(function () {
errs = [];
});

suite("missing", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand Down Expand Up @@ -65,7 +65,7 @@ suite("Attributes", function () {
});

suite("with string values", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand Down Expand Up @@ -110,7 +110,7 @@ suite("Attributes", function () {
});

suite("with simple pattern values", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand Down Expand Up @@ -173,7 +173,7 @@ suite("Attributes", function () {
});

suite("with values with select expressions", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand Down
4 changes: 2 additions & 2 deletions fluent-bundle/test/bomb_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { FluentResource } from "../esm/resource.js";
suite("Reference bombs", function () {
let bundle, args, errs;

setup(function () {
beforeEach(function () {
errs = [];
});

suite("Billion Laughs", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand Down
4 changes: 2 additions & 2 deletions fluent-bundle/test/constructor_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { FluentResource } from "../esm/resource.js";

suite("FluentBundle constructor", function () {
let nfSpy;
setup(() => {
beforeEach(() => {
nfSpy = sinon.spy(Intl, "NumberFormat");
});

teardown(() => {
afterEach(() => {
nfSpy.restore();
});

Expand Down
8 changes: 4 additions & 4 deletions fluent-bundle/test/context_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ suite("Bundle", function () {
let bundle;

suite("addResource", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand Down Expand Up @@ -55,7 +55,7 @@ suite("Bundle", function () {
});

suite("allowOverrides", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
let resource1 = new FluentResource("key = Foo");
bundle.addResource(resource1);
Expand All @@ -79,7 +79,7 @@ suite("Bundle", function () {
});

suite("hasMessage", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand Down Expand Up @@ -122,7 +122,7 @@ suite("Bundle", function () {
});

suite("getMessage", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand Down
2 changes: 1 addition & 1 deletion fluent-bundle/test/errors_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { FluentResource } from "../esm/resource.js";
suite("Errors", function () {
let bundle;

suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand Down
4 changes: 2 additions & 2 deletions fluent-bundle/test/functions_builtin_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ suite("Built-in functions", function () {
let bundle, errors, msg;

suite("NUMBER", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand Down Expand Up @@ -475,7 +475,7 @@ suite("Built-in functions", function () {
});

suite("DATETIME", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand Down
4 changes: 2 additions & 2 deletions fluent-bundle/test/functions_runtime_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ suite("Runtime-specific functions", function () {
suite("passing into the constructor", function () {
let bundle, errs;

suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", {
useIsolating: false,
functions: {
Expand Down Expand Up @@ -61,7 +61,7 @@ suite("Runtime-specific functions", function () {
/** @type {FluentBundle} */
let bundle;

suiteSetup(() => {
beforeAll(() => {
const ONE_DAY_IN_MS = 24 * 60 * 60 * 1000;
const ONE_YEAR_IN_MS = 365 * ONE_DAY_IN_MS;

Expand Down
6 changes: 3 additions & 3 deletions fluent-bundle/test/functions_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { FluentResource } from "../esm/resource.js";
suite("Functions", function () {
let bundle, errs;

setup(function () {
beforeEach(function () {
errs = [];
});

suite("missing", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", { useIsolating: false });
bundle.addResource(
new FluentResource(ftl`
Expand All @@ -31,7 +31,7 @@ suite("Functions", function () {
});

suite("arguments", function () {
suiteSetup(function () {
beforeAll(function () {
bundle = new FluentBundle("en-US", {
useIsolating: false,
functions: {
Expand Down
Loading