From ca5abe8c4a6ef49499f642978ca6f5be6e59c692 Mon Sep 17 00:00:00 2001 From: Ramesh Date: Wed, 4 Feb 2026 18:20:43 +0545 Subject: [PATCH 1/7] chore: update eslint config for fastify --- packages/eslint-config/fastify.js | 236 +++++++++++++++------------- packages/eslint-config/package.json | 6 +- pnpm-lock.yaml | 95 +++++++++++ 3 files changed, 227 insertions(+), 110 deletions(-) diff --git a/packages/eslint-config/fastify.js b/packages/eslint-config/fastify.js index 2f5c843..410af0d 100644 --- a/packages/eslint-config/fastify.js +++ b/packages/eslint-config/fastify.js @@ -1,119 +1,139 @@ -module.exports = { - env: { - browser: true, - es2021: true, - node: true, +import js from "@eslint/js"; +import importPlugin from "eslint-plugin-import"; +import nodePlugin from "eslint-plugin-n"; +import prettierPluginRecommened from "eslint-plugin-prettier/recommended"; +import promisePlugin from "eslint-plugin-promise"; +import unicornPlugin from "eslint-plugin-unicorn"; +import globals from "globals"; +import tseslint from "typescript-eslint"; + +export default [ + { + ignores: ["coverage/", "dist/", "node_modules/", "eslint.config.js"], }, - extends: [ - "eslint:recommended", - "plugin:n/recommended", - "plugin:import/recommended", - "plugin:import/typescript", - "plugin:prettier/recommended", - "plugin:@typescript-eslint/recommended", - "plugin:unicorn/recommended", - "prettier", - ], - overrides: [ - { - files: "**/*.spec.ts", + js.configs.recommended, + ...tseslint.configs.recommended, + { + languageOptions: { + ecmaVersion: "latest", + sourceType: "module", + globals: { + ...globals.browser, + ...globals.es2021, + ...globals.node, + }, }, - ], - parser: "@typescript-eslint/parser", - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - }, - plugins: [ - "@typescript-eslint", - "import", - "n", - "prettier", - "promise", - "unicorn", - ], - rules: { - curly: ["error", "all"], - "brace-style": ["error", "1tbs"], - "import/order": [ - "error", - { - alphabetize: { - order: "asc", - caseInsensitive: true, + plugins: { + n: nodePlugin, + import: importPlugin, + promise: promisePlugin, + unicorn: unicornPlugin, + }, + rules: { + // Base rules + curly: ["error", "all"], + "brace-style": ["error", "1tbs"], + + // Node rules + ...nodePlugin.configs["flat/recommended-script"].rules, + "n/no-unsupported-features/es-syntax": [ + "error", + { ignores: ["modules"] }, + ], + "n/no-unpublished-import": [ + "error", + { + allowModules: [ + "@faker-js/faker", + "mercurius-codegen", + "query-string", + ], }, - groups: [ - "builtin", - "external", - "internal", - ["parent", "sibling"], - "index", - "object", - "type", - ], - "newlines-between": "always", - }, - ], - "n/no-unsupported-features/es-syntax": ["error", { ignores: ["modules"] }], - "n/no-unpublished-import": [ - "error", - { - allowModules: ["@faker-js/faker", "mercurius-codegen", "query-string"], - }, - ], - "prettier/prettier": "error", - "unicorn/filename-case": [ - "error", - { - cases: { - camelCase: true, - snakeCase: true, + ], + + // Import rules + ...importPlugin.configs.recommended.rules, + ...importPlugin.configs.typescript.rules, + "import/order": [ + "error", + { + alphabetize: { + order: "asc", + caseInsensitive: true, + }, + groups: [ + "builtin", + "external", + "internal", + ["parent", "sibling"], + "index", + "object", + "type", + ], + "newlines-between": "always", }, - }, - ], - "unicorn/import-style": [ - "error", - { - styles: { - "node:path": { - named: true, + ], + + // Unicorn rules + ...unicornPlugin.configs.recommended.rules, + "unicorn/filename-case": [ + "error", + { + cases: { + camelCase: true, + snakeCase: true, }, }, - }, - ], - "unicorn/numeric-separators-style": [ - "error", - { - number: { - minimumDigits: 6, - groupLength: 3, + ], + "unicorn/import-style": [ + "error", + { + styles: { + "node:path": { + named: true, + }, + }, }, - }, - ], - // [DU 2024-SEP-10]: Disabled the 'unicorn/prefer-structured-clone' rule, which recommends using 'structuredClone' - // instead of 'JSON.parse(JSON.stringify(...))' (see: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-structured-clone.md). - // This may cause warnings when using 'JSON.parse(JSON.stringify(data))'. The reason for using this approach is unclear, - // but it could potentially lead to issues for other developers. Further review is needed to determine if 'structuredClone' should be used instead. - "unicorn/prefer-structured-clone": "off", - "unicorn/prevent-abbreviations": [ - "error", - { - allowList: { - db: true, - docs: true, - env: true, - err: true, - i: true, - param: true, - req: true, - res: true, + ], + "unicorn/numeric-separators-style": [ + "error", + { + number: { + minimumDigits: 6, + groupLength: 3, + }, + }, + ], + "unicorn/prefer-structured-clone": "off", + "unicorn/prevent-abbreviations": [ + "error", + { + allowList: { + db: true, + docs: true, + env: true, + err: true, + i: true, + param: true, + req: true, + res: true, + }, }, + ], + }, + settings: { + node: { + tryExtensions: [".js", ".json", ".node", ".ts"], + }, + "import/resolver": { + typescript: true, + node: true, }, - ], - }, - settings: { - node: { - tryExtensions: [".js", ".json", ".node", ".ts"], }, }, -}; + { + files: ["**/*.spec.ts"], + // overrides for spec files if any (legacy file had empty overrides for this pattern) + }, + prettierPluginRecommened, +]; diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index cc8edd6..3e8e6cb 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -27,7 +27,9 @@ "eslint-import-resolver-alias": "1.1.2", "eslint-import-resolver-typescript": "4.4.4", "eslint-plugin-import": "2.32.0", + "eslint-plugin-n": "17.20.0", "eslint-plugin-prettier": "5.5.5", + "eslint-plugin-promise": "7.2.1", "eslint-plugin-unicorn": "62.0.0", "eslint-plugin-vue": "10.7.0", "globals": "17.3.0", @@ -37,9 +39,9 @@ "vue-eslint-parser": "10.2.0" }, "peerDependencies": { + "@eslint/js": ">=8.57.1", "@typescript-eslint/eslint-plugin": ">=8.14.0", "@typescript-eslint/parser": ">=8.14.0", - "@eslint/js": ">=8.57.1", "eslint": ">=8.57.1 <=9.39.2", "eslint-config-prettier": ">=9.1.0", "eslint-config-react-app": ">=7.0.1", @@ -83,4 +85,4 @@ "publishConfig": { "access": "public" } -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 252144e..652c766 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -50,9 +50,15 @@ importers: eslint-plugin-import: specifier: 2.32.0 version: 2.32.0(@typescript-eslint/parser@8.54.0(eslint@9.39.2(jiti@1.21.6))(typescript@5.9.3))(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.2(jiti@1.21.6)) + eslint-plugin-n: + specifier: 17.20.0 + version: 17.20.0(eslint@9.39.2(jiti@1.21.6))(typescript@5.9.3) eslint-plugin-prettier: specifier: 5.5.5 version: 5.5.5(eslint-config-prettier@10.1.8(eslint@9.39.2(jiti@1.21.6)))(eslint@9.39.2(jiti@1.21.6))(prettier@3.8.1) + eslint-plugin-promise: + specifier: 7.2.1 + version: 7.2.1(eslint@9.39.2(jiti@1.21.6)) eslint-plugin-unicorn: specifier: 62.0.0 version: 62.0.0(eslint@9.39.2(jiti@1.21.6)) @@ -917,6 +923,10 @@ packages: end-of-stream@1.4.4: resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} + enhanced-resolve@5.19.0: + resolution: {integrity: sha512-phv3E1Xl4tQOShqSte26C7Fl84EwUdZsyOuSSk9qtAGyyQs2s3jJzComh+Abf4g187lUUAvH+H26omrqia2aGg==} + engines: {node: '>=10.13.0'} + env-paths@2.2.1: resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==} engines: {node: '>=6'} @@ -964,6 +974,12 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} + eslint-compat-utils@0.5.1: + resolution: {integrity: sha512-3z3vFexKIEnjHE3zCMRo6fn/e44U7T1khUjg+Hp0ZQMCigh28rALD0nPFBcGZuiLC5rLZa2ubQHDRln09JfU2Q==} + engines: {node: '>=12'} + peerDependencies: + eslint: '>=6.0.0' + eslint-config-prettier@10.1.8: resolution: {integrity: sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==} hasBin: true @@ -1022,6 +1038,12 @@ packages: eslint-import-resolver-webpack: optional: true + eslint-plugin-es-x@7.8.0: + resolution: {integrity: sha512-7Ds8+wAAoV3T+LAKeu39Y5BzXCrGKrcISfgKEqTS4BDN8SFEDQd0S43jiQ8vIa3wUKD07qitZdfzlenSi8/0qQ==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + eslint: '>=8' + eslint-plugin-import@2.32.0: resolution: {integrity: sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==} engines: {node: '>=4'} @@ -1032,6 +1054,12 @@ packages: '@typescript-eslint/parser': optional: true + eslint-plugin-n@17.20.0: + resolution: {integrity: sha512-IRSoatgB/NQJZG5EeTbv/iAx1byOGdbbyhQrNvWdCfTnmPxUT0ao9/eGOeG7ljD8wJBsxwE8f6tES5Db0FRKEw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: '>=8.23.0' + eslint-plugin-prettier@5.5.5: resolution: {integrity: sha512-hscXkbqUZ2sPithAuLm5MXL+Wph+U7wHngPBv9OMWwlP8iaflyxpjTYZkmdgB4/vPIhemRlBEoLrH7UC1n7aUw==} engines: {node: ^14.18.0 || >=16.0.0} @@ -1046,6 +1074,12 @@ packages: eslint-config-prettier: optional: true + eslint-plugin-promise@7.2.1: + resolution: {integrity: sha512-SWKjd+EuvWkYaS+uN2csvj0KoP43YTu7+phKQ5v+xw6+A0gutVX2yqCeCkC3uLCJFiPfR2dD8Es5L7yUsmvEaA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 + eslint-plugin-unicorn@62.0.0: resolution: {integrity: sha512-HIlIkGLkvf29YEiS/ImuDZQbP12gWyx5i3C6XrRxMvVdqMroCI9qoVYCoIl17ChN+U89pn9sVwLxhIWj5nEc7g==} engines: {node: ^20.10.0 || >=21.0.0} @@ -1289,6 +1323,10 @@ packages: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} + globals@15.15.0: + resolution: {integrity: sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==} + engines: {node: '>=18'} + globals@16.5.0: resolution: {integrity: sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==} engines: {node: '>=18'} @@ -2379,6 +2417,10 @@ packages: resolution: {integrity: sha512-Bh7QjT8/SuKUIfObSXNHNSK6WHo6J1tHCqJsuaFDP7gP0fkzSfTxI8y85JrppZ0h8l0maIgc2tfuZQ6/t3GtnQ==} engines: {node: ^14.18.0 || >=16.0.0} + tapable@2.3.0: + resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==} + engines: {node: '>=6'} + temp-dir@1.0.0: resolution: {integrity: sha512-xZFXEGbG7SNC3itwBzI3RYjq/cEhBkx2hJuKGIUOcEULmkQExXiHat2z/qkISYsuR+IKumhEfKKbV5qXmhICFQ==} engines: {node: '>=4'} @@ -2440,6 +2482,11 @@ packages: peerDependencies: typescript: '>=4.8.4' + ts-declaration-location@1.0.7: + resolution: {integrity: sha512-EDyGAwH1gO0Ausm9gV6T2nUvBgXT5kGoCMJPllOaooZ+4VvJiKBdZE7wK18N1deEowhcUptS+5GXZK8U/fvpwA==} + peerDependencies: + typescript: '>=4.0.0' + tsconfig-paths@3.15.0: resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} @@ -3662,6 +3709,11 @@ snapshots: dependencies: once: 1.4.0 + enhanced-resolve@5.19.0: + dependencies: + graceful-fs: 4.2.11 + tapable: 2.3.0 + env-paths@2.2.1: {} error-ex@1.3.2: @@ -3756,6 +3808,11 @@ snapshots: escape-string-regexp@4.0.0: {} + eslint-compat-utils@0.5.1(eslint@9.39.2(jiti@1.21.6)): + dependencies: + eslint: 9.39.2(jiti@1.21.6) + semver: 7.7.3 + eslint-config-prettier@10.1.8(eslint@9.39.2(jiti@1.21.6)): dependencies: eslint: 9.39.2(jiti@1.21.6) @@ -3805,6 +3862,13 @@ snapshots: transitivePeerDependencies: - supports-color + eslint-plugin-es-x@7.8.0(eslint@9.39.2(jiti@1.21.6)): + dependencies: + '@eslint-community/eslint-utils': 4.9.1(eslint@9.39.2(jiti@1.21.6)) + '@eslint-community/regexpp': 4.12.2 + eslint: 9.39.2(jiti@1.21.6) + eslint-compat-utils: 0.5.1(eslint@9.39.2(jiti@1.21.6)) + eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.54.0(eslint@9.39.2(jiti@1.21.6))(typescript@5.9.3))(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.2(jiti@1.21.6)): dependencies: '@rtsao/scc': 1.1.0 @@ -3834,6 +3898,23 @@ snapshots: - eslint-import-resolver-webpack - supports-color + eslint-plugin-n@17.20.0(eslint@9.39.2(jiti@1.21.6))(typescript@5.9.3): + dependencies: + '@eslint-community/eslint-utils': 4.9.1(eslint@9.39.2(jiti@1.21.6)) + '@typescript-eslint/utils': 8.54.0(eslint@9.39.2(jiti@1.21.6))(typescript@5.9.3) + enhanced-resolve: 5.19.0 + eslint: 9.39.2(jiti@1.21.6) + eslint-plugin-es-x: 7.8.0(eslint@9.39.2(jiti@1.21.6)) + get-tsconfig: 4.13.1 + globals: 15.15.0 + ignore: 5.3.2 + minimatch: 9.0.5 + semver: 7.7.3 + ts-declaration-location: 1.0.7(typescript@5.9.3) + transitivePeerDependencies: + - supports-color + - typescript + eslint-plugin-prettier@5.5.5(eslint-config-prettier@10.1.8(eslint@9.39.2(jiti@1.21.6)))(eslint@9.39.2(jiti@1.21.6))(prettier@3.8.1): dependencies: eslint: 9.39.2(jiti@1.21.6) @@ -3843,6 +3924,11 @@ snapshots: optionalDependencies: eslint-config-prettier: 10.1.8(eslint@9.39.2(jiti@1.21.6)) + eslint-plugin-promise@7.2.1(eslint@9.39.2(jiti@1.21.6)): + dependencies: + '@eslint-community/eslint-utils': 4.9.1(eslint@9.39.2(jiti@1.21.6)) + eslint: 9.39.2(jiti@1.21.6) + eslint-plugin-unicorn@62.0.0(eslint@9.39.2(jiti@1.21.6)): dependencies: '@babel/helper-validator-identifier': 7.28.5 @@ -4148,6 +4234,8 @@ snapshots: globals@14.0.0: {} + globals@15.15.0: {} + globals@16.5.0: {} globals@17.3.0: {} @@ -5225,6 +5313,8 @@ snapshots: dependencies: '@pkgr/core': 0.2.9 + tapable@2.3.0: {} + temp-dir@1.0.0: {} temp-dir@2.0.0: {} @@ -5280,6 +5370,11 @@ snapshots: dependencies: typescript: 5.9.3 + ts-declaration-location@1.0.7(typescript@5.9.3): + dependencies: + picomatch: 4.0.3 + typescript: 5.9.3 + tsconfig-paths@3.15.0: dependencies: '@types/json5': 0.0.29 From c03faeb1a29169bfd8899b52c00133ed8e91a671 Mon Sep 17 00:00:00 2001 From: Ramesh Date: Thu, 5 Feb 2026 11:30:37 +0545 Subject: [PATCH 2/7] chore: update dependencies --- packages/eslint-config/package.json | 53 +++++------------------------ pnpm-lock.yaml | 21 ++++++------ 2 files changed, 20 insertions(+), 54 deletions(-) diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 3e8e6cb..56998bb 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -10,6 +10,7 @@ }, "license": "MIT", "main": "index.js", + "type": "module", "files": [ "fastify.js", "index.js", @@ -20,9 +21,8 @@ "scripts": { "sort-package": "npx sort-package-json" }, - "devDependencies": { + "dependencies": { "@eslint/js": "9.39.2", - "eslint": "9.39.2", "eslint-config-prettier": "10.1.8", "eslint-import-resolver-alias": "1.1.2", "eslint-import-resolver-typescript": "4.4.4", @@ -33,54 +33,19 @@ "eslint-plugin-unicorn": "62.0.0", "eslint-plugin-vue": "10.7.0", "globals": "17.3.0", - "prettier": "3.8.1", - "typescript": "5.9.3", "typescript-eslint": "8.54.0", "vue-eslint-parser": "10.2.0" }, + "devDependencies": { + "eslint": "9.39.2", + "globals": "17.3.0", + "prettier": "3.8.1", + "typescript": "5.9.3" + }, "peerDependencies": { - "@eslint/js": ">=8.57.1", - "@typescript-eslint/eslint-plugin": ">=8.14.0", - "@typescript-eslint/parser": ">=8.14.0", "eslint": ">=8.57.1 <=9.39.2", - "eslint-config-prettier": ">=9.1.0", - "eslint-config-react-app": ">=7.0.1", - "eslint-import-resolver-alias": ">=1.1.2", - "eslint-import-resolver-typescript": ">=3.6.3", - "eslint-plugin-cypress": ">=3.6.0", - "eslint-plugin-import": ">=2.31.0", - "eslint-plugin-n": ">=14.0.0", - "eslint-plugin-prettier": ">=5.2.1", - "eslint-plugin-promise": ">=7.1.0", - "eslint-plugin-unicorn": ">=56.0.1", - "eslint-plugin-vue": ">=9.29.0", "prettier": ">=3.3.3", - "typescript": ">=4.9.5", - "typescript-eslint": ">=8.54.0", - "vue-eslint-parser": ">=9.4.3" - }, - "peerDependenciesMeta": { - "eslint-config-react-app": { - "optional": true - }, - "eslint-plugin-cypress": { - "optional": true - }, - "eslint-plugin-n": { - "optional": true - }, - "eslint-plugin-promise": { - "optional": true - }, - "eslint-plugin-vue": { - "optional": true - }, - "typescript-eslint": { - "optional": true - }, - "vue-eslint-parser": { - "optional": true - } + "typescript": ">=4.9.5" }, "publishConfig": { "access": "public" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 652c766..d2e7e15 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -31,13 +31,10 @@ importers: version: 5.5.4 packages/eslint-config: - devDependencies: + dependencies: '@eslint/js': specifier: 9.39.2 version: 9.39.2 - eslint: - specifier: 9.39.2 - version: 9.39.2(jiti@1.21.6) eslint-config-prettier: specifier: 10.1.8 version: 10.1.8(eslint@9.39.2(jiti@1.21.6)) @@ -68,18 +65,22 @@ importers: globals: specifier: 17.3.0 version: 17.3.0 - prettier: - specifier: 3.8.1 - version: 3.8.1 - typescript: - specifier: 5.9.3 - version: 5.9.3 typescript-eslint: specifier: 8.54.0 version: 8.54.0(eslint@9.39.2(jiti@1.21.6))(typescript@5.9.3) vue-eslint-parser: specifier: 10.2.0 version: 10.2.0(eslint@9.39.2(jiti@1.21.6)) + devDependencies: + eslint: + specifier: 9.39.2 + version: 9.39.2(jiti@1.21.6) + prettier: + specifier: 3.8.1 + version: 3.8.1 + typescript: + specifier: 5.9.3 + version: 5.9.3 packages/tsconfig: dependencies: From f9067c350b84a7ceae532977567727fbc1f0a46b Mon Sep 17 00:00:00 2001 From: Ramesh Date: Thu, 5 Feb 2026 11:31:12 +0545 Subject: [PATCH 3/7] chore: update eslint config for fastify --- packages/eslint-config/fastify.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/eslint-config/fastify.js b/packages/eslint-config/fastify.js index 410af0d..4164499 100644 --- a/packages/eslint-config/fastify.js +++ b/packages/eslint-config/fastify.js @@ -36,6 +36,7 @@ export default [ // Node rules ...nodePlugin.configs["flat/recommended-script"].rules, + "n/no-missing-import": "off", "n/no-unsupported-features/es-syntax": [ "error", { ignores: ["modules"] }, @@ -117,6 +118,7 @@ export default [ param: true, req: true, res: true, + utils: true, }, }, ], From 1148926cdb8d9a9d1d3d24be2857ceea8eb9bf6b Mon Sep 17 00:00:00 2001 From: Ramesh Date: Thu, 5 Feb 2026 14:56:07 +0545 Subject: [PATCH 4/7] chore: update dependencies --- packages/eslint-config/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 56998bb..933b794 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -38,7 +38,6 @@ }, "devDependencies": { "eslint": "9.39.2", - "globals": "17.3.0", "prettier": "3.8.1", "typescript": "5.9.3" }, From 2de1090077feb9750069a8bd4df420bd50fbe6c8 Mon Sep 17 00:00:00 2001 From: kabin thakuri Date: Thu, 5 Feb 2026 17:16:30 +0545 Subject: [PATCH 5/7] chore(vue): add Vite configuration settings to eslint config --- packages/eslint-config/vue.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/eslint-config/vue.js b/packages/eslint-config/vue.js index a962e31..22a0706 100755 --- a/packages/eslint-config/vue.js +++ b/packages/eslint-config/vue.js @@ -164,6 +164,18 @@ export default [ }, }, }, + // Vite configuration file settings + { + files: ["vite.config.*"], + settings: { + "import/ignore": [ + "@vitejs/plugin-vue", + "@vitejs/plugin-vue-jsx", + "vite", + "rollup", + ], + }, + }, // Test files configuration { files: ["**/*.spec.{js,ts}"], From 56fde4e201283cdc4a4a4e7ecf538c0184bb7946 Mon Sep 17 00:00:00 2001 From: Ramesh Date: Thu, 5 Feb 2026 17:27:10 +0545 Subject: [PATCH 6/7] docs: update readme file --- packages/eslint-config/README.md | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/packages/eslint-config/README.md b/packages/eslint-config/README.md index 0240b3d..762ca25 100644 --- a/packages/eslint-config/README.md +++ b/packages/eslint-config/README.md @@ -16,16 +16,15 @@ Custom ESLint configuration for streamlined linting across projects. Install dependencies: ```sh - npm i -D @prefabs.tech/eslint-config @typescript-eslint/eslint-plugin@8.14.0 @typescript-eslint/parser@8.14.0 eslint@8.57.1 eslint-config-prettier@9.1.0 eslint-import-resolver-alias@1.1.2 eslint-import-resolver-typescript@3.6.3 eslint-plugin-import@2.31.0 eslint-plugin-n@14.0.0 eslint-plugin-prettier@5.2.1 eslint-plugin-promise@7.1.0 eslint-plugin-unicorn@56.0.1 prettier@3.3.3 typescript + npm i -D @prefabs.tech/eslint-config eslint prettier typescript ``` - Create a `.eslintrc.js` file: + Create a `eslint.config.js` file: ```js - module.exports = { - root: true, - extends: ["@prefabs.tech/eslint-config/fastify"], - }; + import fastifyConfig from "@prefabs.tech/eslint-config/fastify.js"; + + export default fastifyConfig; ``` * ### For react libraries: @@ -105,16 +104,16 @@ Custom ESLint configuration for streamlined linting across projects. Install dependencies: ```sh - npm i -D @prefabs.tech/eslint-config eslint@8.57.1 @typescript-eslint/eslint-plugin@8.14.0 @typescript-eslint/parser@8.14.0 eslint@8.57.1 eslint-config-prettier@9.1.0 eslint-import-resolver-alias@1.1.2 eslint-import-resolver-typescript@3.6.3 eslint-plugin-import@2.31.0 eslint-plugin-n@14.0.0 eslint-plugin-prettier@5.2.1 eslint-plugin-promise@7.1.0 eslint-plugin-unicorn@56.0.1 prettier@3.3.3 typescript + npm i -D @prefabs.tech/eslint-config eslint prettier typescript ``` - Create a `.eslintrc.js` file: + Create a `eslint.config.js` file: ```js - module.exports = { - root: true, - extends: ["@prefabs.tech/eslint-config"], - }; + import config from "@prefabs.tech/eslint-config"; + + export default config; + ``` ``` ## Adding linting scripts @@ -126,12 +125,6 @@ In your `package.json`, add the following commands to the `scripts` section: "lint:fix": "eslint . --fix" ``` -* For vue projects (including .vue files): - ```json - "lint": "eslint . --ext .vue", - "lint:fix": "eslint . --ext .vue --fix", - ``` - ## Running linting Run the following command to lint your code: From 7c8e2ebadff5a5f561e39af6ba50b0b591be9792 Mon Sep 17 00:00:00 2001 From: Ramesh Date: Thu, 5 Feb 2026 17:28:14 +0545 Subject: [PATCH 7/7] feat: update eslint config for typescript projects --- packages/eslint-config/fastify.js | 140 +----------------- packages/eslint-config/index.js | 232 +++++++++++++++++------------- 2 files changed, 132 insertions(+), 240 deletions(-) diff --git a/packages/eslint-config/fastify.js b/packages/eslint-config/fastify.js index 4164499..9af4c5c 100644 --- a/packages/eslint-config/fastify.js +++ b/packages/eslint-config/fastify.js @@ -1,141 +1,5 @@ -import js from "@eslint/js"; -import importPlugin from "eslint-plugin-import"; -import nodePlugin from "eslint-plugin-n"; -import prettierPluginRecommened from "eslint-plugin-prettier/recommended"; -import promisePlugin from "eslint-plugin-promise"; -import unicornPlugin from "eslint-plugin-unicorn"; -import globals from "globals"; -import tseslint from "typescript-eslint"; +import baseConfig from "./index.js"; export default [ - { - ignores: ["coverage/", "dist/", "node_modules/", "eslint.config.js"], - }, - js.configs.recommended, - ...tseslint.configs.recommended, - { - languageOptions: { - ecmaVersion: "latest", - sourceType: "module", - globals: { - ...globals.browser, - ...globals.es2021, - ...globals.node, - }, - }, - plugins: { - n: nodePlugin, - import: importPlugin, - promise: promisePlugin, - unicorn: unicornPlugin, - }, - rules: { - // Base rules - curly: ["error", "all"], - "brace-style": ["error", "1tbs"], - - // Node rules - ...nodePlugin.configs["flat/recommended-script"].rules, - "n/no-missing-import": "off", - "n/no-unsupported-features/es-syntax": [ - "error", - { ignores: ["modules"] }, - ], - "n/no-unpublished-import": [ - "error", - { - allowModules: [ - "@faker-js/faker", - "mercurius-codegen", - "query-string", - ], - }, - ], - - // Import rules - ...importPlugin.configs.recommended.rules, - ...importPlugin.configs.typescript.rules, - "import/order": [ - "error", - { - alphabetize: { - order: "asc", - caseInsensitive: true, - }, - groups: [ - "builtin", - "external", - "internal", - ["parent", "sibling"], - "index", - "object", - "type", - ], - "newlines-between": "always", - }, - ], - - // Unicorn rules - ...unicornPlugin.configs.recommended.rules, - "unicorn/filename-case": [ - "error", - { - cases: { - camelCase: true, - snakeCase: true, - }, - }, - ], - "unicorn/import-style": [ - "error", - { - styles: { - "node:path": { - named: true, - }, - }, - }, - ], - "unicorn/numeric-separators-style": [ - "error", - { - number: { - minimumDigits: 6, - groupLength: 3, - }, - }, - ], - "unicorn/prefer-structured-clone": "off", - "unicorn/prevent-abbreviations": [ - "error", - { - allowList: { - db: true, - docs: true, - env: true, - err: true, - i: true, - param: true, - req: true, - res: true, - utils: true, - }, - }, - ], - }, - settings: { - node: { - tryExtensions: [".js", ".json", ".node", ".ts"], - }, - "import/resolver": { - typescript: true, - node: true, - }, - }, - }, - { - files: ["**/*.spec.ts"], - // overrides for spec files if any (legacy file had empty overrides for this pattern) - }, - prettierPluginRecommened, + ...baseConfig, ]; diff --git a/packages/eslint-config/index.js b/packages/eslint-config/index.js index 62e1691..4164499 100644 --- a/packages/eslint-config/index.js +++ b/packages/eslint-config/index.js @@ -1,113 +1,141 @@ -module.exports = { - env: { - browser: true, - es2021: true, - node: true, +import js from "@eslint/js"; +import importPlugin from "eslint-plugin-import"; +import nodePlugin from "eslint-plugin-n"; +import prettierPluginRecommened from "eslint-plugin-prettier/recommended"; +import promisePlugin from "eslint-plugin-promise"; +import unicornPlugin from "eslint-plugin-unicorn"; +import globals from "globals"; +import tseslint from "typescript-eslint"; + +export default [ + { + ignores: ["coverage/", "dist/", "node_modules/", "eslint.config.js"], }, - extends: [ - "eslint:recommended", - "plugin:n/recommended", - "plugin:import/recommended", - "plugin:import/typescript", - "plugin:prettier/recommended", - "plugin:@typescript-eslint/recommended", - "plugin:unicorn/recommended", - "prettier", - ], - overrides: [ - { - files: "**/*.spec.ts", + js.configs.recommended, + ...tseslint.configs.recommended, + { + languageOptions: { + ecmaVersion: "latest", + sourceType: "module", + globals: { + ...globals.browser, + ...globals.es2021, + ...globals.node, + }, }, - ], - parser: "@typescript-eslint/parser", - parserOptions: { - ecmaVersion: "latest", - sourceType: "module", - }, - plugins: [ - "@typescript-eslint", - "import", - "n", - "prettier", - "promise", - "unicorn", - ], - rules: { - curly: ["error", "all"], - "brace-style": ["error", "1tbs"], - "import/order": [ - "error", - { - alphabetize: { - order: "asc", - caseInsensitive: true, + plugins: { + n: nodePlugin, + import: importPlugin, + promise: promisePlugin, + unicorn: unicornPlugin, + }, + rules: { + // Base rules + curly: ["error", "all"], + "brace-style": ["error", "1tbs"], + + // Node rules + ...nodePlugin.configs["flat/recommended-script"].rules, + "n/no-missing-import": "off", + "n/no-unsupported-features/es-syntax": [ + "error", + { ignores: ["modules"] }, + ], + "n/no-unpublished-import": [ + "error", + { + allowModules: [ + "@faker-js/faker", + "mercurius-codegen", + "query-string", + ], }, - groups: [ - "builtin", - "external", - "internal", - ["parent", "sibling"], - "index", - "object", - "type", - ], - "newlines-between": "always", - }, - ], - "n/no-unsupported-features/es-syntax": ["error", { ignores: ["modules"] }], - "prettier/prettier": "error", - "unicorn/filename-case": [ - "error", - { - cases: { - camelCase: true, - snakeCase: true, + ], + + // Import rules + ...importPlugin.configs.recommended.rules, + ...importPlugin.configs.typescript.rules, + "import/order": [ + "error", + { + alphabetize: { + order: "asc", + caseInsensitive: true, + }, + groups: [ + "builtin", + "external", + "internal", + ["parent", "sibling"], + "index", + "object", + "type", + ], + "newlines-between": "always", }, - }, - ], - "unicorn/import-style": [ - "error", - { - styles: { - "node:path": { - named: true, + ], + + // Unicorn rules + ...unicornPlugin.configs.recommended.rules, + "unicorn/filename-case": [ + "error", + { + cases: { + camelCase: true, + snakeCase: true, }, }, - }, - ], - "unicorn/numeric-separators-style": [ - "error", - { - number: { - minimumDigits: 6, - groupLength: 3, + ], + "unicorn/import-style": [ + "error", + { + styles: { + "node:path": { + named: true, + }, + }, }, - }, - ], - // [DU 2024-SEP-10]: Disabled the 'unicorn/prefer-structured-clone' rule, which recommends using 'structuredClone' - // instead of 'JSON.parse(JSON.stringify(...))' (see: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-structured-clone.md). - // This may cause warnings when using 'JSON.parse(JSON.stringify(data))'. The reason for using this approach is unclear, - // but it could potentially lead to issues for other developers. Further review is needed to determine if 'structuredClone' should be used instead. - "unicorn/prefer-structured-clone": "off", - "unicorn/prevent-abbreviations": [ - "error", - { - allowList: { - db: true, - docs: true, - env: true, - err: true, - i: true, - param: true, - req: true, - res: true, + ], + "unicorn/numeric-separators-style": [ + "error", + { + number: { + minimumDigits: 6, + groupLength: 3, + }, + }, + ], + "unicorn/prefer-structured-clone": "off", + "unicorn/prevent-abbreviations": [ + "error", + { + allowList: { + db: true, + docs: true, + env: true, + err: true, + i: true, + param: true, + req: true, + res: true, + utils: true, + }, }, + ], + }, + settings: { + node: { + tryExtensions: [".js", ".json", ".node", ".ts"], + }, + "import/resolver": { + typescript: true, + node: true, }, - ], - }, - settings: { - node: { - tryExtensions: [".js", ".json", ".node", ".ts"], }, }, -}; + { + files: ["**/*.spec.ts"], + // overrides for spec files if any (legacy file had empty overrides for this pattern) + }, + prettierPluginRecommened, +];