Skip to content

Commit be7366a

Browse files
committed
Change ESLint comma-dangle to always-multiline, except for function args
1 parent 9eb38ff commit be7366a

9 files changed

+43
-35
lines changed

assets/js/.eslintrc.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@
99
"array-callback-return": "error",
1010
"block-spacing": "error",
1111
"camelcase": "error",
12-
"comma-dangle": "error",
12+
"comma-dangle": [
13+
"error", {
14+
"arrays": "always-multiline",
15+
"objects": "always-multiline",
16+
"imports": "always-multiline",
17+
"exports": "always-multiline",
18+
"functions": "never"
19+
}
20+
],
1321
"comma-spacing": "error",
1422
"curly": "error",
1523
"eol-last": "error",

assets/js/analyzer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function getAnalyzers() /*: JQueryPromise<any> */ {
7474
complete: function () {
7575
ajaxComplete();
7676
deferred.resolve();
77-
}
77+
},
7878
});
7979
}
8080
}
@@ -167,14 +167,14 @@ function analyze() {
167167
currentAnalyzerRequest = callApy({
168168
data: {
169169
'lang': analyzerMode,
170-
'q': input
170+
'q': input,
171171
},
172172
success: handleAnalyzeSuccessResponse,
173173
error: handleAnalyzeErrorResponse,
174174
complete: function () {
175175
ajaxComplete();
176176
currentAnalyzerRequest = null;
177-
}
177+
},
178178
}, '/analyze');
179179
}
180180

assets/js/generator.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function getGenerators() /*: JQueryPromise<any> */ {
7474
complete: function (_xOptions, _errorThrown) {
7575
ajaxComplete();
7676
deferred.resolve();
77-
}
77+
},
7878
});
7979
}
8080
}
@@ -167,14 +167,14 @@ function generate() {
167167
currentGeneratorRequest = callApy({
168168
data: {
169169
'lang': generatorMode,
170-
'q': input
170+
'q': input,
171171
},
172172
success: handleGenerateSuccessResponse,
173173
error: handleGenerateErrorResponse,
174174
complete: function () {
175175
ajaxComplete();
176176
currentGeneratorRequest = null;
177-
}
177+
},
178178
}, '/generate');
179179
}
180180

assets/js/init.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $(document).ajaxComplete(ajaxComplete);
1212
$(document).ajaxError(ajaxComplete);
1313

1414
$.jsonp.setup({
15-
callbackParameter: 'callback'
15+
callbackParameter: 'callback',
1616
});
1717

1818
$(document).ready(function () {
@@ -120,7 +120,7 @@ $(document).ready(function () {
120120

121121
$('#backToTop').click(function () {
122122
$('html, body').animate({
123-
scrollTop: 0
123+
scrollTop: 0,
124124
}, 'fast');
125125
return false;
126126
});

assets/js/localization.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ var dynamicLocalizations /*: {[lang: string]: {[string]: string}} */ = {
2121
'detected': 'detected',
2222
'File_Too_Large': 'File is too large!',
2323
'Format_Not_Supported': 'Format not supported!',
24-
'Download_File': 'Download {{fileName}}'
25-
}
24+
'Download_File': 'Download {{fileName}}',
25+
},
2626
};
2727

2828
function getDynamicLocalization(stringKey /*: string */) /*: string */ {
@@ -167,7 +167,7 @@ function getLocale() {
167167
complete: function (_xOptions, _errorThrown) {
168168
ajaxComplete();
169169
deferred.resolve();
170-
}
170+
},
171171
});
172172
}
173173
else {
@@ -207,7 +207,7 @@ function getLocales() {
207207
error: function (jqXHR, textStatus, error) {
208208
console.error('Failed to fetch available locales: ' + error);
209209
deferred.resolve();
210-
}
210+
},
211211
});
212212
}
213213
}
@@ -287,7 +287,7 @@ function localizeLanguageNames(localizedNamesFromJSON) {
287287
},
288288
error: function (_xOptions, _error) {
289289
localizedLanguageNames = {};
290-
}
290+
},
291291
});
292292
}
293293
}
@@ -336,7 +336,7 @@ function localizeStrings(stringsFresh /*: boolean */) {
336336
},
337337
error: function (jqXHR, textStatus, errorThrow) {
338338
console.error('Failed to fetch localized strings for ' + locale + ': ' + errorThrow);
339-
}
339+
},
340340
});
341341
}
342342
}
@@ -385,7 +385,7 @@ function localizeInterface() {
385385
'#originalText': curSrcLang,
386386
'#translatedText': curDstLang,
387387
'#morphAnalyzerInput': $('#primaryAnalyzerMode').val(),
388-
'#morphGeneratorInput': $('#primaryGeneratorMode').val()
388+
'#morphGeneratorInput': $('#primaryGeneratorMode').val(),
389389
};
390390

