Port to fluent-syntax 0.10.0, switch to warnings.
Fixes #2313 Fixes #2305
This commit is contained in:
Родитель
66dc5e7016
Коммит
e300062af1
|
@ -6239,9 +6239,9 @@
|
|||
}
|
||||
},
|
||||
"fluent-syntax": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/fluent-syntax/-/fluent-syntax-0.7.0.tgz",
|
||||
"integrity": "sha1-Y6wpH+FC8ZOtZhx2D9lxCdJclN8="
|
||||
"version": "0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/fluent-syntax/-/fluent-syntax-0.10.0.tgz",
|
||||
"integrity": "sha512-6qRhwQXDTgJjS9DW3IiXZWzUMUPqNPzqh+bZZyUOr6t8xYwkIe+5JONYZuvfvbOUk65paAno0kd8s8kUD2ptNA=="
|
||||
},
|
||||
"flush-write-stream": {
|
||||
"version": "1.0.3",
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
"espree": "5.0.0",
|
||||
"esprima": "3.1.3",
|
||||
"first-chunk-stream": "2.0.0",
|
||||
"fluent-syntax": "0.7.0",
|
||||
"fluent-syntax": "0.10.0",
|
||||
"glob": "7.1.3",
|
||||
"is-mergeable-object": "1.1.0",
|
||||
"jed": "1.1.1",
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
import {
|
||||
FluentParser as FluentSyntaxParser,
|
||||
lineOffset,
|
||||
columnOffset,
|
||||
} from 'fluent-syntax';
|
||||
import { parse, lineOffset, columnOffset } from 'fluent-syntax';
|
||||
|
||||
import * as messages from 'messages';
|
||||
|
||||
|
@ -22,8 +18,7 @@ export default class FluentParser {
|
|||
}
|
||||
|
||||
parse() {
|
||||
const parser = new FluentSyntaxParser();
|
||||
const resource = parser.parse(this._sourceString);
|
||||
const resource = parse(this._sourceString);
|
||||
|
||||
this.parsedData = {};
|
||||
|
||||
|
@ -40,7 +35,7 @@ export default class FluentParser {
|
|||
annotation.span.end
|
||||
);
|
||||
|
||||
const errorData = {
|
||||
const warningData = {
|
||||
...messages.FLUENT_INVALID,
|
||||
file: this.filename,
|
||||
description: entry.annotations[0].message,
|
||||
|
@ -48,7 +43,7 @@ export default class FluentParser {
|
|||
line: matchedLine,
|
||||
};
|
||||
|
||||
this.collector.addError(errorData);
|
||||
this.collector.addWarning(warningData);
|
||||
} else if (entry.id !== undefined) {
|
||||
this.parsedData[entry.id.name] = entry;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ describe('FluentParser', () => {
|
|||
const parser = new FluentParser(
|
||||
`
|
||||
choose-download-folder-title =
|
||||
{
|
||||
{ $faz ->
|
||||
*[nominative] Foo
|
||||
[accusative] Foo2
|
||||
}`,
|
||||
|
@ -28,13 +28,13 @@ choose-download-folder-title =
|
|||
const addonLinter = new Linter({ _: ['bar'] });
|
||||
const parser = new FluentParser(
|
||||
`
|
||||
key67
|
||||
key67 =
|
||||
.label = Sign In To &syncBrand.shortName.label;…
|
||||
.accesskey = Y
|
||||
key68
|
||||
key68 =
|
||||
.label = Sync Now
|
||||
.accesskey = S
|
||||
key69
|
||||
key69 =
|
||||
.label = Reconnect to &syncBrand.shortName.label;…
|
||||
.accesskey = R`,
|
||||
addonLinter.collector
|
||||
|
@ -90,7 +90,7 @@ shared-photos =
|
|||
parser.parse();
|
||||
|
||||
expect(parser.isValid).toEqual(false);
|
||||
assertHasMatchingError(addonLinter.collector.errors, {
|
||||
assertHasMatchingError(addonLinter.collector.warnings, {
|
||||
code: messages.FLUENT_INVALID.code,
|
||||
message: 'Your FTL is not valid.',
|
||||
description: oneLine`
|
||||
|
|
Загрузка…
Ссылка в новой задаче