Skip to content

Commit

Permalink
Used Airbnb JavaScript style config for Eslint (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
azhavoro authored and nmanovic committed Jan 25, 2019
1 parent 062d145 commit 209dbbe
Show file tree
Hide file tree
Showing 26 changed files with 268 additions and 4 deletions.
35 changes: 35 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -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],
},
};
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ $ code .

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

The project uses [a successful Git branching model](https://nvie.com/posts/a-successful-git-branching-model).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
* SPDX-License-Identifier: MIT
*/

/* global
showMessage:false
*/

"use strict";

window.cvat = window.cvat || {};
Expand Down
12 changes: 12 additions & 0 deletions cvat/apps/dashboard/static/dashboard/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
* 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";
/* Server requests */
function createTaskRequest(oData, onSuccessRequest, onSuccessCreate, onError, onComplete, onUpdateStatus) {
Expand Down
6 changes: 5 additions & 1 deletion cvat/apps/documentation/static/documentation/js/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
* SPDX-License-Identifier: MIT
*/

/* global
Mousetrap:false
*/

Mousetrap.bind(window.cvat.config.shortkeys["open_help"].value, function() {
window.open("/documentation/user_guide.html");

return false;
});
});
5 changes: 5 additions & 0 deletions cvat/apps/engine/static/engine/js/annotationParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
*/

/* exported AnnotationParser */

/* global
PolyShapeModel:false
*/

"use strict";

class AnnotationParser {
Expand Down
44 changes: 44 additions & 0 deletions cvat/apps/engine/static/engine/js/annotationUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,50 @@
*/

/* 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";

function callAnnotationUI(jid) {
Expand Down
11 changes: 10 additions & 1 deletion cvat/apps/engine/static/engine/js/attributeAnnotationMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@
* 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";

const AAMUndefinedKeyword = '__undefined__';
Expand Down
6 changes: 5 additions & 1 deletion cvat/apps/engine/static/engine/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@
*/

/* exported
ExportType
confirm
createExportContainer
dumpAnnotationRequest
ExportType
getExportTargetContainer
showMessage
showOverlay
*/

/* global
Cookies:false
*/

"use strict";

Math.clamp = function(x, min, max) {
Expand Down
6 changes: 6 additions & 0 deletions cvat/apps/engine/static/engine/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
* SPDX-License-Identifier: MIT
*/

/* global
callAnnotationUI:false
Logger:false
platform:false
*/

"use strict";

String.prototype.normalize = function() {
Expand Down
4 changes: 4 additions & 0 deletions cvat/apps/engine/static/engine/js/checkPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
* SPDX-License-Identifier: MIT
*/

/* global
platform:false
*/

// legacy syntax for IE support

var supportedPlatforms = ['Chrome'];
Expand Down
12 changes: 12 additions & 0 deletions cvat/apps/engine/static/engine/js/history.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
/*
* Copyright (C) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*/

/* exported HistoryModel HistoryController HistoryView */

/* global
Listener:false
Logger:false
Mousetrap:false
*/
"use strict";

class HistoryModel extends Listener {
Expand Down
5 changes: 5 additions & 0 deletions cvat/apps/engine/static/engine/js/labelsInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
*/

/* exported LabelsInfo */

/* global
showMessage:false
*/

"use strict";

class LabelsInfo {
Expand Down
5 changes: 5 additions & 0 deletions cvat/apps/engine/static/engine/js/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
*/

/* exported Logger */

/* global
Cookies:false
*/

"use strict";

var UserActivityHandler = function()
Expand Down
9 changes: 9 additions & 0 deletions cvat/apps/engine/static/engine/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
*/

/* exported PlayerModel PlayerController PlayerView */

/* global
blurAllElements:false
copyToClipboard:false
Listener:false
Logger:false
Mousetrap:false
*/

"use strict";

class FrameProvider extends Listener {
Expand Down
8 changes: 8 additions & 0 deletions cvat/apps/engine/static/engine/js/polyshapeEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

/* exported PolyshapeEditorModel PolyshapeEditorController PolyshapeEditorView */

/* global
Listener:false
POINT_RADIUS:false
PolyShapeModel:false
STROKE_WIDTH:false
SVG:false
*/

"use strict";

class PolyshapeEditorModel extends Listener {
Expand Down
5 changes: 5 additions & 0 deletions cvat/apps/engine/static/engine/js/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
*/

/* exported serverRequest saveJobRequest encodeFilePathToURI */

/* global
showOverlay:false
*/

"use strict";

function serverRequest(url, successCallback)
Expand Down
13 changes: 13 additions & 0 deletions cvat/apps/engine/static/engine/js/shapeBuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
*/

/* 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";

class ShapeBufferModel extends Listener {
Expand Down
22 changes: 22 additions & 0 deletions cvat/apps/engine/static/engine/js/shapeCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@
*/

/* 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";

class ShapeCollectionModel extends Listener {
Expand Down
13 changes: 13 additions & 0 deletions cvat/apps/engine/static/engine/js/shapeCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
*/

/* 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";

class ShapeCreatorModel extends Listener {
Expand Down
8 changes: 8 additions & 0 deletions cvat/apps/engine/static/engine/js/shapeGrouper.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
*/

/* exported ShapeGrouperModel ShapeGrouperController ShapeGrouperView*/

/* global
Listener:false
Logger:false
Mousetrap:false
STROKE_WIDTH:false
*/

"use strict";

class ShapeGrouperModel extends Listener {
Expand Down
Loading

0 comments on commit 209dbbe

Please sign in to comment.