Skip to content
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

chore: npm run test failing due to standard #331

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ Router.prototype.prettyPrint = function (options = {}) {
return prettyPrintTree(tree, options)
}

for (var i in httpMethods) {
for (const i in httpMethods) {
/* eslint no-prototype-builtins: "off" */
if (!httpMethods.hasOwnProperty(i)) continue
const m = httpMethods[i]
Expand Down Expand Up @@ -636,7 +636,7 @@ function getClosingParenthensePosition (path, idx) {
// but it's inefficient for grouped or wrong regexp expressions.
// see issues #62 and #63 for more info

var parentheses = 1
let parentheses = 1

while (idx < path.length) {
idx++
Expand Down
10 changes: 5 additions & 5 deletions test/methods.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ test('off with nested wildcards with parametric and static', t => {
findMyWay.on('GET', '/foo3/*', () => {})
findMyWay.on('GET', '/foo4/param/hello/test/long/route', () => {})

var route1 = findMyWay.find('GET', '/foo3/first/second')
const route1 = findMyWay.find('GET', '/foo3/first/second')
t.equal(route1.params['*'], 'first/second')

findMyWay.off('GET', '/foo3/*')

var route2 = findMyWay.find('GET', '/foo3/first/second')
const route2 = findMyWay.find('GET', '/foo3/first/second')
t.equal(route2.params['*'], '/foo3/first/second')

findMyWay.off('GET', '/foo2/*')
Expand Down Expand Up @@ -672,7 +672,7 @@ test('parametric route with different method', t => {
test('params does not keep the object reference', t => {
t.plan(2)
const findMyWay = FindMyWay()
var first = true
let first = true

findMyWay.on('GET', '/test/:id', (req, res, params) => {
if (first) {
Expand Down Expand Up @@ -745,8 +745,8 @@ test('register all known HTTP methods', t => {

const httpMethods = require('../lib/http-methods')
const handlers = {}
for (var i in httpMethods) {
var m = httpMethods[i]
for (const i in httpMethods) {
const m = httpMethods[i]
handlers[m] = function myHandler () {}
findMyWay.on(m, '/test', handlers[m])
}
Expand Down
2 changes: 1 addition & 1 deletion test/routes-registered.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test('verify routes registered', t => {

findMyWay = initializeRoutes(findMyWay, defaultHandler, quantity)
t.equal(findMyWay.routes.length, quantity)
findMyWay.routes.map((route, idx) => {
findMyWay.routes.forEach((route, idx) => {
t.match(route, {
method: 'GET',
path: '/test-route-' + idx,
Expand Down
2 changes: 1 addition & 1 deletion test/shorthands.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const FindMyWay = require('../')
t.test('should support shorthand', t => {
t.plan(httpMethods.length)

for (var i in httpMethods) {
for (const i in httpMethods) {
const m = httpMethods[i]
const methodName = m.toLowerCase()

Expand Down
2 changes: 1 addition & 1 deletion test/store.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test('find a store object', t => {
test('update the store', t => {
t.plan(2)
const findMyWay = FindMyWay()
var bool = false
let bool = false

findMyWay.on('GET', '/test', (req, res, params, store) => {
if (!bool) {
Expand Down
Loading