From 8eea9afc137d89f057a5e28086d2d2c7f5ae6808 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Tue, 16 Apr 2024 14:17:00 +1200 Subject: [PATCH] fix: more tweaks --- .prettierrc.yml | 1 - .vscode/settings.json | 1 + knip.jsonc | 1 - package.json | 15 +-- pnpm-lock.yaml | 51 --------- src/configs/formatters.ts | 231 +++++++++++++++++++++++++++++++++++--- src/configs/stylistic.ts | 1 + 7 files changed, 221 insertions(+), 80 deletions(-) diff --git a/.prettierrc.yml b/.prettierrc.yml index 27b3a528..6ff2e4e3 100644 --- a/.prettierrc.yml +++ b/.prettierrc.yml @@ -2,7 +2,6 @@ $schema: http://json.schemastore.org/prettierrc plugins: - prettier-plugin-packagejson - - prettier-plugin-multiline-arrays trailingComma: all diff --git a/.vscode/settings.json b/.vscode/settings.json index b362ce4b..416f9900 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "editor.codeActionsOnSave": { + "source.fixAll": "explicit", "source.fixAll.eslint": "explicit" }, "editor.defaultFormatter": "esbenp.prettier-vscode", diff --git a/knip.jsonc b/knip.jsonc index 8f4c1f9d..0321a169 100644 --- a/knip.jsonc +++ b/knip.jsonc @@ -33,7 +33,6 @@ "eslint-plugin-yml", "eslint-processor-vue-blocks", "jsonc-eslint-parser", - "prettier-plugin-multiline-arrays", "prettier-plugin-packagejson", "prettier", "toml-eslint-parser", diff --git a/package.json b/package.json index 702ea8e5..7fd9005f 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,7 @@ "name": "@rebeccastevens/eslint-config", "version": "0.0.0-development", "description": "My ESLint shareable config.", - "keywords": [ - "eslint config" - ], + "keywords": ["eslint config"], "homepage": "https://github.com/RebeccaStevens/eslint-config-rebeccastevens#readme", "bugs": { "url": "https://github.com/RebeccaStevens/eslint-config-rebeccastevens/issues" @@ -27,11 +25,7 @@ "require": "./dist/index.cjs", "import": "./dist/index.mjs" }, - "files": [ - "dist/", - "package.json", - "LICENSE" - ], + "files": ["dist/", "package.json", "LICENSE"], "scripts": { "build": "pnpm run build:node", "build:node": "rimraf dist && pnpm run typegen && rollup -c rollup.config.ts --configPlugin rollup-plugin-ts", @@ -114,7 +108,6 @@ "markdownlint": "0.34.0", "markdownlint-cli": "0.39.0", "prettier": "3.2.5", - "prettier-plugin-multiline-arrays": "3.0.4", "prettier-plugin-packagejson": "2.5.0", "rimraf": "5.0.5", "rollup": "4.14.3", @@ -161,7 +154,6 @@ "eslint-processor-vue-blocks": "*", "jsonc-eslint-parser": "*", "prettier": "*", - "prettier-plugin-multiline-arrays": "*", "prettier-plugin-packagejson": "*", "toml-eslint-parser": "*", "vue-eslint-parser": "*", @@ -261,9 +253,6 @@ "prettier": { "optional": true }, - "prettier-plugin-multiline-arrays": { - "optional": true - }, "prettier-plugin-packagejson": { "optional": true }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 15fd9e8f..4a26b821 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -184,9 +184,6 @@ devDependencies: prettier: specifier: 3.2.5 version: 3.2.5 - prettier-plugin-multiline-arrays: - specifier: 3.0.4 - version: 3.0.4(prettier@3.2.5) prettier-plugin-packagejson: specifier: 2.5.0 version: 2.5.0(prettier@3.2.5) @@ -250,22 +247,6 @@ packages: js-yaml: 4.1.0 dev: true - /@augment-vir/common@23.4.0: - resolution: {integrity: sha512-QIrJ1doD00TNbOzeVrk9KgPTzRlIjayxERnhtbQjK/AFPj5yElcB03GbnGdQZPzws/R+5gfMM5cZiH7QyBP+Kg==} - dependencies: - browser-or-node: 2.1.1 - run-time-assertions: 1.1.0 - type-fest: 4.14.0 - dev: true - - /@augment-vir/common@26.1.0: - resolution: {integrity: sha512-sXZwtDtRQp/us/6Y/Fc5Tl2ZoWrMinlgGinvuDbx0+BNxcMqyH1N8S+tigYYXlqo0xCMHDTbwIYMcbMB7DnD+Q==} - dependencies: - browser-or-node: 2.1.1 - run-time-assertions: 1.1.0 - type-fest: 4.14.0 - dev: true - /@babel/code-frame@7.23.5: resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} engines: {node: '>=6.9.0'} @@ -2546,10 +2527,6 @@ packages: fill-range: 7.0.1 dev: true - /browser-or-node@2.1.1: - resolution: {integrity: sha512-8CVjaLJGuSKMVTxJ2DpBl5XnlNDiT4cQFeuCJJrvJmts9YrTZDizTX7PjC2s6W4x+MBGZeEY6dGMrF04/6Hgqg==} - dev: true - /browserslist-generator@2.1.0: resolution: {integrity: sha512-ZFz4mAOgqm0cbwKaZsfJbYDbTXGoPANlte7qRsRJOfjB9KmmISQrXJxAVrnXG8C8v/QHNzXyeJt0Cfcks6zZvQ==} engines: {node: '>=16.15.1', npm: '>=7.0.0', pnpm: '>=3.2.0', yarn: '>=1.13'} @@ -4216,10 +4193,6 @@ packages: homedir-polyfill: 1.0.3 dev: true - /expect-type@0.15.0: - resolution: {integrity: sha512-yWnriYB4e8G54M5/fAFj7rCIBiKs1HAACaY13kCz6Ku0dezjS9aMcfcdVK2X8Tv2tEV1BPz/wKfQ7WA4S/d8aA==} - dev: true - /external-editor@3.1.0: resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} engines: {node: '>=4'} @@ -6599,16 +6572,6 @@ packages: fast-diff: 1.3.0 dev: true - /prettier-plugin-multiline-arrays@3.0.4(prettier@3.2.5): - resolution: {integrity: sha512-Oj9ZfEisLOF0did1CGXXQLTA0WEChT2pfI06pNA1PbvWqbys9a5xoys6DoZlDL+Uio0uW1XwKZkeKMAkG1EEfQ==} - peerDependencies: - prettier: '>=3.0.0' - dependencies: - '@augment-vir/common': 23.4.0 - prettier: 3.2.5 - proxy-vir: 1.0.0 - dev: true - /prettier-plugin-packagejson@2.5.0(prettier@3.2.5): resolution: {integrity: sha512-6XkH3rpin5QEQodBSVNg+rBo4r91g/1mCaRwS1YGdQJZ6jwqrg2UchBsIG9tpS1yK1kNBvOt84OILsX8uHzBGg==} peerDependencies: @@ -6665,12 +6628,6 @@ packages: resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==} dev: true - /proxy-vir@1.0.0: - resolution: {integrity: sha512-WV1gkBxUOwLSz0Bn09tisIqLK7leAqtFm/474t3L0hQKJw7/gdrkGcWw0/OT1PhSy+TDS6swfq7Niuoq3XJhkQ==} - dependencies: - '@augment-vir/common': 23.4.0 - dev: true - /punycode.js@2.3.1: resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==} engines: {node: '>=6'} @@ -7035,14 +6992,6 @@ packages: queue-microtask: 1.2.3 dev: true - /run-time-assertions@1.1.0: - resolution: {integrity: sha512-PDSUPKzDKF2KB+gv3/0c0M4ppsX4gJouHJHq3Ed1RqWF+wyRBRlRE+lsXfok2mrDtn593J6LgZXbOJH6GSb4QA==} - dependencies: - '@augment-vir/common': 26.1.0 - expect-type: 0.15.0 - type-fest: 4.14.0 - dev: true - /rxjs@7.8.1: resolution: {integrity: sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==} dependencies: diff --git a/src/configs/formatters.ts b/src/configs/formatters.ts index 5f9ea23a..bd6702db 100644 --- a/src/configs/formatters.ts +++ b/src/configs/formatters.ts @@ -77,38 +77,248 @@ export async function formatters( "eslint-plugin-format", "eslint-config-prettier", "prettier", - "prettier-plugin-multiline-arrays", - ])) as [ESLint.Plugin, ESLint.ConfigData]; + "prettier-plugin-packagejson", + ])) as [ESLint.Plugin, ESLint.ConfigData, unknown, unknown]; const turnOffRulesForPrettier = { - ...configPrettier.rules, + ...Object.fromEntries( + Object.entries(configPrettier.rules ?? {}).filter( + ([, value]) => value === "off", + ), + ), "no-irregular-whitespace": "off", + + // From https://github.com/prettier/eslint-config-prettier/pull/272 + "style/array-bracket-newline": "off", + "style/array-bracket-spacing": "off", + "style/array-element-newline": "off", + "style/arrow-parens": "off", + "style/arrow-spacing": "off", "style/block-spacing": "off", "style/brace-style": "off", "style/comma-dangle": "off", "style/comma-spacing": "off", + "style/comma-style": "off", + "style/computed-property-spacing": "off", + "style/dot-location": "off", + "style/eol-last": "off", "style/func-call-spacing": "off", - "style/indent": "off", + "style/function-call-argument-newline": "off", + "style/function-call-spacing": "off", + "style/function-paren-newline": "off", + "style/generator-star-spacing": "off", + "style/implicit-arrow-linebreak": "off", "style/indent-binary-ops": "off", + "style/indent": "off", "style/key-spacing": "off", "style/keyword-spacing": "off", - "style/lines-around-comment": "off", + "style/linebreak-style": "off", + "style/max-statements-per-line": "off", "style/member-delimiter-style": "off", + "style/multiline-ternary": "off", + "style/new-parens": "off", "style/newline-per-chained-call": "off", "style/no-extra-parens": "off", "style/no-extra-semi": "off", + "style/no-floating-decimal": "off", + "style/no-mixed-spaces-and-tabs": "off", + "style/no-multi-spaces": "off", + "style/no-multiple-empty-lines": "off", + "style/no-trailing-spaces": "off", + "style/no-whitespace-before-property": "off", "style/nonblock-statement-body-position": "off", "style/object-curly-newline": "off", "style/object-curly-spacing": "off", + "style/object-property-newline": "off", + "style/one-var-declaration-per-line": "off", "style/operator-linebreak": "off", + "style/padded-blocks": "off", "style/quote-props": "off", - "style/quotes": "off", + "style/rest-spread-spacing": "off", + "style/semi-spacing": "off", + "style/semi-style": "off", "style/semi": "off", "style/space-before-blocks": "off", "style/space-before-function-paren": "off", + "style/space-in-parens": "off", "style/space-infix-ops": "off", + "style/space-unary-ops": "off", + "style/switch-colon-spacing": "off", + "style/template-curly-spacing": "off", + "style/template-tag-spacing": "off", "style/type-annotation-spacing": "off", + "style/type-generic-spacing": "off", + "style/type-named-tuple-spacing": "off", + "style/wrap-iife": "off", + "style/wrap-regex": "off", + "style/yield-star-spacing": "off", + + "style/js/array-bracket-newline": "off", + "style/js/array-bracket-spacing": "off", + "style/js/array-element-newline": "off", + "style/js/arrow-parens": "off", + "style/js/arrow-spacing": "off", + "style/js/block-spacing": "off", + "style/js/brace-style": "off", + "style/js/comma-dangle": "off", + "style/js/comma-spacing": "off", + "style/js/comma-style": "off", + "style/js/computed-property-spacing": "off", + "style/js/dot-location": "off", + "style/js/eol-last": "off", + "style/js/func-call-spacing": "off", + "style/js/function-call-argument-newline": "off", + "style/js/function-call-spacing": "off", + "style/js/function-paren-newline": "off", + "style/js/generator-star-spacing": "off", + "style/js/implicit-arrow-linebreak": "off", + "style/js/indent": "off", + "style/js/jsx-quotes": "off", + "style/js/key-spacing": "off", + "style/js/keyword-spacing": "off", + "style/js/linebreak-style": "off", + "style/js/max-statements-per-line": "off", + "style/js/multiline-ternary": "off", + "style/js/new-parens": "off", + "style/js/newline-per-chained-call": "off", + "style/js/no-extra-parens": "off", + "style/js/no-extra-semi": "off", + "style/js/no-floating-decimal": "off", + "style/js/no-mixed-spaces-and-tabs": "off", + "style/js/no-multi-spaces": "off", + "style/js/no-multiple-empty-lines": "off", + "style/js/no-trailing-spaces": "off", + "style/js/no-whitespace-before-property": "off", + "style/js/nonblock-statement-body-position": "off", + "style/js/object-curly-newline": "off", + "style/js/object-curly-spacing": "off", + "style/js/object-property-newline": "off", + "style/js/one-var-declaration-per-line": "off", + "style/js/operator-linebreak": "off", + "style/js/padded-blocks": "off", + "style/js/quote-props": "off", + "style/js/rest-spread-spacing": "off", + "style/js/semi-spacing": "off", + "style/js/semi-style": "off", + "style/js/semi": "off", + "style/js/space-before-blocks": "off", + "style/js/space-before-function-paren": "off", + "style/js/space-in-parens": "off", + "style/js/space-infix-ops": "off", + "style/js/space-unary-ops": "off", + "style/js/switch-colon-spacing": "off", + "style/js/template-curly-spacing": "off", + "style/js/template-tag-spacing": "off", + "style/js/wrap-iife": "off", + "style/js/wrap-regex": "off", + "style/js/yield-star-spacing": "off", + + "style/jsx-child-element-spacing": "off", + "style/jsx-closing-bracket-location": "off", + "style/jsx-closing-tag-location": "off", + "style/jsx-curly-newline": "off", + "style/jsx-curly-spacing": "off", + "style/jsx-equals-spacing": "off", + "style/jsx-first-prop-new-line": "off", + "style/jsx-indent-props": "off", + "style/jsx-indent": "off", + "style/jsx-max-props-per-line": "off", + "style/jsx-newline": "off", + "style/jsx-one-expression-per-line": "off", + "style/jsx-props-no-multi-spaces": "off", + "style/jsx-quotes": "off", + "style/jsx-tag-spacing": "off", + "style/jsx-wrap-multilines": "off", + "style/jsx/jsx-child-element-spacing": "off", + "style/jsx/jsx-closing-bracket-location": "off", + "style/jsx/jsx-closing-tag-location": "off", + "style/jsx/jsx-curly-newline": "off", + "style/jsx/jsx-curly-spacing": "off", + "style/jsx/jsx-equals-spacing": "off", + "style/jsx/jsx-first-prop-new-line": "off", + "style/jsx/jsx-indent-props": "off", + "style/jsx/jsx-indent": "off", + "style/jsx/jsx-max-props-per-line": "off", + + "style/ts/block-spacing": "off", + "style/ts/brace-style": "off", + "style/ts/comma-dangle": "off", + "style/ts/comma-spacing": "off", + "style/ts/func-call-spacing": "off", + "style/ts/function-call-spacing": "off", + "style/ts/indent": "off", + "style/ts/key-spacing": "off", + "style/ts/keyword-spacing": "off", + "style/ts/member-delimiter-style": "off", + "style/ts/no-extra-parens": "off", + "style/ts/no-extra-semi": "off", + "style/ts/object-curly-spacing": "off", + "style/ts/semi": "off", + "style/ts/space-before-blocks": "off", + "style/ts/space-before-function-paren": "off", + "style/ts/space-infix-ops": "off", + "style/ts/type-annotation-spacing": "off", + + "@typescript-eslint/block-spacing": "off", + "@typescript-eslint/brace-style": "off", + "@typescript-eslint/comma-dangle": "off", + "@typescript-eslint/comma-spacing": "off", + "@typescript-eslint/func-call-spacing": "off", + "@typescript-eslint/indent": "off", + "@typescript-eslint/key-spacing": "off", + "@typescript-eslint/keyword-spacing": "off", + "@typescript-eslint/member-delimiter-style": "off", + "@typescript-eslint/no-extra-parens": "off", + "@typescript-eslint/no-extra-semi": "off", + "@typescript-eslint/object-curly-spacing": "off", + "@typescript-eslint/semi": "off", + "@typescript-eslint/space-before-blocks": "off", + "@typescript-eslint/space-before-function-paren": "off", + "@typescript-eslint/space-infix-ops": "off", + "@typescript-eslint/type-annotation-spacing": "off", + + "unicorn/empty-brace-spaces": "off", + "unicorn/no-nested-ternary": "off", + "unicorn/number-literal-case": "off", + + "vue/array-bracket-newline": "off", + "vue/array-bracket-spacing": "off", + "vue/array-element-newline": "off", + "vue/arrow-spacing": "off", + "vue/block-spacing": "off", + "vue/block-tag-newline": "off", + "vue/brace-style": "off", + "vue/comma-dangle": "off", + "vue/comma-spacing": "off", + "vue/comma-style": "off", + "vue/dot-location": "off", + "vue/func-call-spacing": "off", + "vue/html-closing-bracket-newline": "off", + "vue/html-closing-bracket-spacing": "off", + "vue/html-end-tags": "off", + "vue/html-indent": "off", + "vue/html-quotes": "off", + "vue/key-spacing": "off", + "vue/keyword-spacing": "off", + "vue/max-attributes-per-line": "off", + "vue/multiline-html-element-content-newline": "off", + "vue/multiline-ternary": "off", + "vue/mustache-interpolation-spacing": "off", + "vue/no-extra-parens": "off", + "vue/no-multi-spaces": "off", + "vue/no-spaces-around-equal-signs-in-attribute": "off", + "vue/object-curly-newline": "off", + "vue/object-curly-spacing": "off", + "vue/object-property-newline": "off", + "vue/operator-linebreak": "off", + "vue/quote-props": "off", + "vue/script-indent": "off", + "vue/singleline-html-element-content-newline": "off", + "vue/space-in-parens": "off", + "vue/space-infix-ops": "off", + "vue/space-unary-ops": "off", + "vue/template-curly-spacing": "off", "yaml/block-sequence-hyphen-indicator-newline": "off", } satisfies FlatConfigItem["rules"]; @@ -171,7 +381,6 @@ export async function formatters( { ...prettierOptions, parser: "yaml", - plugins: ["prettier-plugin-multiline-arrays"], }, ], }, @@ -193,7 +402,6 @@ export async function formatters( { ...prettierOptions, parser: "json", - plugins: ["prettier-plugin-multiline-arrays"], }, ], }, @@ -211,7 +419,6 @@ export async function formatters( { ...prettierOptions, parser: "jsonc", - plugins: ["prettier-plugin-multiline-arrays"], }, ], }, @@ -228,7 +435,6 @@ export async function formatters( "error", { ...prettierOptions, - plugins: ["prettier-plugin-multiline-arrays"], parser: "json5", }, ], @@ -247,10 +453,7 @@ export async function formatters( { ...prettierOptions, parser: "json", - plugins: [ - // "prettier-plugin-packagejson", - "prettier-plugin-multiline-arrays", - ], + plugins: ["prettier-plugin-packagejson"], }, ], }, diff --git a/src/configs/stylistic.ts b/src/configs/stylistic.ts index 9e5366e7..f94338df 100644 --- a/src/configs/stylistic.ts +++ b/src/configs/stylistic.ts @@ -96,6 +96,7 @@ export async function stylistic( beforeLineComment: false, afterBlockComment: false, afterLineComment: false, + afterHashbangComment: true, allowBlockStart: true, allowBlockEnd: true, allowObjectStart: true,