Skip to content

Commit

Permalink
Use eclint to check the whitespaces and indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
fredj committed Aug 13, 2019
1 parent c65ee82 commit 28ffb43
Show file tree
Hide file tree
Showing 23 changed files with 59 additions and 100 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
root = true

[*]
end_of_line = lf
indent_style = space
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.js]
indent_size = 2
line_comment = //
block_comment_start = /*
block_comment = *
block_comment_end = */

[Makefile]
indent_style = tab
tab_width = 2
11 changes: 0 additions & 11 deletions .gitattributes

This file was deleted.

12 changes: 4 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ check-examples-checker: $(CHECK_EXAMPLE_CHECKER)
check-examples: $(BUILD_EXAMPLES_CHECK_TIMESTAMP_FILES)

.PHONY: lint
lint: .build/eslint.timestamp git-attributes eof-newline lint-extra
lint: .build/eslint.timestamp eclint lint-extra

.PHONY: lint-extra
lint-extra:
Expand All @@ -137,13 +137,9 @@ spell: .build/python-venv.timestamp
.PHONY: eslint
eslint: .build/eslint.timestamp

.PHONY: git-attributes
git-attributes:
git --no-pager diff --check `git log --oneline | tail -1 | cut -f 1 -d ' '`

.PHONY: eof-newline
eof-newline:
buildtools/test-eof-newline
.PHONY: eclint
eslint: .build/node_modules.timestamp
npm run eclint

.PHONY: test
test: .build/node_modules.timestamp .build/build-dll.timestamp
Expand Down
50 changes: 0 additions & 50 deletions buildtools/test-eof-newline

This file was deleted.

1 change: 1 addition & 0 deletions contribs/gmf/apps/desktop/sass/desktop.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//
1 change: 1 addition & 0 deletions contribs/gmf/apps/desktop/sass/vars_desktop.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//
1 change: 1 addition & 0 deletions contribs/gmf/apps/mobile/sass/mobile.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//
1 change: 1 addition & 0 deletions contribs/gmf/apps/mobile/sass/vars_mobile.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//
1 change: 1 addition & 0 deletions contribs/gmf/apps/mobile_alt/sass/vars_mobile_alt.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//
1 change: 1 addition & 0 deletions contribs/gmf/apps/oeedit/sass/vars_oeedit.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//
2 changes: 1 addition & 1 deletion contribs/gmf/examples/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function MainController(gettextCatalog) {
);
},
notValidMessage: gettextCatalog.getString('The new password must have at least 8 characters,'
+ 'including capital letter, small letter, digit and special character.')
+ 'including capital letter, small letter, digit and special character.')
};
}

Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/src/datasource/Helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export class DatasourceHelper {
const promises = [];
for (const attribute of attributes) {
if (enumAttributes.includes(attribute.name) &&
attribute.type !== ngeoFormatAttributeType.SELECT &&
(!attribute.choices || !attribute.choices.length)) {
attribute.type !== ngeoFormatAttributeType.SELECT &&
(!attribute.choices || !attribute.choices.length)) {
promises.push(
this.gmfEnumerateAttribute_.getAttributeValues(dataSource, attribute.name).then((values) => {
const choices = values.map(choice => choice.value);
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/filters/filterselectorComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class FilterSelectorController {
() => this.gmfSavedFilters.currentDataSourceItems,
() => {
if (this.gmfSavedFilters.currentDataSourceItems.length === 0 &&
this.saveFilterManageModalShown) {
this.saveFilterManageModalShown) {
this.saveFilterManageModalShown = false;
}
}
Expand Down
8 changes: 4 additions & 4 deletions contribs/gmf/src/lidarprofile/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ const module = angular.module('gmfLidarprofile', []);

module.value('gmfLidarprofileTemplateUrl',
/**
* @param {JQuery} $element Element.
* @param {angular.IAttributes} $attrs Attributes.
* @return {string} Template.
*/
* @param {JQuery} $element Element.
* @param {angular.IAttributes} $attrs Attributes.
* @return {string} Template.
*/
($element, $attrs) => {
const templateUrl = $attrs.gmfLidarprofileTemplateUrl;
return templateUrl !== undefined ? templateUrl :
Expand Down
6 changes: 3 additions & 3 deletions contribs/gmf/src/print/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,9 @@ export class PrintController {
// 'change' event listening is a workaround for IE11
this.rotationInput_.on('input change', (event) => {
const rotation = $(event.target).val();
if (typeof rotation == 'string') {
this.setRotation(parseFloat(rotation));
}
if (typeof rotation == 'string') {
this.setRotation(parseFloat(rotation));
}
});

/**
Expand Down
1 change: 1 addition & 0 deletions contribs/gmf/src/sass/mobile.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//
4 changes: 2 additions & 2 deletions contribs/gmf/src/theme/selectorComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ function gmfThemeSelectorTemplateUrl($attrs, gmfThemeSelectorTemplateUrl) {
* </span>
* </a>
* <gmf-themeselector class="dropdown-menu"
gmf-themeselector-currenttheme="mainCtrl.theme"
gmf-themeselector-filter="::mainCtrl.filter">
* gmf-themeselector-currenttheme="mainCtrl.theme"
* gmf-themeselector-filter="::mainCtrl.filter">
* </gmf-themeselector>
*
* The theme selector can operate in a 'flush' (as above) or 'add' mode. For more information
Expand Down
10 changes: 5 additions & 5 deletions examples/mapfishprint.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ function MainController($timeout, ngeoCreatePrint, ngeoPrintUtils) {
*/
const postcomposeListener = ngeoPrintUtils.createPrintMaskPostcompose(
/**
* @return {import("ol/size.js").Size} Size in dots of the map to print.
*/
* @return {import("ol/size.js").Size} Size in dots of the map to print.
*/
() => PRINT_PAPER_SIZE_,
/**
* @param {import('ol/PluggableMap.js').FrameState} frameState Frame state.
* @return {number} Scale of the map to print.
*/
* @param {import('ol/PluggableMap.js').FrameState} frameState Frame state.
* @return {number} Scale of the map to print.
*/
(frameState) => {
const mapSize = frameState.size;
const mapResolution = frameState.viewState.resolution;
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build-gmf-examples": "TARGET=gmf-examples webpack --mode=development --progress --debug",
"build-gmf-apps": "TARGET=gmf-apps webpack --mode=development --progress --debug",
"build-api": "webpack --config buildtools/webpack.api.js --mode=development --progress --debug",
"eclint": "eclint check $(git ls-files *[^secrets.tar.enc])",
"serve-ngeo-examples": "DEV_SERVER=1 TARGET=ngeo-examples webpack-dev-server --https --cert=private.crt --key=private.key --port=3000 --mode=development --progress --watch --debug",
"serve-gmf-examples": "DEV_SERVER=1 TARGET=gmf-examples webpack-dev-server --https --cert=private.crt --key=private.key --port=3000 --mode=development --progress --watch --debug",
"serve-gmf-apps": "DEV_SERVER=1 TARGET=gmf-apps webpack-dev-server --https --cert=private.crt --key=private.key --port=3000 --mode=development --progress --debug",
Expand Down Expand Up @@ -79,6 +80,7 @@
"corejs-typeahead": "^1.2.1",
"css-loader": "^3.0.0",
"d3": "^5.9.2",
"eclint": "^2.8.1",
"ejs-loader": "^0.3.3",
"eslint": "^6.0.0",
"eslint-config-openlayers": "^12.0.0",
Expand Down
8 changes: 4 additions & 4 deletions src/WFSDescribeFeatureType.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ WFSDescribeFeatureType.prototype.read;


/**
* @param {Document} doc Document.
* @return {Object} Object
* @param {Document} doc Document.
* @return {Object} Object
*/
WFSDescribeFeatureType.prototype.readFromDocument = function(doc) {
/** @type {?Node|ChildNode} */
Expand All @@ -132,8 +132,8 @@ WFSDescribeFeatureType.prototype.readFromDocument = function(doc) {


/**
* @param {Element} node Node.
* @return {Object} Object
* @param {Element} node Node.
* @return {Object} Object
*/
WFSDescribeFeatureType.prototype.readFromNode = function(node) {
let result = {};
Expand Down
2 changes: 1 addition & 1 deletion src/editing/createfeatureComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Controller.prototype.$onInit = function() {
)
);
} else if (interaction instanceof ngeoInteractionMeasureLength ||
interaction instanceof ngeoInteractionMeasureArea) {
interaction instanceof ngeoInteractionMeasureArea) {
this.ngeoEventHelper_.addListenerKey(
uid,
olEvents.listen(
Expand Down
8 changes: 2 additions & 6 deletions src/filter/RuleHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,7 @@ export class RuleHelper {
destRule.upperBoundary = sourceRule.upperBoundary;
}

if (sourceRule instanceof ngeoRuleGeometry &&
destRule instanceof ngeoRuleGeometry
) {
if (sourceRule instanceof ngeoRuleGeometry && destRule instanceof ngeoRuleGeometry) {
this.ngeoFeatureHelper_.clearNonSpatialProperties(destRule.feature);
destRule.feature.setProperties(
this.ngeoFeatureHelper_.getNonSpatialProperties(sourceRule.feature)
Expand Down Expand Up @@ -437,9 +435,7 @@ export class RuleHelper {
} else if (conditions.length >= 2) {
if (condition === ngeoFilterCondition.AND) {
mainFilter = olFormatFilter.and.apply(null, conditions);
} else if (condition === ngeoFilterCondition.OR ||
condition === ngeoFilterCondition.NOT
) {
} else if (condition === ngeoFilterCondition.OR || condition === ngeoFilterCondition.NOT) {
mainFilter = olFormatFilter.or.apply(null, conditions);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/interaction/ModifyCircle.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ export default class extends olInteractionPointer {
const nodesToRemove = [];
rBush.forEach(
/**
* @param {import("ol/interaction/Modify.js").SegmentData} node RTree node.
*/
* @param {import("ol/interaction/Modify.js").SegmentData} node RTree node.
*/
(node) => {
if (feature === node.feature) {
nodesToRemove.push(node);
Expand Down

0 comments on commit 28ffb43

Please sign in to comment.