From 54e289906a26c5791586ca520104e9756ab15a47 Mon Sep 17 00:00:00 2001 From: kirillgroshkov Date: Mon, 12 Aug 2024 10:32:11 +0200 Subject: [PATCH] feat: vendor/cleanup eslint-config-prettier rules --- cfg/eslint-prettier-rules.js | 110 +++++++++++++ cfg/eslint-rules.js | 4 +- cfg/eslint.config.js | 4 +- package.json | 1 - src/test/cfg/eslint.config.dump.json | 237 --------------------------- yarn.lock | 5 - 6 files changed, 112 insertions(+), 249 deletions(-) create mode 100644 cfg/eslint-prettier-rules.js diff --git a/cfg/eslint-prettier-rules.js b/cfg/eslint-prettier-rules.js new file mode 100644 index 0000000..8e391d8 --- /dev/null +++ b/cfg/eslint-prettier-rules.js @@ -0,0 +1,110 @@ +// These rules are disabled, because prettier handles it +// Copy-pasted from https://github.com/prettier/eslint-config-prettier +module.exports = { + rules: { + // The following rules can be used in some cases. See the README for more + // information. These are marked with `0` instead of `0` so that a + // script can distinguish them. Note that there are a few more of these + // in the deprecated section below. + // "curly": 0, + 'no-unexpected-multiline': 0, + '@typescript-eslint/lines-around-comment': 0, + '@typescript-eslint/quotes': 0, + 'babel/quotes': 0, + 'unicorn/template-indent': 0, + 'vue/html-self-closing': 0, + 'vue/max-len': 0, + + // The rest are rules that you never need to enable when using Prettier. + '@babel/object-curly-spacing': 0, + '@babel/semi': 0, + '@typescript-eslint/block-spacing': 0, + '@typescript-eslint/brace-style': 0, + '@typescript-eslint/comma-dangle': 0, + '@typescript-eslint/comma-spacing': 0, + '@typescript-eslint/func-call-spacing': 0, + '@typescript-eslint/indent': 0, + '@typescript-eslint/key-spacing': 0, + '@typescript-eslint/keyword-spacing': 0, + '@typescript-eslint/member-delimiter-style': 0, + '@typescript-eslint/no-extra-parens': 0, + '@typescript-eslint/no-extra-semi': 0, + '@typescript-eslint/object-curly-spacing': 0, + '@typescript-eslint/semi': 0, + '@typescript-eslint/space-before-blocks': 0, + '@typescript-eslint/space-before-function-paren': 0, + '@typescript-eslint/space-infix-ops': 0, + '@typescript-eslint/type-annotation-spacing': 0, + 'babel/object-curly-spacing': 0, + 'babel/semi': 0, + 'flowtype/boolean-style': 0, + 'flowtype/delimiter-dangle': 0, + 'flowtype/generic-spacing': 0, + 'flowtype/object-type-curly-spacing': 0, + 'flowtype/object-type-delimiter': 0, + 'flowtype/quotes': 0, + 'flowtype/semi': 0, + 'flowtype/space-after-type-colon': 0, + 'flowtype/space-before-generic-bracket': 0, + 'flowtype/space-before-type-colon': 0, + 'flowtype/union-intersection-spacing': 0, + 'react/jsx-child-element-spacing': 0, + 'react/jsx-closing-bracket-location': 0, + 'react/jsx-closing-tag-location': 0, + 'react/jsx-curly-newline': 0, + 'react/jsx-curly-spacing': 0, + 'react/jsx-equals-spacing': 0, + 'react/jsx-first-prop-new-line': 0, + 'react/jsx-indent': 0, + 'react/jsx-indent-props': 0, + 'react/jsx-max-props-per-line': 0, + 'react/jsx-newline': 0, + 'react/jsx-one-expression-per-line': 0, + 'react/jsx-props-no-multi-spaces': 0, + 'react/jsx-tag-spacing': 0, + 'react/jsx-wrap-multilines': 0, + 'standard/array-bracket-even-spacing': 0, + 'standard/computed-property-even-spacing': 0, + 'standard/object-curly-even-spacing': 0, + 'unicorn/empty-brace-spaces': 0, + 'unicorn/no-nested-ternary': 0, + 'unicorn/number-literal-case': 0, + 'vue/array-bracket-newline': 0, + 'vue/array-bracket-spacing': 0, + 'vue/array-element-newline': 0, + 'vue/arrow-spacing': 0, + 'vue/block-spacing': 0, + 'vue/block-tag-newline': 0, + 'vue/brace-style': 0, + 'vue/comma-dangle': 0, + 'vue/comma-spacing': 0, + 'vue/comma-style': 0, + 'vue/dot-location': 0, + 'vue/func-call-spacing': 0, + 'vue/html-closing-bracket-newline': 0, + 'vue/html-closing-bracket-spacing': 0, + 'vue/html-end-tags': 0, + 'vue/html-indent': 0, + 'vue/html-quotes': 0, + 'vue/key-spacing': 0, + 'vue/keyword-spacing': 0, + 'vue/max-attributes-per-line': 0, + 'vue/multiline-html-element-content-newline': 0, + 'vue/multiline-ternary': 0, + 'vue/mustache-interpolation-spacing': 0, + 'vue/no-extra-parens': 0, + 'vue/no-multi-spaces': 0, + 'vue/no-spaces-around-equal-signs-in-attribute': 0, + 'vue/object-curly-newline': 0, + 'vue/object-curly-spacing': 0, + 'vue/object-property-newline': 0, + 'vue/operator-linebreak': 0, + 'vue/quote-props': 0, + 'vue/script-indent': 0, + 'vue/singleline-html-element-content-newline': 0, + 'vue/space-in-parens': 0, + 'vue/space-infix-ops': 0, + 'vue/space-unary-ops': 0, + 'vue/template-curly-spacing': 0, + }, +} diff --git a/cfg/eslint-rules.js b/cfg/eslint-rules.js index 415863e..741bbbc 100644 --- a/cfg/eslint-rules.js +++ b/cfg/eslint-rules.js @@ -153,7 +153,6 @@ module.exports = { }, ], 'constructor-super': 2, - 'eol-last': 2, eqeqeq: [2, 'smart'], 'for-direction': 2, 'getter-return': 2, @@ -232,7 +231,6 @@ module.exports = { 'no-invalid-this': 0, // too many false positives in valid classes 'no-irregular-whitespace': 2, 'no-misleading-character-class': 2, - 'no-mixed-spaces-and-tabs': 2, 'no-new-symbol': 2, 'no-new-wrappers': 2, 'no-obj-calls': 2, @@ -266,6 +264,7 @@ module.exports = { 'rxjs/observable/interval', 'rxjs/observable/forkJoin', ], + curly: [2, 'multi-line'], // this one is an exception that can conflict with prettier 'no-self-assign': 2, 'no-setter-return': 2, 'no-shadow': 0, // it is buggy with TypeScript enums @@ -348,7 +347,6 @@ module.exports = { '@typescript-eslint/prefer-find': 2, 'prefer-promise-reject-errors': 0, '@typescript-eslint/prefer-promise-reject-errors': 2, - 'arrow-parens': [2, 'as-needed'], 'arrow-body-style': 0, 'unicorn/no-array-callback-reference': 0, // false positives 'unicorn/no-process-exit': 0, diff --git a/cfg/eslint.config.js b/cfg/eslint.config.js index 99747a8..9107a7e 100644 --- a/cfg/eslint.config.js +++ b/cfg/eslint.config.js @@ -83,10 +83,8 @@ function getConfig() { ...require('./eslint-rules').rules, ...require('./eslint-vue-rules').rules, ...(hasJest ? require('./eslint-jest-rules').rules : {}), - ...require('eslint-config-prettier').rules, + ...require('./eslint-prettier-rules').rules, ...require('./eslint-biome-rules').rules, // disable eslint rules already covered by biome - // Override prettier-config: - curly: [2, 'multi-line'], }, } } diff --git a/package.json b/package.json index bf36c59..96cb79d 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "@types/node": "^22.0.0", "@types/yargs": "^16.0.0", "eslint": "^9.0.0", - "eslint-config-prettier": "^9.0.0", "eslint-plugin-import-x": "^3.1.0", "eslint-plugin-jest": "^28.0.0", "eslint-plugin-jsdoc": "^50.0.0", diff --git a/src/test/cfg/eslint.config.dump.json b/src/test/cfg/eslint.config.dump.json index b77cb53..f1688df 100644 --- a/src/test/cfg/eslint.config.dump.json +++ b/src/test/cfg/eslint.config.dump.json @@ -549,24 +549,9 @@ "@typescript-eslint/unbound-method": [ 0 ], - "array-bracket-newline": [ - 0 - ], - "array-bracket-spacing": [ - 0 - ], - "array-element-newline": [ - 0 - ], "arrow-body-style": [ 0 ], - "arrow-parens": [ - 0 - ], - "arrow-spacing": [ - 0 - ], "babel/object-curly-spacing": [ 0 ], @@ -576,30 +561,12 @@ "babel/semi": [ 0 ], - "block-spacing": [ - 0 - ], - "brace-style": [ - 0 - ], - "comma-dangle": [ - 0 - ], - "comma-spacing": [ - 0 - ], - "comma-style": [ - 0 - ], "complexity": [ 2, { "max": 40 } ], - "computed-property-spacing": [ - 0 - ], "constructor-super": [ 0 ], @@ -613,15 +580,9 @@ "default-param-last": [ 0 ], - "dot-location": [ - 0 - ], "dot-notation": [ 0 ], - "eol-last": [ - 0 - ], "eqeqeq": [ 0 ], @@ -661,21 +622,6 @@ "for-direction": [ 0 ], - "func-call-spacing": [ - 0 - ], - "function-call-argument-newline": [ - 0 - ], - "function-paren-newline": [ - 0 - ], - "generator-star": [ - 0 - ], - "generator-star-spacing": [ - 0 - ], "getter-return": [ 0 ], @@ -697,9 +643,6 @@ "id-match": [ 2 ], - "implicit-arrow-linebreak": [ - 0 - ], "import-x/export": [ 2 ], @@ -724,12 +667,6 @@ "import-x/no-useless-path-segments": [ 2 ], - "indent": [ - 0 - ], - "indent-legacy": [ - 0 - ], "jest/consistent-test-it": [ 2, { @@ -857,21 +794,6 @@ "jsx-a11y/tabindex-no-positive": [ 0 ], - "jsx-quotes": [ - 0 - ], - "key-spacing": [ - 0 - ], - "keyword-spacing": [ - 0 - ], - "linebreak-style": [ - 0 - ], - "lines-around-comment": [ - 0 - ], "logical-assignment-operators": [ 2, "always", @@ -879,33 +801,15 @@ "enforceForIfStatements": true } ], - "max-len": [ - 0 - ], "max-params": [ 2, { "max": 5 } ], - "max-statements-per-line": [ - 0 - ], - "multiline-ternary": [ - 0 - ], - "new-parens": [ - 0 - ], - "newline-per-chained-call": [ - 0 - ], "no-array-constructor": [ 0 ], - "no-arrow-condition": [ - 0 - ], "no-async-promise-executor": [ 0 ], @@ -924,18 +828,12 @@ "no-class-assign": [ 0 ], - "no-comma-dangle": [ - 0 - ], "no-compare-neg-zero": [ 0 ], "no-cond-assign": [ 0 ], - "no-confusing-arrow": [ - 0 - ], "no-const-assign": [ 0 ], @@ -1008,18 +906,12 @@ "no-extra-label": [ 0 ], - "no-extra-parens": [ - 0 - ], "no-extra-semi": [ 0 ], "no-fallthrough": [ 0 ], - "no-floating-decimal": [ - 0 - ], "no-func-assign": [ 0 ], @@ -1071,18 +963,6 @@ "no-misleading-character-class": [ 0 ], - "no-mixed-operators": [ - 0 - ], - "no-mixed-spaces-and-tabs": [ - 0 - ], - "no-multi-spaces": [ - 0 - ], - "no-multiple-empty-lines": [ - 0 - ], "no-negated-condition": [ 0 ], @@ -1119,9 +999,6 @@ "no-regex-spaces": [ 0 ], - "no-reserved-keys": [ - 0 - ], "no-restricted-imports": [ 2, "rxjs/Rx", @@ -1169,30 +1046,18 @@ "no-shadow-restricted-names": [ 0 ], - "no-space-before-semi": [ - 0 - ], - "no-spaced-func": [ - 0 - ], "no-sparse-array": [ 0 ], "no-sparse-arrays": [ 2 ], - "no-tabs": [ - 0 - ], "no-this-before-super": [ 0 ], "no-throw-literal": [ 0 ], - "no-trailing-spaces": [ - 0 - ], "no-undef": [ 0 ], @@ -1265,42 +1130,15 @@ "no-var": [ 0 ], - "no-whitespace-before-property": [ - 0 - ], "no-with": [ 0 ], - "no-wrap-func": [ - 0 - ], - "nonblock-statement-body-position": [ - 0 - ], - "object-curly-newline": [ - 0 - ], - "object-curly-spacing": [ - 0 - ], - "object-property-newline": [ - 0 - ], "object-shorthand": [ 2 ], "one-var": [ 0 ], - "one-var-declaration-per-line": [ - 0 - ], - "operator-linebreak": [ - 0 - ], - "padded-blocks": [ - 0 - ], "prefer-arrow-callback": [ 0 ], @@ -1328,12 +1166,6 @@ "prefer-template": [ 0 ], - "quote-props": [ - 0 - ], - "quotes": [ - 0 - ], "react-hooks/exhaustive-deps": [ 0 ], @@ -1394,9 +1226,6 @@ "react/jsx-props-no-multi-spaces": [ 0 ], - "react/jsx-space-before-closing": [ - 0 - ], "react/jsx-tag-spacing": [ 0 ], @@ -1424,18 +1253,6 @@ "require-yield": [ 0 ], - "rest-spread-spacing": [ - 0 - ], - "semi": [ - 0 - ], - "semi-spacing": [ - 0 - ], - "semi-style": [ - 0 - ], "simple-import-sort/exports": [ 2 ], @@ -1453,42 +1270,6 @@ ] } ], - "space-after-function-name": [ - 0 - ], - "space-after-keywords": [ - 0 - ], - "space-before-blocks": [ - 0 - ], - "space-before-function-paren": [ - 0 - ], - "space-before-function-parentheses": [ - 0 - ], - "space-before-keywords": [ - 0 - ], - "space-in-brackets": [ - 0 - ], - "space-in-parens": [ - 0 - ], - "space-infix-ops": [ - 0 - ], - "space-return-throw-case": [ - 0 - ], - "space-unary-ops": [ - 0 - ], - "space-unary-word-ops": [ - 0 - ], "spaced-comment": [ 2, "always", @@ -1510,15 +1291,6 @@ "stylistic/jsx-self-closing-comp": [ 0 ], - "switch-colon-spacing": [ - 0 - ], - "template-curly-spacing": [ - 0 - ], - "template-tag-spacing": [ - 0 - ], "unicorn/better-regex": [ 0 ], @@ -2439,15 +2211,6 @@ ], "vue/valid-v-text": [ 2 - ], - "wrap-iife": [ - 0 - ], - "wrap-regex": [ - 0 - ], - "yield-star-spacing": [ - 0 ] } } diff --git a/yarn.lock b/yarn.lock index f01f300..1a19967 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2098,11 +2098,6 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -eslint-config-prettier@^9.0.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f" - integrity sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw== - eslint-import-resolver-node@^0.3.9: version "0.3.9" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz#d4eaac52b8a2e7c3cd1903eb00f7e053356118ac"