From ed2b0ba710bf9aa8d6400059f2dabb574a010a9c Mon Sep 17 00:00:00 2001 From: Hasko Date: Wed, 24 Jun 2026 18:10:34 +0200 Subject: [PATCH 1/2] feat(eslint): :heavy_plus_sign: Add @haskou/eslint-config --- .prettierrc.json | 13 --- eslint.config.js | 251 -------------------------------------------- eslint.config.mjs | 10 ++ package.json | 10 +- prettier.config.mjs | 3 + yarn.lock | 33 +++++- 6 files changed, 44 insertions(+), 276 deletions(-) delete mode 100644 .prettierrc.json delete mode 100644 eslint.config.js create mode 100644 eslint.config.mjs create mode 100644 prettier.config.mjs diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index 7c3294b..0000000 --- a/.prettierrc.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "tabWidth": 2, - "useTabs": false, - "printWidth": 80, - "singleQuote": true, - "trailingComma": "all", - "bracketSpacing": true, - "bracketSameLine": false, - "jsxBracketSameLine": false, - "semi": true, - "arrowParens": "always", - "endOfLine": "auto" -} diff --git a/eslint.config.js b/eslint.config.js deleted file mode 100644 index b887972..0000000 --- a/eslint.config.js +++ /dev/null @@ -1,251 +0,0 @@ -const tsParser = require('@typescript-eslint/parser'); -const tsPlugin = require('@typescript-eslint/eslint-plugin'); -const perfectionist = require('eslint-plugin-perfectionist'); -const prettier = require('eslint-config-prettier'); -const prettierPlugin = require('eslint-plugin-prettier'); -const sonarjs = require('eslint-plugin-sonarjs'); -const unusedImports = require('eslint-plugin-unused-imports'); - -const globals = { - Buffer: 'readonly', - __dirname: 'readonly', - console: 'readonly', - exports: 'readonly', - module: 'readonly', - process: 'readonly', - require: 'readonly', -}; - -const jestGlobals = { - afterAll: 'readonly', - afterEach: 'readonly', - beforeAll: 'readonly', - beforeEach: 'readonly', - describe: 'readonly', - expect: 'readonly', - it: 'readonly', - jest: 'readonly', -}; - -module.exports = [ - { - ignores: ['dist/**', 'node_modules/**', 'tests/**'], - }, - { - files: ['**/*.ts'], - languageOptions: { - globals, - parser: tsParser, - parserOptions: { - project: ['./tsconfig.json', './tsconfig.jest.json'], - sourceType: 'module', - tsconfigRootDir: __dirname, - }, - }, - plugins: { - '@typescript-eslint': tsPlugin, - perfectionist, - prettier: prettierPlugin, - sonarjs, - 'unused-imports': unusedImports, - }, - rules: { - ...tsPlugin.configs.recommended.rules, - ...prettier.rules, - '@typescript-eslint/explicit-member-accessibility': [ - 'error', - { - accessibility: 'explicit', - ignoredMethodNames: ['constructor'], - }, - ], - '@typescript-eslint/explicit-module-boundary-types': [ - 'error', - { - allowedNames: ['toPrimitives'], - }, - ], - '@typescript-eslint/member-delimiter-style': 'off', - '@typescript-eslint/member-ordering': [ - 'error', - { - default: [ - 'field', - 'static-field', - 'private-static-field', - 'public-static-field', - 'private-instance-field', - 'public-instance-field', - 'private-static-method', - 'public-static-method', - 'constructor', - 'private-method', - 'public-method', - ], - }, - ], - '@typescript-eslint/naming-convention': [ - 'error', - { - format: ['camelCase', 'PascalCase'], - leadingUnderscore: 'allow', - selector: ['variable', 'function'], - }, - { - custom: { - match: true, - regex: '^[A-Z]', - }, - format: ['PascalCase'], - selector: 'interface', - }, - ], - '@typescript-eslint/no-explicit-any': 'warn', - '@typescript-eslint/no-floating-promises': 'error', - '@typescript-eslint/no-inferrable-types': 'off', - '@typescript-eslint/no-misused-promises': 'off', - '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/no-require-imports': 'error', - '@typescript-eslint/no-this-alias': 'warn', - '@typescript-eslint/no-unsafe-argument': 'warn', - '@typescript-eslint/no-unsafe-call': 'warn', - '@typescript-eslint/no-unsafe-return': 'error', - '@typescript-eslint/no-use-before-define': 'warn', - '@typescript-eslint/prefer-for-of': 'error', - '@typescript-eslint/require-await': 'error', - complexity: ['error', 8], - 'lines-between-class-members': [ - 'error', - 'always', - { - exceptAfterSingleLine: true, - }, - ], - 'max-classes-per-file': ['error', 1], - 'max-depth': ['warn', 3], - 'max-len': [ - 'error', - { - code: 80, - ignoreRegExpLiterals: true, - ignoreStrings: true, - ignoreTemplateLiterals: true, - }, - ], - 'max-nested-callbacks': ['warn', 2], - 'max-params': ['warn', 7], - 'new-parens': 'error', - 'no-bitwise': 'error', - 'no-caller': 'error', - 'no-cond-assign': 'error', - 'no-console': 'warn', - 'no-debugger': 'error', - 'no-empty': 'error', - 'no-eval': 'error', - 'no-extra-boolean-cast': 'error', - 'no-fallthrough': 'off', - 'no-invalid-this': 'off', - 'no-new-wrappers': 'error', - 'no-param-reassign': [ - 'warn', - { - props: true, - }, - ], - 'no-restricted-imports': [ - 'error', - { - paths: [ - { - message: 'Domain layer cannot import infrastructure.', - name: '../infrastructure', - }, - ], - }, - ], - 'no-throw-literal': 'error', - 'no-trailing-spaces': 'error', - 'no-undef-init': 'error', - 'no-unsafe-finally': 'error', - 'no-unused-expressions': [ - 'error', - { - allowShortCircuit: true, - }, - ], - 'no-unused-labels': 'error', - 'no-unused-vars': 'off', - 'object-shorthand': 'error', - 'one-var': ['error', 'never'], - 'padding-line-between-statements': [ - 'error', - { - blankLine: 'always', - next: ['class', 'export', 'const', 'let', 'var'], - prev: 'import', - }, - { - blankLine: 'always', - next: 'return', - prev: '*', - }, - { - blankLine: 'always', - next: 'if', - prev: '*', - }, - ], - 'perfectionist/sort-imports': [ - 'error', - { - order: 'asc', - type: 'natural', - }, - ], - 'perfectionist/sort-objects': [ - 'warn', - { - order: 'asc', - type: 'natural', - }, - ], - 'prettier/prettier': 'error', - radix: 'error', - 'require-await': 'off', - 'sonarjs/cognitive-complexity': ['error', 10], - 'sonarjs/no-collapsible-if': 'error', - 'sonarjs/no-duplicated-branches': 'error', - 'sonarjs/no-identical-expressions': 'warn', - 'sonarjs/no-nested-switch': 'warn', - 'sonarjs/prefer-single-boolean-return': 'error', - 'spaced-comment': 'error', - 'unused-imports/no-unused-imports': 'error', - 'unused-imports/no-unused-vars': [ - 'warn', - { - args: 'after-used', - argsIgnorePattern: '^_', - vars: 'all', - varsIgnorePattern: '^_', - }, - ], - 'use-isnan': 'error', - 'valid-typeof': 'off', - }, - }, - { - files: ['**/*.spec.ts'], - languageOptions: { - globals: { - ...globals, - ...jestGlobals, - }, - }, - rules: { - '@typescript-eslint/no-unsafe-argument': 'off', - 'max-lines-per-function': 'off', - 'max-nested-callbacks': ['warn', 4], - 'max-statements': 'off', - }, - }, -]; diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..9a25a0a --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,10 @@ +import haskou from '@haskou/eslint-config'; + +export default [ + ...haskou, + { + rules: { + 'no-restricted-syntax': 'off', + }, + }, +]; diff --git a/package.json b/package.json index 1b31a4e..b0b24de 100644 --- a/package.json +++ b/package.json @@ -72,16 +72,10 @@ "tslib": "^2.8.1" }, "devDependencies": { + "@haskou/eslint-config": "^0.1.0", "@types/jest": "^30.0.0", "@types/node": "^25.9.3", - "@typescript-eslint/eslint-plugin": "8.61.0", - "@typescript-eslint/parser": "8.61.0", - "eslint": "10.4.1", - "eslint-config-prettier": "^10.1.8", - "eslint-plugin-perfectionist": "^5.9.0", - "eslint-plugin-prettier": "^5.5.6", - "eslint-plugin-sonarjs": "^4.0.3", - "eslint-plugin-unused-imports": "^4.4.1", + "eslint": "^10.5.0", "jest": "^30.4.2", "jest-extended": "^7.0.0", "prettier": "^3.8.4", diff --git a/prettier.config.mjs b/prettier.config.mjs new file mode 100644 index 0000000..fbf44fd --- /dev/null +++ b/prettier.config.mjs @@ -0,0 +1,3 @@ +import prettierConfig from '@haskou/eslint-config/prettier'; + +export default prettierConfig; diff --git a/yarn.lock b/yarn.lock index 9e3d5f3..6b55c67 100644 --- a/yarn.lock +++ b/yarn.lock @@ -618,6 +618,11 @@ dependencies: "@types/json-schema" "^7.0.15" +"@eslint/js@^10.4.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-10.0.1.tgz#1e8a876f50117af8ab67e47d5ad94d38d6622583" + integrity sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA== + "@eslint/object-schema@^3.0.5": version "3.0.5" resolved "https://registry.yarnpkg.com/@eslint/object-schema/-/object-schema-3.0.5.tgz#88e9bf4d11d2b19c082e78ebe7ce88724a5eb091" @@ -631,6 +636,21 @@ "@eslint/core" "^1.2.1" levn "^0.4.1" +"@haskou/eslint-config@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@haskou/eslint-config/-/eslint-config-0.1.0.tgz#b615a436cad5a72c48d612c51efa37e6af19634f" + integrity sha512-5LvE9JlN8drmRos4sPjmbOk4pdWDhw+VX6+4FgZmpVTj2kew1v34jelMaOT0lrSZxs3/aQgdqU5yyEmMxwbY4Q== + dependencies: + "@eslint/js" "^10.4.1" + "@typescript-eslint/eslint-plugin" "8.61.0" + "@typescript-eslint/parser" "8.61.0" + eslint-config-prettier "^10.1.8" + eslint-plugin-perfectionist "^5.9.0" + eslint-plugin-prettier "^5.5.6" + eslint-plugin-sonarjs "^4.0.3" + eslint-plugin-unused-imports "^4.4.1" + globals "^16.4.0" + "@humanfs/core@^0.19.2": version "0.19.2" resolved "https://registry.yarnpkg.com/@humanfs/core/-/core-0.19.2.tgz#a8272ca03b2acf492670222b2320b6c421bfde60" @@ -2266,10 +2286,10 @@ eslint-visitor-keys@^5.0.0, eslint-visitor-keys@^5.0.1: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz#9e3c9489697824d2d4ce3a8ad12628f91e9f59be" integrity sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA== -eslint@10.4.1: - version "10.4.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-10.4.1.tgz#f6640b176e0912246d9ddbf8fcfa5e8b7f02445a" - integrity sha512-AyIKhnOBuOAdueD7RB3xB+YeAWScb9jHsJBgH2Hcde8InP5JYhqrRR6iTMHyTEwgENK54Cp44e4v8BwNhsuHuw== +eslint@^10.5.0: + version "10.5.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-10.5.0.tgz#5fca69d6b41fe7e00ba22d4100b2e44efe439ad5" + integrity sha512-1y+7C+vi12bUK1IpZeaV3gsH9fHLBmPvYmPx42pvT/E9yG0IC8g3PUZZgp0+JLJl7ZDK0flc2gc+Aw9dpCvIsQ== dependencies: "@eslint-community/eslint-utils" "^4.8.0" "@eslint-community/regexpp" "^4.12.2" @@ -2526,6 +2546,11 @@ glob@^7.1.4: once "^1.3.0" path-is-absolute "^1.0.0" +globals@^16.4.0: + version "16.5.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-16.5.0.tgz#ccf1594a437b97653b2be13ed4d8f5c9f850cac1" + integrity sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ== + globals@^17.4.0: version "17.6.0" resolved "https://registry.yarnpkg.com/globals/-/globals-17.6.0.tgz#0f0be018d5cca8690e6375ead1f65c4bb96191fc" From 13102623bda11d25e61761eab8bca922b1de0ba3 Mon Sep 17 00:00:00 2001 From: Hasko Date: Wed, 24 Jun 2026 18:37:34 +0200 Subject: [PATCH 2/2] feat(eslint): :arrow_up: Upgrade @haskou/eslint-config to 0.1.1 --- package.json | 2 +- yarn.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index b0b24de..0b41aec 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "tslib": "^2.8.1" }, "devDependencies": { - "@haskou/eslint-config": "^0.1.0", + "@haskou/eslint-config": "^0.1.1", "@types/jest": "^30.0.0", "@types/node": "^25.9.3", "eslint": "^10.5.0", diff --git a/yarn.lock b/yarn.lock index 6b55c67..0dfd0b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -618,7 +618,7 @@ dependencies: "@types/json-schema" "^7.0.15" -"@eslint/js@^10.4.1": +"@eslint/js@^10.0.1": version "10.0.1" resolved "https://registry.yarnpkg.com/@eslint/js/-/js-10.0.1.tgz#1e8a876f50117af8ab67e47d5ad94d38d6622583" integrity sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA== @@ -636,12 +636,12 @@ "@eslint/core" "^1.2.1" levn "^0.4.1" -"@haskou/eslint-config@^0.1.0": - version "0.1.0" - resolved "https://registry.yarnpkg.com/@haskou/eslint-config/-/eslint-config-0.1.0.tgz#b615a436cad5a72c48d612c51efa37e6af19634f" - integrity sha512-5LvE9JlN8drmRos4sPjmbOk4pdWDhw+VX6+4FgZmpVTj2kew1v34jelMaOT0lrSZxs3/aQgdqU5yyEmMxwbY4Q== +"@haskou/eslint-config@^0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@haskou/eslint-config/-/eslint-config-0.1.1.tgz#81233418a57d11f8fb723693615591a320cb266f" + integrity sha512-NZfhdAAenWpW+I9mzLl9F/lbNcyZsBpFigUhueDblFKOFS8LOaO5ViGhgQNhgThK7rNjetMEQBJ20X9MUQqPyA== dependencies: - "@eslint/js" "^10.4.1" + "@eslint/js" "^10.0.1" "@typescript-eslint/eslint-plugin" "8.61.0" "@typescript-eslint/parser" "8.61.0" eslint-config-prettier "^10.1.8"