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 eslint 9 #2843

Merged
merged 5 commits into from
Sep 28, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 0 additions & 14 deletions .eslintignore

This file was deleted.

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

This file was deleted.

3 changes: 2 additions & 1 deletion benchmarks/bin/benchmark-bench.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"use strict";
import {Command} from "commander";
import inquirer from "inquirer";

import bench from "../src/bench.js";
import {choices, list} from "../src/packages.js";
import {Command} from "commander";

const program = new Command();

Expand Down
11 changes: 6 additions & 5 deletions benchmarks/bin/benchmark-compare.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/usr/bin/env node
import os from "os";
import chalk from "chalk";
import Table from "cli-table";
import {Command} from "commander";
import {readdirSync, readFileSync, writeFileSync} from "fs";
import inquirer from "inquirer";
import Table from "cli-table";
import chalk from "chalk";
import os from "os";
import {join} from "path";
import {readdirSync, readFileSync, writeFileSync} from "fs";
import {info} from "../src/packages.js";

import {compare} from "../src/autocannon.js";
import {info} from "../src/packages.js";

const commander = new Command();

Expand Down
4 changes: 2 additions & 2 deletions benchmarks/frameworks/express-injector-async-hook.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import express from "express";
import {InjectorService} from "@tsed/di";
import {PlatformContext, PlatformRequest, PlatformResponse} from "@tsed/common";
import {InjectorService} from "@tsed/di";
import express from "express";
import {v4} from "uuid";

const app = express();
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/frameworks/express-injector-http-hook.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import express from "express";
import {InjectorService, runInContext, setContext} from "@tsed/di";
import {PlatformContext, PlatformRequest, PlatformResponse} from "@tsed/common";
import {v4} from "uuid";
import {InjectorService, runInContext, setContext} from "@tsed/di";
import express from "express";
import http from "http";
import {v4} from "uuid";

const injector = new InjectorService();
const app = express();
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/frameworks/express-injector-without-events.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import express from "express";
import {InjectorService, runInContext, setContext} from "@tsed/di";
import {PlatformContext, PlatformRequest, PlatformResponse} from "@tsed/common";
import {v4} from "uuid";
import {InjectorService, runInContext, setContext} from "@tsed/di";
import express from "express";
import http from "http";
import {v4} from "uuid";

const injector = new InjectorService();
const app = express();
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/frameworks/express-injector.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import express from "express";
import {InjectorService} from "@tsed/di";
import {PlatformContext, PlatformRequest, PlatformResponse} from "@tsed/common";
import {InjectorService} from "@tsed/di";
import express from "express";
import {v4} from "uuid";

const app = express();
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/frameworks/fastify-injector.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Fastify from "fastify";
import {InjectorService, runInContext, getContext} from "@tsed/di";
import {PlatformContext} from "@tsed/common";
import {getContext, InjectorService, runInContext} from "@tsed/di";
import Fastify from "fastify";
import {v4} from "uuid";

const fastify = Fastify();
Expand Down
1 change: 1 addition & 0 deletions benchmarks/frameworks/hapi.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "make-promises-safe";

import Hapi from "@hapi/hapi";

