Format json files in using prettier

This commit is contained in:
Calixte Denizet 2024-01-16 19:40:25 +01:00
parent 51413be5b6
commit 29de9bdce6
8 changed files with 9356 additions and 8558 deletions

11
.prettierignore Normal file
View File

@ -0,0 +1,11 @@
build/
l10n/
docs/
node_modules/
external/bcmaps/
external/builder/fixtures/
external/builder/fixtures_esprima/
external/quickjs/
test/tmp/
test/pdfs/
*~/

View File

@ -11,32 +11,30 @@
},
"permissions": [
"fileBrowserHandler",
"webRequest", "webRequestBlocking",
"webRequest",
"webRequestBlocking",
"<all_urls>",
"tabs",
"webNavigation",
"storage"
],
"content_scripts": [{
"matches": [
"http://*/*",
"https://*/*",
"ftp://*/*",
"file://*/*"
],
"run_at": "document_start",
"all_frames": true,
"css": ["contentstyle.css"],
"js": ["contentscript.js"]
}],
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*", "ftp://*/*", "file://*/*"],
"run_at": "document_start",
"all_frames": true,
"css": ["contentstyle.css"],
"js": ["contentscript.js"]
}
],
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"file_browser_handlers": [{
"id": "open-as-pdf",
"default_title": "Open with PDF Viewer",
"file_filters": [
"filesystem:*.pdf"
]
}],
"file_browser_handlers": [
{
"id": "open-as-pdf",
"default_title": "Open with PDF Viewer",
"file_filters": ["filesystem:*.pdf"]
}
],
"storage": {
"managed_schema": "preferences_schema.json"
},

View File

@ -5,11 +5,7 @@
"title": "Theme",
"description": "The theme to use.\n0 = Use system theme.\n1 = Light theme.\n2 = Dark theme.",
"type": "integer",
"enum": [
0,
1,
2
],
"enum": [0, 1, 2],
"default": 2
},
"showPreviousViewOnLoad": {
@ -21,11 +17,7 @@
"title": "View position on load",
"description": "The position in the document upon load.\n -1 = Default (uses OpenAction if available, otherwise equal to `viewOnLoad = 0`).\n 0 = The last viewed page/position.\n 1 = The initial page/position.",
"type": "integer",
"enum": [
-1,
0,
1
],
"enum": [-1, 0, 1],
"default": 0
},
"defaultZoomDelay": {
@ -45,13 +37,7 @@
"title": "Sidebar state on load",
"description": "Controls the state of the sidebar upon load.\n -1 = Default (uses PageMode if available, otherwise the last position if available/enabled).\n 0 = Do not show sidebar.\n 1 = Show thumbnails in sidebar.\n 2 = Show document outline in sidebar.\n 3 = Show attachments in sidebar.",
"type": "integer",
"enum": [
-1,
0,
1,
2,
3
],
"enum": [-1, 0, 1, 2, 3],
"default": -1
},
"enableHandToolOnLoad": {
@ -63,10 +49,7 @@
"title": "Cursor tool on load",
"description": "The cursor tool that is enabled upon load.\n 0 = Text selection tool.\n 1 = Hand tool.",
"type": "integer",
"enum": [
0,
1
],
"enum": [0, 1],
"default": 0
},
"pdfBugEnabled": {
@ -120,23 +103,14 @@
"title": "Text layer mode",
"description": "Controls if the text layer is enabled, and the selection mode that is used.\n 0 = Disabled.\n 1 = Enabled.",
"type": "integer",
"enum": [
0,
1
],
"enum": [0, 1],
"default": 1
},
"externalLinkTarget": {
"title": "External links target window",
"description": "Controls how external links will be opened.\n 0 = default.\n 1 = replaces current window.\n 2 = new window/tab.\n 3 = parent.\n 4 = in top window.",
"type": "integer",
"enum": [
0,
1,
2,
3,
4
],
"enum": [0, 1, 2, 3, 4],
"default": 0
},
"disablePageLabels": {
@ -156,22 +130,12 @@
},
"annotationMode": {
"type": "integer",
"enum": [
0,
1,
2,
3
],
"enum": [0, 1, 2, 3],
"default": 2
},
"annotationEditorMode": {
"type": "integer",
"enum": [
-1,
0,
3,
15
],
"enum": [-1, 0, 3, 15],
"default": 0
},
"enablePermissions": {
@ -202,25 +166,14 @@
"title": "Scroll mode on load",
"description": "Controls how the viewer scrolls upon load.\n -1 = Default (uses the last position if available/enabled).\n 3 = Page scrolling.\n 0 = Vertical scrolling.\n 1 = Horizontal scrolling.\n 2 = Wrapped scrolling.",
"type": "integer",
"enum": [
-1,
0,
1,
2,
3
],
"enum": [-1, 0, 1, 2, 3],
"default": -1
},
"spreadModeOnLoad": {
"title": "Spread mode on load",
"description": "Whether the viewer should join pages into spreads upon load.\n -1 = Default (uses the last position if available/enabled).\n 0 = No spreads.\n 1 = Odd spreads.\n 2 = Even spreads.",
"type": "integer",
"enum": [
-1,
0,
1,
2
],
"enum": [-1, 0, 1, 2],
"default": -1
},
"forcePageColors": {

View File

@ -1936,7 +1936,7 @@ gulp.task(
gulp.task("lint", function (done) {
console.log();
console.log("### Linting JS/CSS files");
console.log("### Linting JS/CSS/JSON files");
// Ensure that we lint the Firefox specific *.jsm files too.
const esLintOptions = [
@ -1959,6 +1959,16 @@ gulp.task("lint", function (done) {
styleLintOptions.push("--fix");
}
const prettierOptions = [
"node_modules/prettier/bin/prettier.cjs",
"**/*.json",
];
if (process.argv.includes("--fix")) {
prettierOptions.push("--log-level", "silent", "--write");
} else {
prettierOptions.push("--log-level", "warn", "--check");
}
const esLintProcess = startNode(esLintOptions, { stdio: "inherit" });
esLintProcess.on("close", function (esLintCode) {
if (esLintCode !== 0) {
@ -1972,8 +1982,16 @@ gulp.task("lint", function (done) {
done(new Error("Stylelint failed."));
return;
}
console.log("files checked, no errors found");
done();
const prettierProcess = startNode(prettierOptions, { stdio: "inherit" });
prettierProcess.on("close", function (prettierCode) {
if (prettierCode !== 0) {
done(new Error("Prettier failed."));
return;
}
console.log("files checked, no errors found");
done();
});
});
});
});

File diff suppressed because it is too large Load Diff

View File

@ -11,16 +11,11 @@
"baseUrl": "./",
"strict": true,
"types": [],
"lib": [
"ESNext",
"DOM"
],
"lib": ["ESNext", "DOM"],
"paths": {
"pdfjs-dist": ["../../build/typestest"],
"pdfjs-dist/*": ["../../build/typestest/*"]
}
},
"exclude": [
"node_modules"
]
"exclude": ["node_modules"]
}

View File

@ -1,9 +1,7 @@
{
"spec_dir": "build/lib-legacy/test/unit",
"helpers": [
"clitests_helper.js"
],
"helpers": ["clitests_helper.js"],
"spec_files": [
"annotation_spec.js",

View File

@ -19,8 +19,5 @@
"web-l10n_utils": ["./web/l10n_utils"]
}
},
"files": [
"src/pdf.js",
"web/pdf_viewer.component.js"
]
"files": ["src/pdf.js", "web/pdf_viewer.component.js"]
}