391391
$.each(elements, function (selector, lang /*: string */) {

assets/js/persistence.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var URL_PARAM_Q_LIMIT = 1300,
1414
'#webpageTranslation': 'qP',
1515
'#analyzation': 'qA',
1616
'#generation': 'qG',
17-
'#sandbox': 'qS'
17+
'#sandbox': 'qS',
1818
};
1919

2020
var store = new Store(config.HTML_URL);
@@ -57,31 +57,31 @@ function persistChoices(mode /*: string */, updatePermalink /*: ?boolean */) {
5757
'webpageInput': $('#webpage').val(),
5858
'instantTranslation': $('#instantTranslation').prop('checked'),
5959
'markUnknown': $('#markUnknown').prop('checked'),
60-
'chainedTranslation': $('#chainedTranslation').prop('checked')
60+
'chainedTranslation': $('#chainedTranslation').prop('checked'),
6161
};
6262
}
6363
else if(mode === 'analyzer') {
6464
objects = {
6565
'primaryAnalyzerChoice': $('#primaryAnalyzerMode').val(),
6666
'secondaryAnalyzerChoice': $('#secondaryAnalyzerMode').val(),
67-
'analyzerInput': $('#morphAnalyzerInput').val()
67+
'analyzerInput': $('#morphAnalyzerInput').val(),
6868
};
6969
}
7070
else if(mode === 'generator') {
7171
objects = {
7272
'primaryGeneratorChoice': $('#primaryGeneratorMode').val(),
7373
'secondaryGeneratorChoice': $('#secondaryGeneratorMode').val(),
74-
'generatorInput': $('#morphGeneratorInput').val()
74+
'generatorInput': $('#morphGeneratorInput').val(),
7575
};
7676
}
7777
else if(mode === 'localization') {
7878
objects = {
79-
'locale': $('.localeSelect').val()
79+
'locale': $('.localeSelect').val(),
8080
};
8181
}
8282
else if(mode === 'sandbox') {
8383
objects = {
84-
'sandboxInput': $('#sandboxInput').val()
84+
'sandboxInput': $('#sandboxInput').val(),
8585
};
8686
}
8787

assets/js/sandbox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function request() {
5353
ajaxComplete();
5454
$('#time').text(new Date().getTime() - startTime + ' ms');
5555
currentSandboxRequest = null;
56-
}
56+
},
5757
});
5858
}
5959

