Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c0196f3

Browse files
Merge pull request #30 from node-oauth/lint
Replaces jshint with eslint
2 parents 81aac3a + 12f0a80 commit c0196f3

File tree

16 files changed

+837
-224
lines changed

16 files changed

+837
-224
lines changed

‎.eslintrc‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"extends": "eslint:recommended",
3+
"env": {
4+
"node": true,
5+
"mocha": true,
6+
"es6": true
7+
},
8+
"parserOptions": {
9+
"ecmaVersion": 9,
10+
"sourceType": "module",
11+
"ecmaFeatures" : {
12+
"globalReturn": false,
13+
"impliedStrict": true,
14+
"jsx": false
15+
}
16+
},
17+
"rules": {
18+
"indent": [
19+
"error",
20+
2
21+
],
22+
"linebreak-style": [
23+
"error",
24+
"unix"
25+
],
26+
"quotes": [
27+
"error",
28+
"single"
29+
],
30+
"semi": [
31+
"error",
32+
"always"
33+
],
34+
"no-console": [
35+
"error"
36+
],
37+
"no-unused-vars": [
38+
"error",
39+
{
40+
"vars": "all",
41+
"args": "none",
42+
"ignoreRestSiblings": false
43+
}
44+
]
45+
}
46+
}
47+

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ npm-debug.log*~
3030
auto-save-list
3131
tramp
3232
.\#*
33+
.vscode
3334

3435
# Org-mode
3536
.org-id-locations

‎.jshintignore‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎.jshintrc‎

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎lib/grant-types/authorization-code-grant-type.js‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,21 @@ AuthorizationCodeGrantType.prototype.getAuthorizationCode = function(request, cl
133133
* @see https://tools.ietf.org/html/rfc6749#section-4.1.3
134134
*/
135135

136-
AuthorizationCodeGrantType.prototype.validateRedirectUri = function(request, code) {
137-
if (!code.redirectUri) {
138-
return;
139-
}
136+
AuthorizationCodeGrantType.prototype.validateRedirectUri = function(request, code) {
137+
if (!code.redirectUri) {
138+
return;
139+
}
140140

141-
var redirectUri = request.body.redirect_uri || request.query.redirect_uri;
141+
var redirectUri = request.body.redirect_uri || request.query.redirect_uri;
142142

143-
if (!is.uri(redirectUri)) {
144-
throw new InvalidRequestError('Invalid request: `redirect_uri` is not a valid URI');
145-
}
143+
if (!is.uri(redirectUri)) {
144+
throw new InvalidRequestError('Invalid request: `redirect_uri` is not a valid URI');
145+
}
146146

147-
if (redirectUri !== code.redirectUri) {
148-
throw new InvalidRequestError('Invalid request: `redirect_uri` is invalid');
149-
}
150-
};
147+
if (redirectUri !== code.redirectUri) {
148+
throw new InvalidRequestError('Invalid request: `redirect_uri` is invalid');
149+
}
150+
};
151151

152152
/**
153153
* Revoke the authorization code.

‎lib/models/token-model.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function TokenModel(data, options) {
4747
this.customAttributes = {};
4848

4949
for (var key in data) {
50-
if (data.hasOwnProperty(key) && (modelAttributes.indexOf(key) < 0)) {
50+
if (Object.prototype.hasOwnProperty.call(data,key) && (modelAttributes.indexOf(key) < 0)) {
5151
this.customAttributes[key] = data[key];
5252
}
5353
}

‎lib/token-types/bearer-token-type.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ BearerTokenType.prototype.valueOf = function() {
4848
}
4949

5050
for (var key in this.customAttributes) {
51-
if (this.customAttributes.hasOwnProperty(key)) {
51+
if (Object.prototype.hasOwnProperty.call(this.customAttributes,key)) {
5252
object[key] = this.customAttributes[key];
5353
}
5454
}

‎lib/validator/is.js‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
'use strict';
2+
/* eslint-disable no-control-regex */
23

34
/**
45
* Validation rules.
56
*/
67

78
var rules = {
8-
NCHAR: /^[\u002D|\u002E|\u005F|\w]+$/,
9-
NQCHAR: /^[\u0021|\u0023-\u005B|\u005D-\u007E]+$/,
10-
NQSCHAR: /^[\u0020-\u0021|\u0023-\u005B|\u005D-\u007E]+$/,
11-
UNICODECHARNOCRLF: /^[\u0009|\u0020-\u007E|\u0080-\uD7FF|\uE000-\uFFFD|\u10000-\u10FFFF]+$/,
9+
NCHAR: /^[\u002D\u002E\u005F\w]+$/,
10+
NQCHAR: /^[\u0021\u0023-\u005B\u005D-\u007E]+$/,
11+
NQSCHAR: /^[\u0020-\u0021\u0023-\u005B\u005D-\u007E]+$/,
12+
UNICODECHARNOCRLF: /^[\u0009\u0020-\u007E\u0080-\uD7FF\uE000-\uFFFD]+$/,
13+
UNICODECHARNOCRLF_EXTENDED: /^[\u{10000}-\u{10FFFF}]+$/u,
1214
URI: /^[a-zA-Z][a-zA-Z0-9+.-]+:/,
1315
VSCHAR: /^[\u0020-\u007E]+$/
1416
};
1517

18+
/* eslint-enable no-control-regex */
19+
1620
/**
1721
* Export validation functions.
1822
*/
@@ -57,7 +61,12 @@ module.exports = {
5761
*/
5862

5963
uchar: function(value) {
60-
return rules.UNICODECHARNOCRLF.test(value);
64+
// manually test \u10000-\u10FFFF
65+
if (rules.UNICODECHARNOCRLF.test(value)) {
66+
return true;
67+
}
68+
69+
return rules.UNICODECHARNOCRLF_EXTENDED.test(value);
6170
},
6271

6372
/**

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /