Skip to content

Commit

Permalink
updating linting setup
Browse files Browse the repository at this point in the history
  • Loading branch information
kwhitley committed May 31, 2023
1 parent de0f3d1 commit 0ffba06
Show file tree
Hide file tree
Showing 12 changed files with 156 additions and 306 deletions.
273 changes: 0 additions & 273 deletions .eslintrc.js

This file was deleted.

26 changes: 26 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"overrides": [
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"linebreak-style": ["error", "unix"],
"quotes": ["error", "single", { "allowTemplateLiterals": true }],
"semi": ["error", "never"],
"@typescript-eslint/no-explicit-any": "off"
}
}
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Question
about: Have a question or something to discuss?
title: ''
labels: ''
assignees: ''

---

## Questions & Discussion
To cut down on long-standing topics that are discussion-based, rather than actual issues, please opt for one of the following paths, when possible. These have the benefit of potentially helping others after the issue (here) would have been closed.
1. [Create a Discussion Topic](https://github.com/kwhitley/itty-router/discussions/new/choose)
2. [Discuss on Discord](https://discord.com/channels/832353585802903572)

Cheers!
File renamed without changes.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
"@rollup/plugin-typescript": "^11.1.1",
"@skypack/package-check": "^0.2.2",
"@types/node": "^20.2.5",
"@typescript-eslint/eslint-plugin": "^5.59.8",
"@typescript-eslint/parser": "^5.59.8",
"@vitejs/plugin-vue": "^4.2.3",
"@vitest/coverage-c8": "^0.31.3",
"@whatwg-node/server": "^0.8.1",
Expand Down
19 changes: 1 addition & 18 deletions src/Router.spec.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
import 'isomorphic-fetch'
import { describe, expect, it, vi } from 'vitest'
import { buildRequest, createTestRunner, extract } from '../test-utils'
import { Router, Route, RouterType, RequestLike } from './Router'
import { Route, Router, RouterType } from './Router'

const ERROR_MESSAGE = 'Error Message'

const testRoutes = createTestRunner(Router)

type ALL = {
all: Route,
}

type GET = {
get: Route,
}

type PATCH = {
patch: Route,
}

type POST = {
post: Route,
}
describe('Router', () => {
const router = Router()

Expand Down Expand Up @@ -348,7 +333,6 @@ describe('Router', () => {

it('can throw method not allowed error', async () => {
const router = Router()
const errorText = 'Not Allowed'
const okText = 'OK'
const errorResponse = new Response(JSON.stringify({ foo: 'bar' }), {
headers: { 'content-type': 'application/json;charset=UTF-8' },
Expand Down Expand Up @@ -390,7 +374,6 @@ describe('Router', () => {

it('can easily create a ThrowableRouter', async () => {
const error = (status, message) => new Response(message, { status })
const errorResponse = err => error(err.status || 500, err.message)

const ThrowableRouter = options => new Proxy(Router(options), {
get: (obj, prop) => (...args) =>
Expand Down
2 changes: 1 addition & 1 deletion src/StatusError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class StatusError extends Error {
status: number
[key: string]: any

constructor(status: number = 500, body?: StatusErrorObject | string) {
constructor(status = 500, body?: StatusErrorObject | string) {
super(typeof body === 'object' ? body.error : body)
typeof body === 'object' && Object.assign(this, body)
this.status = status
Expand Down
Loading

0 comments on commit 0ffba06

Please sign in to comment.