Skip to content

Commit

Permalink
final eslint fixes anc cleaning up extra scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
kwhitley committed May 31, 2023
1 parent e341bef commit ce8b0ff
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 162 deletions.
9 changes: 5 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"overrides": [
],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
Expand All @@ -18,9 +17,11 @@
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"linebreak-style": ["error", "unix"],
"prefer-const": "off",
"quotes": ["error", "single", { "allowTemplateLiterals": true }],
"semi": ["error", "never"],
"@typescript-eslint/no-explicit-any": "off"
"semi": ["error", "never"]
}
}
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@
"nested"
],
"scripts": {
"dev": "yarn test",
"lint": "npx eslint src",
"test": "vitest --coverage --reporter verbose",
"test:once": "vitest run",
"coverage": "vitest run --coverage",
"coveralls": "yarn coverage && cat ./coverage/lcov.info | coveralls",
"verify": "echo 'verifying module...' && yarn build && yarn test:once",
"dev": "yarn test",
"prerelease": "yarn verify",
"prebuild": "rimraf dist && mkdir dist",
"build:core": "rollup -c",
"build:extras": "rollup --config rollup.config.extras.mjs",
"prebuild": "rimraf dist && mkdir dist && yarn coverage && yarn lint",
"build": "rollup -c",
"release": "release --tag --push --patch --src=dist",
"runtime:bun": "bun example/bun.ts",
Expand Down Expand Up @@ -58,7 +56,6 @@
"@whatwg-node/server": "^0.8.1",
"coveralls": "^3.1.1",
"eslint": "^8.41.0",
"eslint-plugin-jest": "^27.2.1",
"fetch-mock": "^9.11.0",
"fs-extra": "^11.1.1",
"globby": "^13.1.4",
Expand Down
14 changes: 5 additions & 9 deletions src/Router.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'isomorphic-fetch'
import { describe, expect, it, vi } from 'vitest'
import { buildRequest, createTestRunner, extract } from '../test-utils'
import { Route, Router, RouterType } from './Router'
import { Router } from './Router'

const ERROR_MESSAGE = 'Error Message'

Expand Down Expand Up @@ -299,9 +299,9 @@ describe('Router', () => {

it('stops at a handler that throws', async () => {
const router = Router()
const handler1 = vi.fn(() => {})
const handler1 = vi.fn()
const handler2 = vi.fn(() => { throw new Error() })
const handler3 = vi.fn(() => {})
const handler3 = vi.fn()
router.get('/foo', handler1, handler2, handler3)

const escape = err => err
Expand Down Expand Up @@ -408,11 +408,7 @@ describe('Router', () => {

describe('.handle({ method = \'GET\', url }, ...args)', () => {
it('passes extra args to each handler', async () => {
type GET = {
get: Route,
}

const r = Router() as RouterType & GET
const r = Router()
const h = (req, a, b) => { req.a = a; req.b = b }
const originalA = 'A'
const originalB = {}
Expand Down Expand Up @@ -559,7 +555,7 @@ describe('ROUTE MATCHING', () => {
{ route: '/foo?', path: '/foo' },
{ route: '/foo?', path: '/fo' },
{ route: '/foo?', path: '/fooo', returns: false },
{ route: '/\.', path: '/', returns: false },
{ route: '/.', path: '/', returns: false },
{ route: '/x|y', path: '/y', returns: true },
{ route: '/x|y', path: '/x', returns: true },
{ route: '/x/y|z', path: '/z', returns: true }, // should require second path as y or z
Expand Down
Loading

0 comments on commit ce8b0ff

Please sign in to comment.