Skip to content

Commit

Permalink
build(deps-dev): bump @typescript-eslint/eslint-plugin from 2.34.0 to…
Browse files Browse the repository at this point in the history
… 6.2.1 (#397)

* build(deps-dev): bump @typescript-eslint/eslint-plugin

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 2.34.0 to 6.2.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.2.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix linting

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: uzlopak <aras.abbasi@googlemail.com>
  • Loading branch information
dependabot[bot] and Uzlopak committed Aug 9, 2023
1 parent ebfc5b0 commit cdf3d70
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 41 deletions.
51 changes: 51 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"standard"
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"env": { "node": true },
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"project": "./tsconfig.eslint.json",
"createDefaultProgram": true
},
"rules": {
"no-console": "off",
"@typescript-eslint/indent": ["error", 2],
"semi": ["error", "never"],
"import/export": "off" // this errors on multiple exports (overload interfaces)
},
"overrides": [
{
"files": ["*.d.ts","*.test-d.ts"],
"rules": {
"no-use-before-define": "off",
"no-redeclare": "off",
"@typescript-eslint/no-explicit-any": "off"
}
},
{
"files": ["*.test-d.ts"],
"rules": {
"@typescript-eslint/no-var-requires": "off",
"no-unused-vars": "off",
"n/handle-callback-err": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-misused-promises": ["error", {
"checksVoidReturn": false
}]
},
"globals": {
"NodeJS": "readonly"
}
}
]
}
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
"types": "types/index.d.ts",
"scripts": {
"coverage": "npm run test:unit -- --coverage-report=html",
"lint": "standard | snazzy",
"lint:fix": "standard --fix",
"lint": "npm run lint:javascript && npm run lint:typescript",
"lint:javascript": "standard | snazzy",
"lint:fix": "standard --fix && npm run lint:typescript -- --fix",
"lint:typescript": "eslint -c .eslintrc.json types/**/*.d.ts types/**/*.test-d.ts",
"test": "npm run test:unit && npm run test:typescript",
"test:typescript": "tsd",
"test:unit": "tap",
Expand All @@ -28,20 +30,20 @@
},
"homepage": "https://github.com/fastify/fastify-static",
"dependencies": {
"content-disposition": "^0.5.3",
"@fastify/accept-negotiator": "^1.0.0",
"@fastify/send": "^2.0.0",
"content-disposition": "^0.5.3",
"fastify-plugin": "^4.0.0",
"glob": "^8.0.1",
"p-limit": "^3.1.0",
"readable-stream": "^4.0.0",
"@fastify/send": "^2.0.0"
"readable-stream": "^4.0.0"
},
"devDependencies": {
"@fastify/compress": "^6.0.0",
"@fastify/pre-commit": "^2.0.2",
"@types/node": "^20.1.0",
"@typescript-eslint/eslint-plugin": "^2.29.0",
"@typescript-eslint/parser": "^2.29.0",
"@typescript-eslint/eslint-plugin": "^6.3.0",
"@typescript-eslint/parser": "^6.3.0",
"concat-stream": "^2.0.0",
"coveralls": "^3.0.4",
"eslint-plugin-typescript": "^0.14.0",
Expand All @@ -53,7 +55,8 @@
"snazzy": "^9.0.0",
"standard": "^17.0.0",
"tap": "^16.0.0",
"tsd": "^0.28.0"
"tsd": "^0.28.0",
"typescript": "^5.1.6"
},
"tsd": {
"directory": "test/types"
Expand Down
13 changes: 13 additions & 0 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "es6",
"lib": [ "es2015" ],
"module": "commonjs",
"noEmit": true,
"strict": true
},
"include": [
"types/*.test-d.ts",
"types/*.d.ts"
]
}
10 changes: 5 additions & 5 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Leo <https://github.com/leomelzer>
/// <reference types="node" />

import {FastifyPluginAsync, FastifyRequest, RouteOptions} from 'fastify';
import { Stats } from 'fs';
import { FastifyPluginAsync, FastifyRequest, RouteOptions } from 'fastify'
import { Stats } from 'fs'

declare module "fastify" {
declare module 'fastify' {
interface FastifyReply {
sendFile(filename: string, rootPath?: string): FastifyReply;
sendFile(filename: string, options?: fastifyStatic.SendOptions): FastifyReply;
Expand Down Expand Up @@ -107,9 +107,9 @@ declare namespace fastifyStatic {
constraints?: RouteOptions['constraints'];
}

export const fastifyStatic: FastifyStaticPlugin;
export const fastifyStatic: FastifyStaticPlugin

export { fastifyStatic as default };
export { fastifyStatic as default }
}

declare function fastifyStatic(...params: Parameters<FastifyStaticPlugin>): ReturnType<FastifyStaticPlugin>;
Expand Down
56 changes: 28 additions & 28 deletions types/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
import fastify, { FastifyInstance, FastifyPluginAsync, FastifyRequest } from 'fastify'
import { Server } from 'http';
import { Server } from 'http'
import { expectAssignable, expectError, expectType } from 'tsd'
import * as fastifyStaticStar from '..';
import * as fastifyStaticStar from '..'
import fastifyStatic, {
FastifyStaticOptions,
fastifyStatic as fastifyStaticNamed,
fastifyStatic as fastifyStaticNamed
} from '..'

import fastifyStaticCjsImport = require('..');
const fastifyStaticCjs = require('..');

const app: FastifyInstance = fastify();

app.register(fastifyStatic);
app.register(fastifyStaticNamed);
app.register(fastifyStaticCjs);
app.register(fastifyStaticCjsImport.default);
app.register(fastifyStaticCjsImport.fastifyStatic);
app.register(fastifyStaticStar.default);
app.register(fastifyStaticStar.fastifyStatic);

expectType<FastifyPluginAsync<FastifyStaticOptions, Server>>(fastifyStatic);
expectType<FastifyPluginAsync<FastifyStaticOptions, Server>>(fastifyStaticNamed);
expectType<FastifyPluginAsync<FastifyStaticOptions, Server>>(fastifyStaticCjsImport.default);
expectType<FastifyPluginAsync<FastifyStaticOptions, Server>>(fastifyStaticCjsImport.fastifyStatic);
expectType<FastifyPluginAsync<FastifyStaticOptions, Server>>(fastifyStaticStar.default);
const fastifyStaticCjs = require('..')

const app: FastifyInstance = fastify()

app.register(fastifyStatic)
app.register(fastifyStaticNamed)
app.register(fastifyStaticCjs)
app.register(fastifyStaticCjsImport.default)
app.register(fastifyStaticCjsImport.fastifyStatic)
app.register(fastifyStaticStar.default)
app.register(fastifyStaticStar.fastifyStatic)

expectType<FastifyPluginAsync<FastifyStaticOptions, Server>>(fastifyStatic)
expectType<FastifyPluginAsync<FastifyStaticOptions, Server>>(fastifyStaticNamed)
expectType<FastifyPluginAsync<FastifyStaticOptions, Server>>(fastifyStaticCjsImport.default)
expectType<FastifyPluginAsync<FastifyStaticOptions, Server>>(fastifyStaticCjsImport.fastifyStatic)
expectType<FastifyPluginAsync<FastifyStaticOptions, Server>>(fastifyStaticStar.default)
expectType<FastifyPluginAsync<FastifyStaticOptions, Server>>(
fastifyStaticStar.fastifyStatic
);
expectType<any>(fastifyStaticCjs);
fastifyStaticStar.fastifyStatic
)
expectType<any>(fastifyStaticCjs)

const appWithImplicitHttp = fastify()
const options: FastifyStaticOptions = {
Expand All @@ -54,7 +54,7 @@ const options: FastifyStaticOptions = {
},
preCompressed: false,
allowedPath: (pathName: string, root: string, request: FastifyRequest) => {
return true;
return true
},
constraints: {
host: /.*\.example\.com/,
Expand All @@ -70,7 +70,7 @@ expectError<FastifyStaticOptions>({
expectAssignable<FastifyStaticOptions>({
root: '',
list: {
format: 'json',
format: 'json'
}
})

Expand All @@ -93,7 +93,7 @@ expectAssignable<FastifyStaticOptions>({
expectError<FastifyStaticOptions>({
root: '',
list: {
format: 'html',
format: 'html'
}
})

Expand Down Expand Up @@ -123,7 +123,7 @@ appWithHttp2
})

appWithHttp2.get('/download/2', (request, reply) => {
reply.download('some-file-name', 'some-filename' ,{ cacheControl: false, acceptRanges: true })
reply.download('some-file-name', 'some-filename', { cacheControl: false, acceptRanges: true })
})
})

Expand Down Expand Up @@ -168,7 +168,7 @@ noIndexApp
noIndexApp.get('/', (request, reply) => {
reply.send('<h1>fastify-static</h1>')
})
})
})

const defaultIndexApp = fastify()
options.index = 'index.html'
Expand Down

0 comments on commit cdf3d70

Please sign in to comment.