Merge pull request #11488 from Snuffleupagus/web-no-nested-ternary

Enable the `no-nested-ternary` ESLint rule in the `web/` directory
This commit is contained in:
Tim van der Meij 2020-01-08 23:19:26 +01:00 committed by GitHub
commit 4729fdc0e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 12 deletions

View File

@ -136,6 +136,7 @@
"new-cap": ["error", { "newIsCap": true, "capIsNew": false, }],
"no-array-constructor": "error",
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 0, "maxBOF": 1, }],
"no-nested-ternary": "off",
"no-new-object": "error",
"spaced-comment": ["error", "always", {
"block": {

View File

@ -7,6 +7,9 @@
// Plugins
"import/no-unresolved": ["error", { "ignore": ["pdfjs-lib"]}],
// Stylistic Issues
"no-nested-ternary": "error",
// ECMAScript 6
"no-var": "error",
"prefer-const": "error",

View File

@ -1375,11 +1375,10 @@ const PDFViewerApplication = {
});
}
const formType = !info.IsAcroFormPresent
? null
: info.IsXFAPresent
? "xfa"
: "acroform";
let formType = null;
if (info.IsAcroFormPresent) {
formType = info.IsXFAPresent ? "xfa" : "acroform";
}
this.externalServices.reportTelemetry({
type: "documentInfo",
version: versionId,
@ -2066,13 +2065,14 @@ function webViewerNamedAction(evt) {
}
}
function webViewerPresentationModeChanged(evt) {
const { active, switchInProgress } = evt;
PDFViewerApplication.pdfViewer.presentationModeState = switchInProgress
? PresentationModeState.CHANGING
: active
? PresentationModeState.FULLSCREEN
: PresentationModeState.NORMAL;
function webViewerPresentationModeChanged({ active, switchInProgress }) {
let state = PresentationModeState.NORMAL;
if (switchInProgress) {
state = PresentationModeState.CHANGING;
} else if (active) {
state = PresentationModeState.FULLSCREEN;
}
PDFViewerApplication.pdfViewer.presentationModeState = state;
}
function webViewerSidebarViewChanged(evt) {