Used Airbnb JavaScript style config for Eslint (#300)

main
Andrey Zhavoronkov 7 years ago committed by Nikita Manovich
parent 062d145fcf
commit 209dbbe4e7

@ -0,0 +1,35 @@
/*
* Copyright (C) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*/
module.exports = {
"env": {
"node": false,
"browser": true,
"es6": true,
"jquery": true,
"qunit": true,
},
"parserOptions": {
"sourceType": "script",
},
"plugins": [
"security",
"no-unsanitized",
"no-unsafe-innerhtml",
],
"extends": [
"eslint:recommended",
"plugin:security/recommended",
"plugin:no-unsanitized/DOM",
"airbnb",
],
"rules": {
"no-unsafe-innerhtml/no-unsafe-innerhtml": 1,
// This rule actual for user input data on the node.js environment mainly.
"security/detect-object-injection": 0,
"indent": ["warn", 4],
},
};

@ -57,6 +57,11 @@ $ code .
You have done! Now it is possible to insert breakpoints and debug server and client of the tool. You have done! Now it is possible to insert breakpoints and debug server and client of the tool.
## JavaScript coding style
We use the [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript) for JavaScript code with a
litle exception - we prefere 4 spaces for indentation of nested blocks and statements.
## Branching model ## Branching model
The project uses [a successful Git branching model](https://nvie.com/posts/a-successful-git-branching-model). The project uses [a successful Git branching model](https://nvie.com/posts/a-successful-git-branching-model).

@ -4,6 +4,10 @@
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */
/* global
showMessage:false
*/
"use strict"; "use strict";
window.cvat = window.cvat || {}; window.cvat = window.cvat || {};

@ -4,6 +4,18 @@
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */
/* global
AnnotationParser:false
Config:false
confirm:false
ConstIdGenerator:false
createExportContainer:false
dumpAnnotationRequest:false
LabelsInfo:false
showMessage:false
showOverlay:false
*/
"use strict"; "use strict";
/* Server requests */ /* Server requests */
function createTaskRequest(oData, onSuccessRequest, onSuccessCreate, onError, onComplete, onUpdateStatus) { function createTaskRequest(oData, onSuccessRequest, onSuccessCreate, onError, onComplete, onUpdateStatus) {

@ -4,8 +4,12 @@
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */
/* global
Mousetrap:false
*/
Mousetrap.bind(window.cvat.config.shortkeys["open_help"].value, function() { Mousetrap.bind(window.cvat.config.shortkeys["open_help"].value, function() {
window.open("/documentation/user_guide.html"); window.open("/documentation/user_guide.html");
return false; return false;
}); });

@ -5,6 +5,11 @@
*/ */
/* exported AnnotationParser */ /* exported AnnotationParser */
/* global
PolyShapeModel:false
*/
"use strict"; "use strict";
class AnnotationParser { class AnnotationParser {

@ -5,6 +5,50 @@
*/ */
/* exported callAnnotationUI blurAllElements drawBoxSize copyToClipboard */ /* exported callAnnotationUI blurAllElements drawBoxSize copyToClipboard */
/* global
AAMController:false
AAMModel:false
AAMView:false
AnnotationParser:false
Config:false
confirm:false
CoordinateTranslator:false
dumpAnnotationRequest:false
HistoryController:false
HistoryModel:false
HistoryView:false
IncrementIdGenerator:false,
Logger:false
Mousetrap:false
PlayerController:false
PlayerModel:false
PlayerView:false
PolyshapeEditorController:false
PolyshapeEditorModel:false
PolyshapeEditorView:false
PolyShapeView:false
saveJobRequest:false
serverRequest:false
ShapeBufferController:false
ShapeBufferModel:false
ShapeBufferView:false
ShapeCollectionController:false
ShapeCollectionModel:false
ShapeCollectionView:false
ShapeCreatorController:false
ShapeCreatorModel:false
ShapeCreatorView:false
ShapeGrouperController:false
ShapeGrouperModel:false
ShapeGrouperView:false
ShapeMergerController:false
ShapeMergerModel:false
ShapeMergerView:false
showMessage:false
showOverlay:false
*/
"use strict"; "use strict";
function callAnnotationUI(jid) { function callAnnotationUI(jid) {

@ -4,7 +4,16 @@
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */
/* exported AAMModel AAMController AAMView */ /* exported AAMModel AAMController AAMView AAMUndefinedKeyword */
/* global
Listener:false
Logger:false
Mousetrap:false
PolyShapeModel:false
SVG:false
*/
"use strict"; "use strict";
const AAMUndefinedKeyword = '__undefined__'; const AAMUndefinedKeyword = '__undefined__';

@ -5,15 +5,19 @@
*/ */
/* exported /* exported
ExportType
confirm confirm
createExportContainer createExportContainer
dumpAnnotationRequest dumpAnnotationRequest
ExportType
getExportTargetContainer getExportTargetContainer
showMessage showMessage
showOverlay showOverlay
*/ */
/* global
Cookies:false
*/
"use strict"; "use strict";
Math.clamp = function(x, min, max) { Math.clamp = function(x, min, max) {

@ -4,6 +4,12 @@
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */
/* global
callAnnotationUI:false
Logger:false
platform:false
*/
"use strict"; "use strict";
String.prototype.normalize = function() { String.prototype.normalize = function() {

@ -4,6 +4,10 @@
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */
/* global
platform:false
*/
// legacy syntax for IE support // legacy syntax for IE support
var supportedPlatforms = ['Chrome']; var supportedPlatforms = ['Chrome'];

@ -1,4 +1,16 @@
/*
* Copyright (C) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*/
/* exported HistoryModel HistoryController HistoryView */ /* exported HistoryModel HistoryController HistoryView */
/* global
Listener:false
Logger:false
Mousetrap:false
*/
"use strict"; "use strict";
class HistoryModel extends Listener { class HistoryModel extends Listener {

@ -5,6 +5,11 @@
*/ */
/* exported LabelsInfo */ /* exported LabelsInfo */
/* global
showMessage:false
*/
"use strict"; "use strict";
class LabelsInfo { class LabelsInfo {

@ -5,6 +5,11 @@
*/ */
/* exported Logger */ /* exported Logger */
/* global
Cookies:false
*/
"use strict"; "use strict";
var UserActivityHandler = function() var UserActivityHandler = function()

@ -5,6 +5,15 @@
*/ */
/* exported PlayerModel PlayerController PlayerView */ /* exported PlayerModel PlayerController PlayerView */
/* global
blurAllElements:false
copyToClipboard:false
Listener:false
Logger:false
Mousetrap:false
*/
"use strict"; "use strict";
class FrameProvider extends Listener { class FrameProvider extends Listener {

@ -6,6 +6,14 @@
/* exported PolyshapeEditorModel PolyshapeEditorController PolyshapeEditorView */ /* exported PolyshapeEditorModel PolyshapeEditorController PolyshapeEditorView */
/* global
Listener:false
POINT_RADIUS:false
PolyShapeModel:false
STROKE_WIDTH:false
SVG:false
*/
"use strict"; "use strict";
class PolyshapeEditorModel extends Listener { class PolyshapeEditorModel extends Listener {

@ -5,6 +5,11 @@
*/ */
/* exported serverRequest saveJobRequest encodeFilePathToURI */ /* exported serverRequest saveJobRequest encodeFilePathToURI */
/* global
showOverlay:false
*/
"use strict"; "use strict";
function serverRequest(url, successCallback) function serverRequest(url, successCallback)

@ -5,6 +5,19 @@
*/ */
/* exported ShapeBufferModel ShapeBufferController ShapeBufferView */ /* exported ShapeBufferModel ShapeBufferController ShapeBufferView */
/* global
AREA_TRESHOLD:false
confirm:false
Listener:false
Logger:false
Mousetrap:false
POINT_RADIUS:false
PolyShapeModel:false
STROKE_WIDTH:false
SVG:false
*/
"use strict"; "use strict";
class ShapeBufferModel extends Listener { class ShapeBufferModel extends Listener {

@ -5,6 +5,28 @@
*/ */
/* exported ShapeCollectionModel ShapeCollectionController ShapeCollectionView */ /* exported ShapeCollectionModel ShapeCollectionController ShapeCollectionView */
/* global
buildShapeController:false
buildShapeModel:false
buildShapeView:false
copyToClipboard:false
createExportContainer:false
ExportType:false
FilterController:false
FilterModel:false
FilterView:false
getExportTargetContainer:false
Listener:false
Logger:false
Mousetrap:false
POINT_RADIUS:false
SELECT_POINT_STROKE_WIDTH:false
ShapeSplitter:false
STROKE_WIDTH:false
SVG:false
*/
"use strict"; "use strict";
class ShapeCollectionModel extends Listener { class ShapeCollectionModel extends Listener {

@ -5,6 +5,19 @@
*/ */
/* exported ShapeCreatorModel ShapeCreatorController ShapeCreatorView */ /* exported ShapeCreatorModel ShapeCreatorController ShapeCreatorView */
/* global
AREA_TRESHOLD:false
drawBoxSize:false
Listener:false
Logger:false
Mousetrap:false
PolyShapeModel:false
showMessage:false
STROKE_WIDTH:false
SVG:false
*/
"use strict"; "use strict";
class ShapeCreatorModel extends Listener { class ShapeCreatorModel extends Listener {

@ -5,6 +5,14 @@
*/ */
/* exported ShapeGrouperModel ShapeGrouperController ShapeGrouperView*/ /* exported ShapeGrouperModel ShapeGrouperController ShapeGrouperView*/
/* global
Listener:false
Logger:false
Mousetrap:false
STROKE_WIDTH:false
*/
"use strict"; "use strict";
class ShapeGrouperModel extends Listener { class ShapeGrouperModel extends Listener {

@ -5,6 +5,13 @@
*/ */
/* exported ShapeMergerModel ShapeMergerController ShapeMergerView*/ /* exported ShapeMergerModel ShapeMergerController ShapeMergerView*/
/* global
Listener:false
Logger:false
Mousetrap:false
*/
"use strict"; "use strict";
class ShapeMergerModel extends Listener { class ShapeMergerModel extends Listener {

@ -4,7 +4,19 @@
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */
/* exported PolyShapeModel buildShapeModel buildShapeController buildShapeView */ /* exported PolyShapeModel buildShapeModel buildShapeController buildShapeView PolyShapeView */
/* global
AAMUndefinedKeyword:false
blurAllElements:false
drawBoxSize:false
Listener:false
Logger:false
Mousetrap:false
ShapeCollectionView:false
SVG:false
*/
"use strict"; "use strict";
const STROKE_WIDTH = 2.5; const STROKE_WIDTH = 2.5;

@ -4,6 +4,10 @@
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */
/* global
showMessage:false
*/
"use strict"; "use strict";
window.cvat = window.cvat || {}; window.cvat = window.cvat || {};

@ -4,6 +4,10 @@
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */
/* global
Mousetrap:false
*/
Mousetrap.bind(window.cvat.config.shortkeys["open_analytics"].value, function() { Mousetrap.bind(window.cvat.config.shortkeys["open_analytics"].value, function() {
window.open("/analytics/app/kibana"); window.open("/analytics/app/kibana");

@ -4,6 +4,11 @@
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */
/* global
confirm:false
showMessage:false
*/
"use strict"; "use strict";
function CheckTFAnnotationRequest(taskId, tfAnnotationButton) { function CheckTFAnnotationRequest(taskId, tfAnnotationButton) {

Loading…
Cancel
Save