Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9c96399c
Commit
9c96399c
authored
Apr 29, 2020
by
Justin Ho Tuan Duong
Committed by
Mike Greiling
Apr 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix no-else-return eslint rule
Fix all JS files
parent
52661728
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
74 additions
and
110 deletions
+74
-110
.eslintrc.yml
.eslintrc.yml
+5
-5
app/assets/javascripts/commit/image_file.js
app/assets/javascripts/commit/image_file.js
+2
-3
app/assets/javascripts/compare_autocomplete.js
app/assets/javascripts/compare_autocomplete.js
+2
-3
app/assets/javascripts/diff_notes/components/comment_resolve_btn.js
.../javascripts/diff_notes/components/comment_resolve_btn.js
+6
-15
app/assets/javascripts/diff_notes/components/jump_to_discussion.js
...s/javascripts/diff_notes/components/jump_to_discussion.js
+4
-7
app/assets/javascripts/labels_select.js
app/assets/javascripts/labels_select.js
+3
-5
app/assets/javascripts/lib/utils/text_markdown.js
app/assets/javascripts/lib/utils/text_markdown.js
+2
-3
app/assets/javascripts/line_highlighter.js
app/assets/javascripts/line_highlighter.js
+3
-5
app/assets/javascripts/milestone_select.js
app/assets/javascripts/milestone_select.js
+8
-11
app/assets/javascripts/namespace_select.js
app/assets/javascripts/namespace_select.js
+2
-6
app/assets/javascripts/new_branch_form.js
app/assets/javascripts/new_branch_form.js
+2
-3
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+3
-4
app/assets/javascripts/project_select.js
app/assets/javascripts/project_select.js
+11
-12
app/assets/javascripts/syntax_highlight.js
app/assets/javascripts/syntax_highlight.js
+6
-7
app/assets/javascripts/tree.js
app/assets/javascripts/tree.js
+2
-3
app/assets/javascripts/users_select.js
app/assets/javascripts/users_select.js
+8
-11
ee/app/assets/javascripts/weight_select.js
ee/app/assets/javascripts/weight_select.js
+2
-3
spec/javascripts/line_highlighter_spec.js
spec/javascripts/line_highlighter_spec.js
+3
-4
No files found.
.eslintrc.yml
View file @
9c96399c
...
...
@@ -22,17 +22,17 @@ rules:
-
allow
:
-
__
-
_links
# Disabled for now, to make the airbnb-base 12.1.0 -> 13.1.0 update smoother
no-else-return
:
-
error
-
allowElseIf
:
true
import/no-unresolved
:
-
error
-
ignore
:
# https://gitlab.com/gitlab-org/gitlab/issues/38226
-
'
^ee_component/'
import/no-useless-path-segments
:
off
import/order
:
off
# Disabled for now, to make the airbnb-base 12.1.0 -> 13.1.0 update smoother
no-else-return
:
-
error
-
allowElseIf
:
true
import/no-useless-path-segments
:
off
lines-between-class-members
:
off
# Disabled for now, to make the plugin-vue 4.5 -> 5.0 update smoother
vue/no-confusing-v-for-v-if
:
error
...
...
app/assets/javascripts/commit/image_file.js
View file @
9c96399c
/* eslint-disable func-names,
no-else-return,
consistent-return, one-var, no-return-assign */
/* eslint-disable func-names, consistent-return, one-var, no-return-assign */
import
$
from
'
jquery
'
;
...
...
@@ -201,9 +201,8 @@ export default class ImageFile {
if
(
domImg
)
{
if
(
domImg
.
complete
)
{
return
callback
.
call
(
this
,
domImg
.
naturalWidth
,
domImg
.
naturalHeight
);
}
else
{
return
img
.
on
(
'
load
'
,
()
=>
callback
.
call
(
this
,
domImg
.
naturalWidth
,
domImg
.
naturalHeight
));
}
return
img
.
on
(
'
load
'
,
()
=>
callback
.
call
(
this
,
domImg
.
naturalWidth
,
domImg
.
naturalHeight
));
}
}
}
app/assets/javascripts/compare_autocomplete.js
View file @
9c96399c
/* eslint-disable func-names
, no-else-return
*/
/* eslint-disable func-names */
import
$
from
'
jquery
'
;
import
{
__
}
from
'
./locale
'
;
...
...
@@ -52,9 +52,8 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = (
return
$
(
'
<li />
'
)
.
addClass
(
'
dropdown-header
'
)
.
text
(
ref
.
header
);
}
else
{
return
$
(
'
<li />
'
).
append
(
link
);
}
return
$
(
'
<li />
'
).
append
(
link
);
},
id
(
obj
,
$el
)
{
return
$el
.
attr
(
'
data-ref
'
);
...
...
app/assets/javascripts/diff_notes/components/comment_resolve_btn.js
View file @
9c96399c
/* eslint-disable no-else-return, no-lonely-if */
/* global CommentsStore */
import
$
from
'
jquery
'
;
...
...
@@ -22,27 +21,19 @@ const CommentAndResolveBtn = Vue.extend({
showButton
()
{
if
(
this
.
discussion
)
{
return
this
.
discussion
.
isResolvable
();
}
else
{
return
false
;
}
return
false
;
},
isDiscussionResolved
()
{
return
this
.
discussion
.
isResolved
();
},
buttonText
()
{
if
(
this
.
isDiscussionResolved
)
{
if
(
this
.
textareaIsEmpty
)
{
return
__
(
'
Unresolve thread
'
);
}
else
{
return
__
(
'
Comment & unresolve thread
'
);
}
}
else
{
if
(
this
.
textareaIsEmpty
)
{
return
__
(
'
Resolve thread
'
);
}
else
{
return
__
(
'
Comment & resolve thread
'
);
}
if
(
this
.
textareaIsEmpty
)
{
return
this
.
isDiscussionResolved
?
__
(
'
Unresolve thread
'
)
:
__
(
'
Resolve thread
'
);
}
return
this
.
isDiscussionResolved
?
__
(
'
Comment & unresolve thread
'
)
:
__
(
'
Comment & resolve thread
'
);
},
},
created
()
{
...
...
app/assets/javascripts/diff_notes/components/jump_to_discussion.js
View file @
9c96399c
/* eslint-disable func-names,
no-else-return,
guard-for-in, no-restricted-syntax, no-lonely-if, no-continue */
/* eslint-disable func-names, guard-for-in, no-restricted-syntax, no-lonely-if, no-continue */
/* global CommentsStore */
import
$
from
'
jquery
'
;
...
...
@@ -25,9 +25,8 @@ const JumpToDiscussion = Vue.extend({
buttonText
()
{
if
(
this
.
discussionId
)
{
return
__
(
'
Jump to next unresolved thread
'
);
}
else
{
return
__
(
'
Jump to first unresolved thread
'
);
}
return
__
(
'
Jump to first unresolved thread
'
);
},
allResolved
()
{
return
this
.
unresolvedDiscussionCount
===
0
;
...
...
@@ -36,12 +35,10 @@ const JumpToDiscussion = Vue.extend({
if
(
this
.
discussionId
)
{
if
(
this
.
unresolvedDiscussionCount
>
1
)
{
return
true
;
}
else
{
return
this
.
discussionId
!==
this
.
lastResolvedId
;
}
}
else
{
return
this
.
unresolvedDiscussionCount
>=
1
;
return
this
.
discussionId
!==
this
.
lastResolvedId
;
}
return
this
.
unresolvedDiscussionCount
>=
1
;
},
lastResolvedId
()
{
let
lastId
;
...
...
app/assets/javascripts/labels_select.js
View file @
9c96399c
/* eslint-disable no-useless-return, func-names, no-underscore-dangle, no-new, consistent-return, no-shadow, no-param-reassign, no-lonely-if,
no-else-return,
dot-notation, no-empty */
/* eslint-disable no-useless-return, func-names, no-underscore-dangle, no-new, consistent-return, no-shadow, no-param-reassign, no-lonely-if, dot-notation, no-empty */
/* global Issuable */
/* global ListLabel */
...
...
@@ -311,9 +311,8 @@ export default class LabelsSelect {
firstLabel
:
selectedLabels
[
0
],
labelCount
:
selectedLabels
.
length
-
1
,
});
}
else
{
return
defaultLabel
;
}
return
defaultLabel
;
},
fieldName
:
$dropdown
.
data
(
'
fieldName
'
),
id
(
label
)
{
...
...
@@ -325,9 +324,8 @@ export default class LabelsSelect {
if
(
$dropdown
.
hasClass
(
'
js-filter-submit
'
)
&&
label
.
isAny
==
null
)
{
return
label
.
title
;
}
else
{
return
label
.
id
;
}
return
label
.
id
;
},
hidden
()
{
const
page
=
$
(
'
body
'
).
attr
(
'
data-page
'
);
...
...
app/assets/javascripts/lib/utils/text_markdown.js
View file @
9c96399c
/* eslint-disable func-names, no-param-reassign, operator-assignment,
no-else-return,
consistent-return */
/* eslint-disable func-names, no-param-reassign, operator-assignment, consistent-return */
import
$
from
'
jquery
'
;
import
{
insertText
}
from
'
~/lib/utils/common_utils
'
;
...
...
@@ -217,9 +217,8 @@ export function insertMarkdownText({
}
if
(
val
.
indexOf
(
tag
)
===
0
)
{
return
String
(
val
.
replace
(
tag
,
''
));
}
else
{
return
String
(
tag
)
+
val
;
}
return
String
(
tag
)
+
val
;
})
.
join
(
'
\n
'
);
}
...
...
app/assets/javascripts/line_highlighter.js
View file @
9c96399c
/* eslint-disable func-names, no-underscore-dangle, no-param-reassign, consistent-return
, no-else-return
*/
/* eslint-disable func-names, no-underscore-dangle, no-param-reassign, consistent-return */
import
$
from
'
jquery
'
;
...
...
@@ -128,9 +128,8 @@ LineHighlighter.prototype.hashToRange = function(hash) {
const
first
=
parseInt
(
matches
[
1
],
10
);
const
last
=
matches
[
2
]
?
parseInt
(
matches
[
2
],
10
)
:
null
;
return
[
first
,
last
];
}
else
{
return
[
null
,
null
];
}
return
[
null
,
null
];
};
// Highlight a single line
...
...
@@ -153,9 +152,8 @@ LineHighlighter.prototype.highlightRange = function(range) {
}
return
results
;
}
else
{
return
this
.
highlightLine
(
range
[
0
]);
}
return
this
.
highlightLine
(
range
[
0
]);
};
// Set the URL hash string
...
...
app/assets/javascripts/milestone_select.js
View file @
9c96399c
/* eslint-disable one-var, no-
else-return, no-
self-compare, consistent-return, no-param-reassign, no-shadow */
/* eslint-disable one-var, no-self-compare, consistent-return, no-param-reassign, no-shadow */
/* global Issuable */
/* global ListMilestone */
...
...
@@ -123,9 +123,8 @@ export default class MilestoneSelect {
toggleLabel
:
(
selected
,
el
)
=>
{
if
(
selected
&&
'
id
'
in
selected
&&
$
(
el
).
hasClass
(
'
is-active
'
))
{
return
selected
.
title
;
}
else
{
return
defaultLabel
;
}
return
defaultLabel
;
},
defaultLabel
,
fieldName
:
$dropdown
.
data
(
'
fieldName
'
),
...
...
@@ -133,9 +132,8 @@ export default class MilestoneSelect {
id
:
milestone
=>
{
if
(
!
useId
&&
!
$dropdown
.
is
(
'
.js-issuable-form-dropdown
'
))
{
return
milestone
.
name
;
}
else
{
return
milestone
.
id
;
}
return
milestone
.
id
;
},
hidden
:
()
=>
{
$selectBox
.
hide
();
...
...
@@ -244,13 +242,12 @@ export default class MilestoneSelect {
)
.
find
(
'
span
'
)
.
text
(
data
.
milestone
.
title
);
}
else
{
$value
.
html
(
milestoneLinkNoneTemplate
);
return
$sidebarCollapsedValue
.
attr
(
'
data-original-title
'
,
__
(
'
Milestone
'
))
.
find
(
'
span
'
)
.
text
(
__
(
'
None
'
));
}
$value
.
html
(
milestoneLinkNoneTemplate
);
return
$sidebarCollapsedValue
.
attr
(
'
data-original-title
'
,
__
(
'
Milestone
'
))
.
find
(
'
span
'
)
.
text
(
__
(
'
None
'
));
})
.
catch
(()
=>
{
// eslint-disable-next-line no-jquery/no-fade
...
...
app/assets/javascripts/namespace_select.js
View file @
9c96399c
/* eslint-disable no-else-return */
import
$
from
'
jquery
'
;
import
'
~/gl_dropdown
'
;
import
Api
from
'
./api
'
;
...
...
@@ -23,9 +21,8 @@ export default class NamespaceSelect {
toggleLabel
(
selected
)
{
if
(
selected
.
id
==
null
)
{
return
selected
.
text
;
}
else
{
return
`
${
selected
.
kind
}
:
${
selected
.
full_path
}
`
;
}
return
`
${
selected
.
kind
}
:
${
selected
.
full_path
}
`
;
},
data
(
term
,
dataCallback
)
{
return
Api
.
namespaces
(
term
,
namespaces
=>
{
...
...
@@ -43,9 +40,8 @@ export default class NamespaceSelect {
text
(
namespace
)
{
if
(
namespace
.
id
==
null
)
{
return
namespace
.
text
;
}
else
{
return
`
${
namespace
.
kind
}
:
${
namespace
.
full_path
}
`
;
}
return
`
${
namespace
.
kind
}
:
${
namespace
.
full_path
}
`
;
},
renderRow
:
this
.
renderRow
,
clicked
(
options
)
{
...
...
app/assets/javascripts/new_branch_form.js
View file @
9c96399c
/* eslint-disable func-names, consistent-return, no-return-assign,
no-else-return,
@gitlab/require-i18n-strings */
/* eslint-disable func-names, consistent-return, no-return-assign, @gitlab/require-i18n-strings */
import
$
from
'
jquery
'
;
import
RefSelectDropdown
from
'
./ref_select_dropdown
'
;
...
...
@@ -76,9 +76,8 @@ export default class NewBranchForm {
const
matched
=
this
.
name
.
val
().
match
(
restriction
.
pattern
);
if
(
matched
)
{
return
errors
.
concat
(
formatter
(
matched
.
reduce
(
unique
,
[]),
restriction
));
}
else
{
return
errors
;
}
return
errors
;
};
const
errors
=
this
.
restrictions
.
reduce
(
validator
,
[]);
if
(
errors
.
length
>
0
)
{
...
...
app/assets/javascripts/notes.js
View file @
9c96399c
/* eslint-disable no-restricted-properties, babel/camelcase,
no-unused-expressions, default-case,
consistent-return, no-alert, no-param-reassign,
no-else-return,
consistent-return, no-alert, no-param-reassign,
no-shadow, no-useless-escape,
class-methods-use-this */
...
...
@@ -1123,10 +1123,9 @@ export default class Notes {
if
(
row
.
is
(
'
.js-temp-notes-holder
'
))
{
// remove temporary row for diff lines
return
row
.
remove
();
}
else
{
// only remove the form
return
form
.
remove
();
}
// only remove the form
return
form
.
remove
();
}
cancelDiscussionForm
(
e
)
{
...
...
app/assets/javascripts/project_select.js
View file @
9c96399c
/* eslint-disable func-names
, no-else-return
*/
/* eslint-disable func-names */
import
$
from
'
jquery
'
;
import
Api
from
'
./api
'
;
...
...
@@ -74,18 +74,17 @@ const projectSelect = () => {
},
projectsCallback
,
);
}
else
{
return
Api
.
projects
(
query
.
term
,
{
order_by
:
this
.
orderBy
,
with_issues_enabled
:
this
.
withIssuesEnabled
,
with_merge_requests_enabled
:
this
.
withMergeRequestsEnabled
,
membership
:
!
this
.
allProjects
,
},
projectsCallback
,
);
}
return
Api
.
projects
(
query
.
term
,
{
order_by
:
this
.
orderBy
,
with_issues_enabled
:
this
.
withIssuesEnabled
,
with_merge_requests_enabled
:
this
.
withMergeRequestsEnabled
,
membership
:
!
this
.
allProjects
,
},
projectsCallback
,
);
},
id
(
project
)
{
if
(
simpleFilter
)
return
project
.
id
;
...
...
app/assets/javascripts/syntax_highlight.js
View file @
9c96399c
/* eslint-disable consistent-return
, no-else-return
*/
/* eslint-disable consistent-return */
import
$
from
'
jquery
'
;
...
...
@@ -16,11 +16,10 @@ export default function syntaxHighlight(el) {
if
(
$
(
el
).
hasClass
(
'
js-syntax-highlight
'
))
{
// Given the element itself, apply highlighting
return
$
(
el
).
addClass
(
gon
.
user_color_scheme
);
}
else
{
// Given a parent element, recurse to any of its applicable children
const
$children
=
$
(
el
).
find
(
'
.js-syntax-highlight
'
);
if
(
$children
.
length
)
{
return
syntaxHighlight
(
$children
);
}
}
// Given a parent element, recurse to any of its applicable children
const
$children
=
$
(
el
).
find
(
'
.js-syntax-highlight
'
);
if
(
$children
.
length
)
{
return
syntaxHighlight
(
$children
);
}
}
app/assets/javascripts/tree.js
View file @
9c96399c
/* eslint-disable func-names, consistent-return, one-var,
no-else-return,
class-methods-use-this */
/* eslint-disable func-names, consistent-return, one-var, class-methods-use-this */
import
$
from
'
jquery
'
;
import
{
visitUrl
}
from
'
./lib/utils/url_utility
'
;
...
...
@@ -15,9 +15,8 @@ export default class TreeView {
if
(
e
.
metaKey
||
e
.
which
===
2
)
{
e
.
preventDefault
();
return
window
.
open
(
path
,
'
_blank
'
);
}
else
{
return
visitUrl
(
path
);
}
return
visitUrl
(
path
);
}
});
// Show the "Loading commit data" for only the first element
...
...
app/assets/javascripts/users_select.js
View file @
9c96399c
/* eslint-disable func-names, prefer-rest-params, consistent-return, no-shadow, no-
else-return, no-
self-compare, no-unused-expressions, yoda, prefer-spread, babel/camelcase, no-param-reassign */
/* eslint-disable func-names, prefer-rest-params, consistent-return, no-shadow, no-self-compare, no-unused-expressions, yoda, prefer-spread, babel/camelcase, no-param-reassign */
/* global Issuable */
/* global emitSidebarEvent */
...
...
@@ -148,12 +148,11 @@ function UsersSelect(currentUser, els, options = {}) {
name
:
selectedUser
.
name
,
length
:
otherSelected
.
length
,
});
}
else
{
return
sprintf
(
s__
(
'
UsersSelect|%{name} + %{length} more
'
),
{
name
:
firstUser
.
name
,
length
:
selectedUsers
.
length
-
1
,
});
}
return
sprintf
(
s__
(
'
UsersSelect|%{name} + %{length} more
'
),
{
name
:
firstUser
.
name
,
length
:
selectedUsers
.
length
-
1
,
});
};
$
(
'
.assign-to-me-link
'
).
on
(
'
click
'
,
e
=>
{
...
...
@@ -375,13 +374,11 @@ function UsersSelect(currentUser, els, options = {}) {
$dropdown
.
find
(
'
.dropdown-toggle-text
'
).
removeClass
(
'
is-default
'
);
if
(
selected
.
text
)
{
return
selected
.
text
;
}
else
{
return
selected
.
name
;
}
}
else
{
$dropdown
.
find
(
'
.dropdown-toggle-text
'
).
addClass
(
'
is-default
'
);
return
defaultLabel
;
return
selected
.
name
;
}
$dropdown
.
find
(
'
.dropdown-toggle-text
'
).
addClass
(
'
is-default
'
);
return
defaultLabel
;
},
defaultLabel
,
hidden
()
{
...
...
ee/app/assets/javascripts/weight_select.js
View file @
9c96399c
/* eslint-disable no-shadow
, no-else-return
*/
/* eslint-disable no-shadow */
import
$
from
'
jquery
'
;
import
'
~/gl_dropdown
'
;
...
...
@@ -33,9 +33,8 @@ function WeightSelect(els, options = {}) {
id
(
obj
,
el
)
{
if
(
$
(
el
).
data
(
'
none
'
)
==
null
)
{
return
$
(
el
).
data
(
'
id
'
);
}
else
{
return
''
;
}
return
''
;
},
clicked
(
glDropdownEvt
)
{
const
{
e
}
=
glDropdownEvt
;
...
...
spec/javascripts/line_highlighter_spec.js
View file @
9c96399c
/* eslint-disable
no-else-return,
dot-notation, no-return-assign, no-new, no-underscore-dangle */
/* eslint-disable dot-notation, no-return-assign, no-new, no-underscore-dangle */
import
$
from
'
jquery
'
;
import
LineHighlighter
from
'
~/line_highlighter
'
;
...
...
@@ -8,10 +8,9 @@ describe('LineHighlighter', function() {
const
clickLine
=
function
(
number
,
eventData
=
{})
{
if
(
$
.
isEmptyObject
(
eventData
))
{
return
$
(
`#L
${
number
}
`
).
click
();
}
else
{
const
e
=
$
.
Event
(
'
click
'
,
eventData
);
return
$
(
`#L
${
number
}
`
).
trigger
(
e
);
}
const
e
=
$
.
Event
(
'
click
'
,
eventData
);
return
$
(
`#L
${
number
}
`
).
trigger
(
e
);
};
beforeEach
(
function
()
{
loadFixtures
(
'
static/line_highlighter.html
'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment