diff --git a/cfg/eslint-rules.js b/cfg/eslint-rules.js index 161c6ae..dc6bc0c 100644 --- a/cfg/eslint-rules.js +++ b/cfg/eslint-rules.js @@ -466,5 +466,13 @@ module.exports = { '@typescript-eslint/dot-notation': 0, // not always desireable '@typescript-eslint/consistent-indexed-object-style': 0, // Record looses the name of the key '@typescript-eslint/no-unsafe-enum-comparison': 0, // not practically helpful + // stylistic + '@stylistic/padding-line-between-statements': [ + 2, + { blankLine: 'always', prev: 'function', next: '*' }, + { blankLine: 'always', prev: '*', next: 'function' }, + { blankLine: 'always', prev: 'class', next: '*' }, + { blankLine: 'always', prev: '*', next: 'class' }, + ], }, } diff --git a/cfg/eslint.config.js b/cfg/eslint.config.js index 3d9a757..a574b54 100644 --- a/cfg/eslint.config.js +++ b/cfg/eslint.config.js @@ -57,6 +57,7 @@ function getConfig() { // 'unused-imports': require('eslint-plugin-unused-imports'), // disabled in favor of biome rules 'simple-import-sort': require('eslint-plugin-simple-import-sort'), jsdoc: require('eslint-plugin-jsdoc'), + '@stylistic': require('@stylistic/eslint-plugin'), ...(hasJest ? { jest: require('eslint-plugin-jest') } : {}), }, languageOptions: { diff --git a/package.json b/package.json index 6edb78b..2453d64 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@naturalcycles/cli": "^1.0.0", "@naturalcycles/js-lib": "^14.0.0", "@naturalcycles/nodejs-lib": "^13.0.1", + "@stylistic/eslint-plugin": "^2.9.0", "@types/jest": "^29.0.0", "@types/node": "^22.0.0", "@types/yargs": "^16.0.0", diff --git a/src/test/cfg/eslint.config.dump.json b/src/test/cfg/eslint.config.dump.json index 47e0775..a9a8a14 100644 --- a/src/test/cfg/eslint.config.dump.json +++ b/src/test/cfg/eslint.config.dump.json @@ -24,6 +24,7 @@ "import-x", "simple-import-sort:eslint-plugin-simple-import-sort@12.1.1", "jsdoc", + "@stylistic", "jest:eslint-plugin-jest@28.8.3" ], "processor": "vue/vue", @@ -34,6 +35,29 @@ "@babel/semi": [ 0 ], + "@stylistic/padding-line-between-statements": [ + 2, + { + "blankLine": "always", + "next": "*", + "prev": "function" + }, + { + "blankLine": "always", + "next": "function", + "prev": "*" + }, + { + "blankLine": "always", + "next": "*", + "prev": "class" + }, + { + "blankLine": "always", + "next": "class", + "prev": "*" + } + ], "@typescript-eslint/adjacent-overload-signatures": [ 2 ], diff --git a/yarn.lock b/yarn.lock index 61cf2d3..3aede28 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1119,6 +1119,17 @@ dependencies: "@sinonjs/commons" "^3.0.0" +"@stylistic/eslint-plugin@^2.9.0": + version "2.9.0" + resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin/-/eslint-plugin-2.9.0.tgz#5ab3326303915e020ddaf39154290e2800a84bcd" + integrity sha512-OrDyFAYjBT61122MIY1a3SfEgy3YCMgt2vL4eoPmvTwDBwyQhAXurxNQznlRD/jESNfYWfID8Ej+31LljvF7Xg== + dependencies: + "@typescript-eslint/utils" "^8.8.0" + eslint-visitor-keys "^4.1.0" + espree "^10.2.0" + estraverse "^5.3.0" + picomatch "^4.0.2" + "@tsconfig/node10@^1.0.7": version "1.0.11" resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.11.tgz#6ee46400685f130e278128c7b38b7e031ff5b2f2" @@ -1349,7 +1360,7 @@ semver "^7.6.0" ts-api-utils "^1.3.0" -"@typescript-eslint/utils@8.11.0", "@typescript-eslint/utils@^6.0.0 || ^7.0.0 || ^8.0.0", "@typescript-eslint/utils@^8.1.0": +"@typescript-eslint/utils@8.11.0", "@typescript-eslint/utils@^6.0.0 || ^7.0.0 || ^8.0.0", "@typescript-eslint/utils@^8.1.0", "@typescript-eslint/utils@^8.8.0": version "8.11.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.11.0.tgz#4480d1e9f2bb18ea3510c79f870a1aefc118103d" integrity sha512-CYiX6WZcbXNJV7UNB4PLDIBtSdRmRI/nb0FMyqHPTQD1rMjA0foPLaPUV39C/MxkTd/QKSeX+Gb34PPsDVC35g== @@ -2281,7 +2292,7 @@ esrecurse@^4.3.0: dependencies: estraverse "^5.2.0" -estraverse@^5.1.0, estraverse@^5.2.0: +estraverse@^5.1.0, estraverse@^5.2.0, estraverse@^5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== @@ -3957,6 +3968,11 @@ picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== +picomatch@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab" + integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg== + pidtree@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.6.0.tgz#90ad7b6d42d5841e69e0a2419ef38f8883aa057c"