async function start() {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/frameworks/koa-isomorphic-router.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Koa from "koa";
import Router from "benchmarks/frameworks/koa-isomorphic-router.js";
import Koa from "koa";

const app = new Koa();
const router = new Router();
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/frameworks/koa-router.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Koa from "koa";
import KoaRouter from "benchmarks/frameworks/koa-router.js";
import Koa from "koa";

const router = KoaRouter();

Expand Down
1 change: 1 addition & 0 deletions benchmarks/frameworks/nest-fastify.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import core from "@nestjs/core";
import fastifyPlatform from "@nestjs/platform-fastify";

import {AppModule} from "./nest/app/app.module.js";

core.NestFactory.create(AppModule, new fastifyPlatform.FastifyAdapter(), {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/frameworks/nest/app/app.controller.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion benchmarks/frameworks/nest/app/app.module.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {__decorate} from "tslib";
import common_1 from "@nestjs/common";
import {__decorate} from "tslib";

import {AppController} from "./app.controller.js";

class AppModule {}
Expand Down
1 change: 1 addition & 0 deletions benchmarks/frameworks/nest/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use strict";
import core from "@nestjs/core";

import {AppModule} from "./app/app.module.js";

core.NestFactory.create(AppModule, {
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/frameworks/tsed-express.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use strict";
import {PlatformApplication} from "@tsed/common";
import {Inject} from "@tsed/di";
import {PlatformExpress} from "@tsed/platform-express";
import {__decorate} from "tslib";
import {Inject} from "@tsed/di";
import {PlatformApplication} from "@tsed/common";

class Server {
$onInit() {
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/frameworks/tsed-koa.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use strict";
import {PlatformApplication} from "@tsed/common";
import {Inject} from "@tsed/di";
import {PlatformKoa} from "@tsed/platform-koa";
import {__decorate} from "tslib";
import {Inject} from "@tsed/di";
import {PlatformApplication} from "@tsed/common";

class Server {
$beforeRoutesInit() {
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/frameworks/tsed-no-context.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use strict";
import {PlatformApplication} from "@tsed/common";
import {Inject} from "@tsed/di";
import {PlatformExpress} from "@tsed/platform-express";
import {__decorate} from "tslib";
import {Inject} from "@tsed/di";
import {PlatformApplication} from "@tsed/common";

class Server {
$onInit() {
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/frameworks/tsed-no-events.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use strict";
import {PlatformApplication} from "@tsed/common";
import {Inject} from "@tsed/di";
import {PlatformExpress} from "@tsed/platform-express";
import {__decorate} from "tslib";
import {Inject} from "@tsed/di";
import {PlatformApplication} from "@tsed/common";

class Server {
$onInit() {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/src/autocannon.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import autocannon from "autocannon";
import fs from "fs";
import autoCompare from "autocannon-compare";
import fs from "fs";
import path from "path";
import {promisify} from "util";

Expand Down
3 changes: 2 additions & 1 deletion benchmarks/src/bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import {execa} from "execa";
import ora from "ora";
import path from "path";
import {fire} from "./autocannon.js";
import {fileURLToPath} from "url";

import {fire} from "./autocannon.js";

const __dirname = path.dirname(fileURLToPath(import.meta.url));

const doBench = async (opts, handler) => {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/src/packages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from "fs";
import {dirname, join} from "path";
import {createRequire} from "module";
import {dirname, join} from "path";

const require = createRequire(import.meta.url);

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/snippets/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@
"supertest": "6.0.0",
"ts-node": "9.0.0",
"tslint": "6.1.3",
"typescript": "4.9.5"
"typescript": "5.4.5"
}
}
72 changes: 72 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import typescriptParser from "@typescript-eslint/parser";
import pluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import pluginSimpleImportSort from "eslint-plugin-simple-import-sort";
import vitest from "eslint-plugin-vitest";
import pluginWorkspaces from "eslint-plugin-workspaces";
import globals from "globals";
import {join} from "node:path";

export default [
{
ignores: ["**/coverage", "**/lib", "**/dist", "processes.config.js", "**/snapshots", "**/templates", "**/docs/**", "**/docs-references/**"]
},
{
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
parser: typescriptParser,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
tsconfigRootDir: join(import.meta.dirname, "tsconfig.eslint.json")
},
globals: {
...globals.node
}
},
plugins: {
"@typescript-eslint": typescriptEslint
},
rules: {
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/no-inferrable-types": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-unused-vars": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-non-null-assertion": 0
}
},
{
files: ["**/*.spec.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"], // or any other pattern
ignores: ["docs/**", "docs-references/**"],
plugins: {
vitest
},
rules: {
...vitest.configs.recommended.rules, // you can also use vitest.configs.all.rules to enable all rules
"vitest/consistent-test-it": ["error", {fn: "it", withinDescribe: "it"}],
"vitest/no-alias-methods": "error",
"vitest/expect-expect": "off"
}
},
{
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
languageOptions: {
parserOptions: {}
},
plugins: {
"simple-import-sort": pluginSimpleImportSort,
workspaces: pluginWorkspaces
},
rules: {
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"workspaces/no-absolute-imports": "error"
}
},
pluginPrettierRecommended
];
4 changes: 0 additions & 4 deletions lint-staged.config.js

This file was deleted.

Loading
Loading