assets/js/translator.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ if(modeEnabled('translation')) {
7979

8080
$('input#webpage').attr({
8181
'required': false,
82-
'novalidate': true
82+
'novalidate': true,
8383
});
8484

8585
$('div#translateWebpage').fadeOut('fast', function () {
@@ -404,7 +404,7 @@ function getPairs() /*: JQueryPromise<any> */ {
404404
complete: function (_xOptions, _errorThrown) {
405405
ajaxComplete();
406406
deferred.resolve();
407-
}
407+
},
408408
});
409409
}
410410
}
@@ -806,7 +806,7 @@ function translateText(ignoreIfEmpty) {
806806
var endpoint/*: string */;
807807
var request /*: { langpairs?: string, langpair?: string, q: string, markUnknown: string } */ = {
808808
q: originalText, // eslint-disable-line id-length
809-
markUnknown: $('#markUnknown').prop('checked') ? 'yes' : 'no'
809+
markUnknown: $('#markUnknown').prop('checked') ? 'yes' : 'no',
810810
};
811811

812812
if($('input#chainedTranslation').prop('checked') && config.TRANSLATION_CHAINING) {
@@ -825,7 +825,7 @@ function translateText(ignoreIfEmpty) {
825825
complete: function () {
826826
ajaxComplete();
827827
translateRequest = null;
828-
}
828+
},
829829
}, endpoint);
830830
}
831831
else {
@@ -858,7 +858,7 @@ function translateDoc() {
858858
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
859859
// 'application/msword', 'application/vnd.ms-powerpoint', 'application/vnd.ms-excel'
860860
'application/vnd.oasis.opendocument.text',
861-
'application/x-latex', 'application/x-tex'
861+
'application/x-latex', 'application/x-tex',
862862
];
863863

864864
if(allowedMimeTypes.indexOf(file.type) !== -1) {
@@ -1059,7 +1059,7 @@ function translateWebpage(ignoreIfEmpty /*: ?boolean */) {
10591059
data: {
10601060
'langpair': curSrcLang + '|' + curDstLang,
10611061
'markUnknown': 'no',
1062-
'url': url
1062+
'url': url,
10631063
},
10641064
dataType: 'json',
10651065
success: handleTranslateWebpageSuccessResponse,
@@ -1068,7 +1068,7 @@ function translateWebpage(ignoreIfEmpty /*: ?boolean */) {
10681068
ajaxComplete();
10691069
translateRequest = null;
10701070
$('iframe#translatedWebpage').animate({'opacity': 1}, 'fast');
1071-
}
1071+
},
10721072
}, '/translatePage', true);
10731073
}
10741074
}
@@ -1079,7 +1079,7 @@ function showTranslateWebpageInterface(url /*: ?string */, ignoreIfEmpty /*: ?bo
10791079
$('div#translateText').fadeOut('fast', function () {
10801080
$('input#webpage').attr({
10811081
'required': true,
1082-
'novalidate': false
1082+
'novalidate': false,
10831083
});
10841084
$('button#cancelTranslateWebpage').fadeIn('fast').addClass('cancelTranslateWebpage');
10851085
$('div#translateWebpage').fadeIn('fast');
@@ -1136,14 +1136,14 @@ function detectLanguage() {
11361136

11371137
translateRequest = callApy({
11381138
data: {
1139-
'q': originalText
1139+
'q': originalText,
11401140
},
11411141
success: handleDetectLanguageSuccessResponse,
11421142
error: handleDetectLanguageErrorResponse,
11431143
complete: function () {
11441144
ajaxComplete();
11451145
translateRequest = null;
1146-
}
1146+
},
11471147
}, '/identifyLang');
11481148

11491149
return translateRequest;

assets/js/util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function synchronizeTextareaHeights() {
209209

210210
$('#originalText').css({
211211
'overflow-y': 'hidden',
212-
'height': 'auto'
212+
'height': 'auto',
213213
});
214214
var originalTextScrollHeight = $('#originalText')[0].scrollHeight;
215215
$('#originalText').css('height', originalTextScrollHeight + 'px');
@@ -220,7 +220,7 @@ function callApy(options /*: {} */, endpoint /*: string */, useAjax /*: ?boolean
220220
var requestOptions /*: any */ = Object.assign({
221221
url: config.APY_URL + endpoint,
222222
beforeSend: ajaxSend,
223-
contentType: 'application/x-www-form-urlencoded; charset=UTF-8'
223+
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
224224
}, options);
225225

226226
var requestUrl /*: string */ = window.location.protocol + window.location.hostname +

0 commit comments

Comments
 (0)