Skip to content

Commit

Permalink
- Refactoring: Use ES6 classes, destructuring; use forEach; declare
Browse files Browse the repository at this point in the history
    variables in more nested scope
- Linting: Remove jshint
- Linting: Apply overrides to add mocha-specific config
- Linting: Add recommended fields to `package.json`
- Linting: Remove unused disable directives
- Git/npm/Linting: ignore `var`
- Fix: Point to correct path in Makefile `view-cov`
  • Loading branch information
brettz9 committed May 8, 2019
1 parent 8b35294 commit 01948cb
Show file tree
Hide file tree
Showing 39 changed files with 1,082 additions and 1,188 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.git
coverage/
node_modules/
node_modules/
var/
36 changes: 24 additions & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
module.exports = {
env: {
// jest: true,
mocha: true,
node: true,
},
extends: [
'airbnb-base',
],
overrides: [
{
files: ['test/**'],
env: {
// jest: true,
mocha: true
},
globals: {
expect: 'readonly'
},
rules: {
// 'jest/no-disabled-tests': [2],
// 'jest/no-focused-tests': [2],
// 'jest/no-identical-title': [2],
// 'jest/prefer-to-have-length': [2],
// 'jest/valid-expect': [2],
}
}
],
plugins: [
// 'jest'
],
rules: {
"comma-dangle": 0,
"no-underscore-dangle": 0,
"no-param-reassign": 0,
"prefer-destructuring": 0,
// 'jest/no-disabled-tests': [2],
// 'jest/no-focused-tests': [2],
// 'jest/no-identical-title': [2],
// 'jest/prefer-to-have-length': [2],
// 'jest/valid-expect': [2],
'comma-dangle': 0,
'no-underscore-dangle': 0,
'no-param-reassign': 0,
'prefer-destructuring': 0,
}
};
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
docs/
reports/
var/

# Mac OS X
.DS_Store
Expand Down
18 changes: 0 additions & 18 deletions .jshintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ docs/
examples/
reports/
test/
var/

.github/
.jshintrc
.travis.yml
.gitlab-ci.yml
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ view-docs:
open ./docs/index.html

view-cov:
open ./reports/coverage/lcov-report/index.html
open ./var/cov/index.html

clean: clean-docs clean-cov
-rm -r $(REPORTSDIR)
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Passport Next aims to:
* Follow [Semantic Versioning](https://semver.org/)
* Keep an up to date CHANGELOG.md

**Passport Next does not aim to be backwards compatible with the upstream repositories.
**Passport Next does not aim to be backwards compatible with the upstream repositories.
The changes required to keep up to date and functioning prohibit that so if you're migrating
from the upstream modules please test your code thouroughly!**

Expand Down Expand Up @@ -63,7 +63,7 @@ application must be configured.
```javascript
passport.use(new LocalStrategy(
function(username, password, done) {
User.findOne({ username: username }, function (err, user) {
User.findOne({ username }, function (err, user) {
if (err) { return done(err); }
if (!user) { return done(null, false); }
if (!user.verifyPassword(password)) { return done(null, false); }
Expand Down Expand Up @@ -108,7 +108,7 @@ persistent login sessions (recommended, but not required), `passport.session()`
middleware must also be used.

```javascript
var app = express();
const app = express();
app.use(require('serve-static')(__dirname + '/../../public'));
app.use(require('cookie-parser')());
app.use(require('body-parser').urlencoded({ extended: true }));
Expand All @@ -123,7 +123,7 @@ Passport provides an `authenticate()` function, which is used as route
middleware to authenticate requests.

```javascript
app.post('/login',
app.post('/login',
passport.authenticate('local', { failureRedirect: '/login' }),
function(req, res) {
res.redirect('/');
Expand All @@ -132,12 +132,12 @@ app.post('/login',

#### Protect Routes When Using Sessions

Passport provides an `isAuthenticated()` function on the request object, which
is used to determine if the user has been authenticated and stored in the
Passport provides an `isAuthenticated()` function on the request object, which
is used to determine if the user has been authenticated and stored in the
session.

```javascript
app.post('/some/protected/route',
app.post('/some/protected/route',
function(req, res, next) {
if(req.isAuthenticated()){
next();
Expand All @@ -147,7 +147,7 @@ app.post('/some/protected/route',
});
```

For a more complete solution to handling unauthenticated users, see
For a more complete solution to handling unauthenticated users, see
[connect-ensure-login](https://github.com/jaredhanson/connect-ensure-login), a
middleware to ensure login sessions.

Expand Down
Loading

0 comments on commit 01948cb

Please sign in to comment.