Skip to content

Commit

Permalink
chore(package): upgrade to eslint v9
Browse files Browse the repository at this point in the history
  • Loading branch information
chimurai committed May 18, 2024
1 parent afb23fb commit 196c847
Show file tree
Hide file tree
Showing 13 changed files with 208 additions and 177 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

30 changes: 0 additions & 30 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"deno.enable": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"markdown.extension.toc.levels": "2..3"
}
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"restream",
"snyk",
"streamify",
"tseslint",
"vhosted",
"websockets",
"xfwd"
Expand Down
38 changes: 38 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
const tseslint = require('typescript-eslint');
const tseslintParser = require('@typescript-eslint/parser');

/** @type {import('eslint').Linter.FlatConfig[]} */
module.exports = [
eslintPluginPrettierRecommended,
...tseslint.configs.recommended,
{
files: ['*.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
{
files: ['**/*.ts'],
ignores: ['dist/*'],
languageOptions: {
parser: tseslintParser,
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ vars: 'all', args: 'none', ignoreRestSiblings: false },
],
'prettier/prettier': 'warn',
},
// overrides: [
// {
// files: ['src/**/*.ts'],
// rules: {
// 'no-restricted-imports': ['error', { paths: ['express'] }],
// },
// },
// ],
},
];
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@
"@commitlint/cli": "19.2.1",
"@commitlint/config-conventional": "19.1.0",
"@types/debug": "4.1.12",
"@types/eslint": "8.56.7",
"@types/express": "4.17.21",
"@types/is-glob": "4.0.4",
"@types/jest": "29.5.12",
"@types/micromatch": "4.0.6",
"@types/node": "20.12.5",
"@types/supertest": "6.0.2",
"@types/ws": "8.5.10",
"@typescript-eslint/eslint-plugin": "7.6.0",
"@typescript-eslint/parser": "7.6.0",
"body-parser": "1.20.2",
"browser-sync": "3.0.2",
"connect": "3.7.0",
"eslint": "8.57.0",
"eslint": "9.0.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.1.3",
"express": "4.19.2",
Expand All @@ -80,6 +80,7 @@
"supertest": "6.3.4",
"ts-jest": "29.1.2",
"typescript": "5.4.4",
"typescript-eslint": "7.9.0",
"ws": "8.16.0"
},
"dependencies": {
Expand Down
2 changes: 0 additions & 2 deletions src/logger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-empty-function */

import { Logger, Options } from './types';

/**
Expand Down
2 changes: 0 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* https://github.com/DefinitelyTyped/DefinitelyTyped/blob/6f529c6c67a447190f86bfbf894d1061e41e07b7/types/http-proxy-middleware/index.d.ts
*/

/* eslint-disable @typescript-eslint/no-empty-interface */

import type * as http from 'http';
import type * as httpProxy from 'http-proxy';
import type * as net from 'net';
Expand Down
2 changes: 0 additions & 2 deletions test/types.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-empty-function */

import * as express from 'express';
import * as http from 'http';
import { createProxyMiddleware as middleware, fixRequestBody, responseInterceptor } from '../src';
Expand Down
1 change: 0 additions & 1 deletion test/unit/path-filter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ describe('Path Filter', () => {
});

it('should not throw error with Function', () => {
// eslint-disable-next-line @typescript-eslint/no-empty-function
expect(testPathFilter(() => {})).not.toThrowError(Error);
});
});
Expand Down
2 changes: 0 additions & 2 deletions test/unit/path-rewriter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,10 @@ describe('Path rewriting', () => {
});

it('should not throw when function config is provided', () => {
// eslint-disable-next-line @typescript-eslint/no-empty-function
expect(badFn(() => {})).not.toThrowError(Error);
});

it('should not throw when async function config is provided', () => {
// eslint-disable-next-line @typescript-eslint/no-empty-function
expect(badFn(async () => {})).not.toThrowError(Error);
});
});
Expand Down
1 change: 0 additions & 1 deletion test/unit/utils/function.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-empty-function */
import { getFunctionName } from '../../../src/utils/function';

describe('getFunctionName()', () => {
Expand Down

0 comments on commit 196c847

Please sign in to comment.