From 45045cec7b786e9417148df4f22c8e7e092f1e39 Mon Sep 17 00:00:00 2001 From: iamolegga Date: Thu, 23 Jan 2025 00:45:31 +0200 Subject: [PATCH] eslint, link in postinstall, and package-lock fixes --- .eslintrc.json | 99 ------------------------------- eslint.config.cjs | 147 ++++++++++++++++++++++++++++++++++++++++++++++ eslint.config.mjs | 127 --------------------------------------- package-lock.json | 2 +- postinstall.js | 4 +- 5 files changed, 150 insertions(+), 229 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 eslint.config.cjs delete mode 100644 eslint.config.mjs diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 76ff69b1..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "tsconfig.json", - "sourceType": "module" - }, - "plugins": ["@typescript-eslint/eslint-plugin"], - "extends": [ - "plugin:@typescript-eslint/recommended", - "plugin:import/recommended", - "plugin:import/typescript", - "plugin:prettier/recommended" - ], - "root": true, - "env": { - "node": true, - "jest": true - }, - "ignorePatterns": [".eslintrc.js"], - "rules": { - "@typescript-eslint/no-explicit-any": [ - "error", - { "fixToUnknown": true, "ignoreRestArgs": false } - ], - "@typescript-eslint/no-floating-promises": ["error", { "ignoreIIFE": true }], - "@typescript-eslint/no-unused-vars": [ - "error", - { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_", "ignoreRestSiblings": true } - ], - "@typescript-eslint/explicit-member-accessibility": [ - "error", - { "accessibility": "no-public" } - ], - "@typescript-eslint/member-ordering": ["error", { - "default": [ - "public-static-field", - "public-static-get", - "public-static-set", - "public-static-method", - "protected-static-field", - "protected-static-get", - "protected-static-set", - "protected-static-method", - "private-static-field", - "private-static-get", - "private-static-set", - "private-static-method", - - "signature", - "public-abstract-field", - "protected-abstract-field", - "public-decorated-field", - "public-instance-field", - "protected-decorated-field", - "protected-instance-field", - "private-decorated-field", - "private-instance-field", - - "public-constructor", - "protected-constructor", - "private-constructor", - - "public-abstract-get", - "public-abstract-set", - "public-abstract-method", - "public-decorated-get", - "public-instance-get", - "public-decorated-set", - "public-instance-set", - "public-decorated-method", - "public-instance-method", - - "protected-abstract-get", - "protected-abstract-set", - "protected-abstract-method", - "protected-decorated-get", - "protected-instance-get", - "protected-decorated-set", - "protected-instance-set", - "protected-decorated-method", - "protected-instance-method", - - "private-decorated-get", - "private-instance-get", - "private-decorated-set", - "private-instance-set", - "private-decorated-method", - "private-instance-method" - ] - }], - "import/order": [ - "error", - { - "alphabetize": { "order": "asc", "caseInsensitive": true }, - "newlines-between": "always" - } - ] - } -} diff --git a/eslint.config.cjs b/eslint.config.cjs new file mode 100644 index 00000000..838c6109 --- /dev/null +++ b/eslint.config.cjs @@ -0,0 +1,147 @@ +const { fixupConfigRules, fixupPluginRules } = require('@eslint/compat'); +const { FlatCompat } = require('@eslint/eslintrc'); +const js = require('@eslint/js'); +const typescriptEslintEslintPlugin = require('@typescript-eslint/eslint-plugin'); +const tsParser = require('@typescript-eslint/parser'); +const globals = require('globals'); + +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, +}); + +module.exports = [ + { + ignores: ['eslint.config.cjs'], + }, + ...fixupConfigRules( + compat.extends( + 'plugin:@typescript-eslint/recommended', + 'plugin:import/recommended', + 'plugin:import/typescript', + 'plugin:prettier/recommended', + ), + ), + { + plugins: { + '@typescript-eslint': fixupPluginRules(typescriptEslintEslintPlugin), + }, + + languageOptions: { + globals: { + ...globals.node, + ...globals.jest, + }, + + parser: tsParser, + ecmaVersion: 5, + sourceType: 'module', + + parserOptions: { + project: 'tsconfig.json', + }, + }, + + rules: { + '@typescript-eslint/no-explicit-any': [ + 'error', + { + fixToUnknown: true, + ignoreRestArgs: false, + }, + ], + + '@typescript-eslint/no-floating-promises': [ + 'error', + { + ignoreIIFE: true, + }, + ], + + '@typescript-eslint/no-unused-vars': [ + 'error', + { + varsIgnorePattern: '^_', + argsIgnorePattern: '^_', + ignoreRestSiblings: true, + }, + ], + + '@typescript-eslint/explicit-member-accessibility': [ + 'error', + { + accessibility: 'no-public', + }, + ], + + '@typescript-eslint/member-ordering': [ + 'error', + { + default: [ + 'public-static-field', + 'public-static-get', + 'public-static-set', + 'public-static-method', + 'protected-static-field', + 'protected-static-get', + 'protected-static-set', + 'protected-static-method', + 'private-static-field', + 'private-static-get', + 'private-static-set', + 'private-static-method', + 'signature', + 'public-abstract-field', + 'protected-abstract-field', + 'public-decorated-field', + 'public-instance-field', + 'protected-decorated-field', + 'protected-instance-field', + 'private-decorated-field', + 'private-instance-field', + 'public-constructor', + 'protected-constructor', + 'private-constructor', + 'public-abstract-get', + 'public-abstract-set', + 'public-abstract-method', + 'public-decorated-get', + 'public-instance-get', + 'public-decorated-set', + 'public-instance-set', + 'public-decorated-method', + 'public-instance-method', + 'protected-abstract-get', + 'protected-abstract-set', + 'protected-abstract-method', + 'protected-decorated-get', + 'protected-instance-get', + 'protected-decorated-set', + 'protected-instance-set', + 'protected-decorated-method', + 'protected-instance-method', + 'private-decorated-get', + 'private-instance-get', + 'private-decorated-set', + 'private-instance-set', + 'private-decorated-method', + 'private-instance-method', + ], + }, + ], + + 'import/order': [ + 'error', + { + alphabetize: { + order: 'asc', + caseInsensitive: true, + }, + + 'newlines-between': 'always', + }, + ], + }, + }, +]; diff --git a/eslint.config.mjs b/eslint.config.mjs deleted file mode 100644 index 1535517d..00000000 --- a/eslint.config.mjs +++ /dev/null @@ -1,127 +0,0 @@ -import { fixupConfigRules, fixupPluginRules } from "@eslint/compat"; -import typescriptEslintEslintPlugin from "@typescript-eslint/eslint-plugin"; -import globals from "globals"; -import tsParser from "@typescript-eslint/parser"; -import path from "node:path"; -import { fileURLToPath } from "node:url"; -import js from "@eslint/js"; -import { FlatCompat } from "@eslint/eslintrc"; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); -const compat = new FlatCompat({ - baseDirectory: __dirname, - recommendedConfig: js.configs.recommended, - allConfig: js.configs.all -}); - -export default [{ - ignores: ["**/.eslintrc.js"], -}, ...fixupConfigRules(compat.extends( - "plugin:@typescript-eslint/recommended", - "plugin:import/recommended", - "plugin:import/typescript", - "plugin:prettier/recommended", -)), { - plugins: { - "@typescript-eslint": fixupPluginRules(typescriptEslintEslintPlugin), - }, - - languageOptions: { - globals: { - ...globals.node, - ...globals.jest, - }, - - parser: tsParser, - ecmaVersion: 5, - sourceType: "module", - - parserOptions: { - project: "tsconfig.json", - }, - }, - - rules: { - "@typescript-eslint/no-explicit-any": ["error", { - fixToUnknown: true, - ignoreRestArgs: false, - }], - - "@typescript-eslint/no-floating-promises": ["error", { - ignoreIIFE: true, - }], - - "@typescript-eslint/no-unused-vars": ["error", { - varsIgnorePattern: "^_", - argsIgnorePattern: "^_", - ignoreRestSiblings: true, - }], - - "@typescript-eslint/explicit-member-accessibility": ["error", { - accessibility: "no-public", - }], - - "@typescript-eslint/member-ordering": ["error", { - default: [ - "public-static-field", - "public-static-get", - "public-static-set", - "public-static-method", - "protected-static-field", - "protected-static-get", - "protected-static-set", - "protected-static-method", - "private-static-field", - "private-static-get", - "private-static-set", - "private-static-method", - "signature", - "public-abstract-field", - "protected-abstract-field", - "public-decorated-field", - "public-instance-field", - "protected-decorated-field", - "protected-instance-field", - "private-decorated-field", - "private-instance-field", - "public-constructor", - "protected-constructor", - "private-constructor", - "public-abstract-get", - "public-abstract-set", - "public-abstract-method", - "public-decorated-get", - "public-instance-get", - "public-decorated-set", - "public-instance-set", - "public-decorated-method", - "public-instance-method", - "protected-abstract-get", - "protected-abstract-set", - "protected-abstract-method", - "protected-decorated-get", - "protected-instance-get", - "protected-decorated-set", - "protected-instance-set", - "protected-decorated-method", - "protected-instance-method", - "private-decorated-get", - "private-instance-get", - "private-decorated-set", - "private-instance-set", - "private-decorated-method", - "private-instance-method", - ], - }], - - "import/order": ["error", { - alphabetize: { - order: "asc", - caseInsensitive: true, - }, - - "newlines-between": "always", - }], - }, -}]; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 615b0ef3..8903068b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,7 +48,7 @@ "node": ">= 14" }, "peerDependencies": { - "@nestjs/common": "^8.0.0 || ^9.0.0 || ^10.0.0", + "@nestjs/common": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0", "pino-http": "^6.4.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0" } }, diff --git a/postinstall.js b/postinstall.js index 94a3b743..a70d9548 100644 --- a/postinstall.js +++ b/postinstall.js @@ -9,10 +9,10 @@ console.log(` \t\tbombed cities (including schools, hospitals, etc), hundreds of killed children, millions of refugees. \t\tSo if you enjoy this library you can thank the author by donating to one of this funds: \t\t• https://war.ukraine.ua/donate/ – Armed Forces of Ukraine -\t\t• https://www.comebackalive.in.ua/ – Ukrainian volunteers +\t\t• https://savelife.in.ua/en/ – "The Come Back Alive" foundation \t\tThanks for your support! 🇺🇦 `); -new Promise(r => setTimeout(r, 5000)); +new Promise((r) => setTimeout(r, 5000));