Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
d614ac12
Commit
d614ac12
authored
Jul 14, 2016
by
Nick Stenning
Committed by
GitHub
Jul 14, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #31 from hypothesis/eslint-best-practices
ESLint - Enable 'Best practices' rules
parents
7b5e1b27
cb4460c2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
8 deletions
+16
-8
.eslintrc
.eslintrc
+8
-0
annotation.js
h/static/scripts/directive/annotation.js
+2
-2
annotation-test.js
h/static/scripts/directive/test/annotation-test.js
+6
-6
No files found.
.eslintrc
View file @
d614ac12
...
...
@@ -14,18 +14,26 @@
"array-callback-return": "error",
"block-scoped-var": "error",
"curly": "error",
"dot-notation": "error",
"eqeqeq": "error",
"guard-for-in": "error",
"no-caller": "error",
"no-case-declarations": "error",
"no-console": [
"error",
{ allow: ["warn", "error"] },
],
"no-extra-bind": "error",
"no-lone-blocks": "error",
"no-self-compare": "error",
"no-throw-literal": "error",
"no-undef-init": "error",
"no-unused-expressions": "error",
"no-use-before-define": [
"error",
{"functions": false},
],
"no-useless-concat": "error",
"semi": "error",
"strict": ["error", "safe"],
},
...
...
h/static/scripts/directive/annotation.js
View file @
d614ac12
...
...
@@ -143,7 +143,7 @@ function AnnotationController(
vm
.
annotation
.
user
=
vm
.
annotation
.
user
||
session
.
state
.
userid
;
vm
.
annotation
.
group
=
vm
.
annotation
.
group
||
groups
.
focused
().
id
;
if
(
!
vm
.
annotation
.
permissions
)
{
vm
.
annotation
.
permissions
=
permissions
[
'default'
]
(
vm
.
annotation
.
group
);
vm
.
annotation
.
permissions
=
permissions
.
default
(
vm
.
annotation
.
group
);
}
vm
.
annotation
.
text
=
vm
.
annotation
.
text
||
''
;
if
(
!
Array
.
isArray
(
vm
.
annotation
.
tags
))
{
...
...
@@ -236,7 +236,7 @@ function AnnotationController(
* @name annotation.AnnotationController#delete
* @description Deletes the annotation.
*/
vm
[
'delete'
]
=
function
()
{
vm
.
delete
=
function
()
{
return
$timeout
(
function
()
{
// Don't use confirm inside the digest cycle.
var
msg
=
'Are you sure you want to delete this annotation?'
;
if
(
$window
.
confirm
(
msg
))
{
...
...
h/static/scripts/directive/test/annotation-test.js
View file @
d614ac12
...
...
@@ -275,7 +275,7 @@ describe('annotation', function() {
};
var
originalPermissions
=
JSON
.
parse
(
JSON
.
stringify
(
annotation
.
permissions
));
fakePermissions
[
'default'
]
=
function
()
{
fakePermissions
.
default
=
function
()
{
return
'new permissions'
;
};
fakePermissions
.
isShared
=
function
()
{};
...
...
@@ -604,7 +604,7 @@ describe('annotation', function() {
var
parts
=
createDirective
();
sandbox
.
stub
(
$window
,
'confirm'
).
returns
(
true
);
fakeAnnotationMapper
.
deleteAnnotation
.
returns
(
$q
.
resolve
());
parts
.
controller
[
'delete'
]
().
then
(
function
()
{
parts
.
controller
.
delete
().
then
(
function
()
{
assert
.
calledWith
(
fakeAnnotationMapper
.
deleteAnnotation
,
parts
.
annotation
);
done
();
...
...
@@ -618,7 +618,7 @@ describe('annotation', function() {
function
(
done
)
{
var
parts
=
createDirective
();
sandbox
.
stub
(
$window
,
'confirm'
).
returns
(
false
);
parts
.
controller
[
'delete'
]
().
then
(
function
()
{
parts
.
controller
.
delete
().
then
(
function
()
{
assert
.
notCalled
(
fakeAnnotationMapper
.
deleteAnnotation
);
done
();
});
...
...
@@ -634,7 +634,7 @@ describe('annotation', function() {
fakeAnnotationMapper
.
deleteAnnotation
.
returns
(
$q
.
reject
({
status
:
0
}));
controller
[
'delete'
]
().
then
(
function
()
{
controller
.
delete
().
then
(
function
()
{
assert
.
calledWith
(
fakeFlash
.
error
,
'Service unreachable.'
,
'Deleting annotation failed'
);
done
();
...
...
@@ -651,7 +651,7 @@ describe('annotation', function() {
statusText
:
'Server Error'
,
data
:
{}
}));
controller
[
'delete'
]
().
then
(
function
()
{
controller
.
delete
().
then
(
function
()
{
assert
.
calledWith
(
fakeFlash
.
error
,
'500 Server Error'
,
'Deleting annotation failed'
);
done
();
...
...
@@ -663,7 +663,7 @@ describe('annotation', function() {
var
controller
=
createDirective
().
controller
;
sandbox
.
stub
(
$window
,
'confirm'
).
returns
(
true
);
fakeAnnotationMapper
.
deleteAnnotation
.
returns
(
$q
.
resolve
());
controller
[
'delete'
]
().
then
(
function
()
{
controller
.
delete
().
then
(
function
()
{
assert
.
notCalled
(
fakeFlash
.
error
);
done
();
});
...
...
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