-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade Eslint from 3.18.0 to 4.19.0 #4820
Changes from 7 commits
28f20ed
cdc2856
af636ec
860d44c
0cdc197
90e6e0c
01911b5
09c685c
89fde6c
026e2eb
8f3c058
e33f064
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,9 +60,9 @@ oppia.directive('ratingDisplay', [ | |
for (var i = 0; i < $scope.stars.length; i++) { | ||
$scope.stars[i].cssClass = ( | ||
ratingValue === undefined ? 'fa-star-o' : | ||
ratingValue < $scope.stars[i].value - 0.75 ? 'fa-star-o' : | ||
ratingValue < $scope.stars[i].value - 0.25 ? 'fa-star-half-o' : | ||
'fa-star'); | ||
ratingValue < $scope.stars[i].value - 0.75 ? 'fa-star-o' : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way to force indent to happen only after "(", "[" and "{", but not be triggered by ":" or "?" or "&&", or ...? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking into this! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did look into this. Eslint does not provide any such option to force indent. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry -- what I meant was more along the lines of, preventing additional indenting after ":", "?", etc. I'm not sure it makes sense for those things to start a "new scope", as brackets do. Did this behaviour change recently with eslint? Is it worth writing a custom rule? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found out that there exists an option for ternary expressions, |
||
ratingValue < $scope.stars[i].value - 0.25 ? | ||
'fa-star-half-o' : 'fa-star'); | ||
|
||
if ($scope.status === STATUS_ACTIVE && | ||
ratingValue >= $scope.stars[i].value) { | ||
|
@@ -86,7 +86,7 @@ oppia.directive('ratingDisplay', [ | |
}; | ||
$scope.enterStar = function(starValue) { | ||
if ( | ||
$scope.isEditable && | ||
$scope.isEditable && | ||
($scope.status === STATUS_ACTIVE || | ||
$scope.status === STATUS_INACTIVE)) { | ||
$scope.status = STATUS_ACTIVE; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,7 +148,7 @@ oppia.factory('StateGraphLayoutService', [ | |
if (numBacktrackingCalls <= MAX_BACKTRACKING_CALLS) { | ||
for (var i = 0; i < adjacencyLists[currentNodeId].length; i++) { | ||
if (currentPath.indexOf( | ||
adjacencyLists[currentNodeId][i]) === -1) { | ||
adjacencyLists[currentNodeId][i]) === -1) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to have custom rule that indents this additionally by 2 (since the if clause spans a continuation line), similar to Python. OK to do this in a separate pass. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I have added it to my draft :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @seanlip: I tried this out but the present indent rule raises an error if we indent L151 further by 2 spaces. Since consistency is still maintained throughout the codebase, we can adopt these indent settings. How does this sound? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there isn't a way to enforce the "additional indent by 2" (similar to https://legacy.python.org/dev/peps/pep-0008/#indentation for python) then I'm fine with the new convention. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eslint offers
Therefore I think it would be better if we adopted the new convention. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, happy to defer to your call. Thanks for the explanation! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great! Let's go ahead with the new convention then. Thanks :) |
||
backtrack(adjacencyLists[currentNodeId][i]); | ||
} | ||
} | ||
|
@@ -244,7 +244,7 @@ oppia.factory('StateGraphLayoutService', [ | |
nodeData[linkTarget].depth = nodeData[currNodeId].depth + 1; | ||
nodeData[linkTarget].offset = ( | ||
nodeData[linkTarget].depth in maxOffsetInEachLevel ? | ||
maxOffsetInEachLevel[nodeData[linkTarget].depth] + 1 : 0); | ||
maxOffsetInEachLevel[nodeData[linkTarget].depth] + 1 : 0); | ||
|
||
maxDepth = Math.max(maxDepth, nodeData[linkTarget].depth); | ||
maxOffsetInEachLevel[nodeData[linkTarget].depth] = ( | ||
|
@@ -497,10 +497,10 @@ oppia.factory('StateGraphLayoutService', [ | |
if (dx === 0 || dy !== 0) { | ||
startCutoff = ( | ||
(dx === 0) ? (sourceHeight / 2) / Math.abs(dy) : | ||
Math.min(startCutoff, (sourceHeight / 2) / Math.abs(dy))); | ||
Math.min(startCutoff, (sourceHeight / 2) / Math.abs(dy))); | ||
endCutoff = ( | ||
(dx === 0) ? (targetHeight / 2) / Math.abs(dy) : | ||
Math.min(endCutoff, (targetHeight / 2) / Math.abs(dy))); | ||
Math.min(endCutoff, (targetHeight / 2) / Math.abs(dy))); | ||
} | ||
|
||
var dxperp = targety - sourcey; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,8 +105,8 @@ oppia.filter('convertUnicodeWithParamsToHtml', ['$filter', function($filter) { | |
textFragments.forEach(function(fragment) { | ||
result += ( | ||
fragment.type === 'text' ? | ||
$filter('convertUnicodeToHtml')(fragment.data) : | ||
'<oppia-parameter>' + fragment.data + | ||
$filter('convertUnicodeToHtml')(fragment.data) : | ||
'<oppia-parameter>' + fragment.data + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure I understand the indentation logic here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking into the ternary operators. Thanks! |
||
'</oppia-parameter>'); | ||
}); | ||
return result; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems weird. Why is it indented at this level?
EDIT: Ah, it's because that's where the left paren opens. In this case move this to the end of the previous line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, got it!