Skip to content

Commit

Permalink
chore: dprint migration
Browse files Browse the repository at this point in the history
- prettier 3.0 formatting has degraded in quality for js-like files, but the team refuses to fix it
- prettier can be removed completely once dprint has its own yaml plugin + better json5 support
- prettier markdown formatting was always subpar; it never played nicely with markdownlint
- prettier/prettier#15358
- prettier/prettier#5715
- prettier/prettier#11881
- dprint/dprint#736
- dprint/dprint-plugin-typescript#432

Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
  • Loading branch information
unicornware committed Sep 9, 2023
1 parent c7be6f0 commit 7f578c9
Show file tree
Hide file tree
Showing 28 changed files with 522 additions and 1,594 deletions.
2 changes: 2 additions & 0 deletions .dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dequal
dessant
dists
dohm
dprint
emojify
esbuild
evanw
Expand Down Expand Up @@ -40,6 +41,7 @@ onrequest
pathe
pkgs
preid
shfmt
swcrc
toodles
tribonacci
Expand Down
150 changes: 150 additions & 0 deletions .dprint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
{
"$schema": "https://dprint.dev/schemas/v0.json",
"excludes": [
"!**/__fixtures__/**/dist/",
"!**/__fixtures__/**/node_modules/",
"!**/typings/**/dist/",
"**/*.patch",
"**/*.snap",
"**/*config.*.timestamp*",
"**/.temp/",
"**/.vercel/",
"**/__tests__/report.json",
"**/coverage/",
"**/dist/",
"**/node_modules",
"**/tsconfig*temp.json",
".git/",
".husky/_/",
".yarn/",
"CHANGELOG.md",
"LICENSE.md",
"RELEASE_NOTES.md",
"yarn.lock"
],
"exec": {
"commands": [
{
"command": "node ./dprint/prettier.mjs {{file_path}}",
"exts": ["json5", "yaml", "yml"],
"stdin": true
},
{
"command": "node ./dprint/shfmt.mjs {{file_path}}",
"exts": ["sh", "txt", "zsh"],
"fileNames": [
".editorconfig",
".env",
".env.local",
".env.repo",
".eslintcache",
".eslintignore",
".gitattributes",
".gitconfig",
".gitignore",
".markdownlintignore",
".npmrc",
".nvmrc",
"Brewfile",
"commit-msg",
"pre-commit",
"pre-push"
],
"stdin": true
}
]
},
"incremental": true,
"indentWidth": 2,
"json": {
"associations": ["**/*.{jsonc,json}"],
"array.preferSingleLine": false,
"commentLine.forceSpaceAfterSlashes": true,
"ignoreNodeCommentText": "dprint-ignore",
"object.preferSingleLine": false
},
"lineWidth": 80,
"markdown": {
"associations": ["**/*.{md,mdx}"],
"emphasisKind": "asterisks",
"ignoreDirective": "dprint-ignore",
"ignoreEndDirective": "dprint-ignore-end",
"ignoreFileDirective": "dprint-ignore-file",
"ignoreStartDirective": "dprint-ignore-start",
"lineWidth": 120,
"strongKind": "asterisks",
"textWrap": "maintain"
},
"newLineKind": "lf",
"plugins": [
"https://plugins.dprint.dev/typescript-0.87.1.wasm",
"https://plugins.dprint.dev/json-0.17.4.wasm",
"https://plugins.dprint.dev/markdown-0.16.0.wasm",
"https://plugins.dprint.dev/exec-0.4.3.json@42343548b8022c99b1d750be6b894fe6b6c7ee25f72ae9f9082226dd2e515072"
],
"typescript": {
"arrowFunction.useParentheses": "preferNone",
"binaryExpression.linePerExpression": false,
"binaryExpression.operatorPosition": "sameLine",
"binaryExpression.spaceSurroundingBitwiseAndArithmeticOperator": true,
"bracePosition": "sameLine",
"commentLine.forceSpaceAfterSlashes": true,
"constructSignature.spaceAfterNewKeyword": true,
"constructor.spaceBeforeParentheses": false,
"constructorType.spaceAfterNewKeyword": true,
"doWhileStatement.spaceAfterWhileKeyword": true,
"enumDeclaration.memberSpacing": "maintain",
"exportDeclaration.forceMultiLine": false,
"exportDeclaration.forceSingleLine": false,
"exportDeclaration.sortNamedExports": "maintain",
"exportDeclaration.spaceSurroundingNamedExports": true,
"forInStatement.spaceAfterForKeyword": true,
"forOfStatement.spaceAfterForKeyword": true,
"forStatement.spaceAfterForKeyword": true,
"forStatement.spaceAfterSemiColons": true,
"functionDeclaration.spaceBeforeParentheses": false,
"functionExpression.spaceAfterFunctionKeyword": false,
"functionExpression.spaceBeforeParentheses": false,
"getAccessor.spaceBeforeParentheses": false,
"ifStatement.spaceAfterIfKeyword": true,
"ignoreFileCommentText": "dprint-ignore-file",
"ignoreNodeCommentText": "dprint-ignore",
"importDeclaration.forceMultiLine": false,
"importDeclaration.forceSingleLine": false,
"importDeclaration.sortNamedImports": "maintain",
"importDeclaration.spaceSurroundingNamedImports": true,
"jsx.bracketPosition": "nextLine",
"jsx.forceNewLinesSurroundingContent": false,
"jsx.multiLineParens": "always",
"jsx.quoteStyle": "preferSingle",
"jsxExpressionContainer.spaceSurroundingExpression": true,
"jsxSelfClosingElement.spaceBeforeSlash": true,
"memberExpression.linePerExpression": false,
"method.spaceBeforeParentheses": false,
"module.sortExportDeclarations": "caseSensitive",
"module.sortImportDeclarations": "caseSensitive",
"newLineKind": "lf",
"nextControlFlowPosition": "sameLine",
"objectExpression.spaceSurroundingProperties": true,
"objectPattern.spaceSurroundingProperties": true,
"operatorPosition": "nextLine",
"preferHanging": true,
"preferSingleLine": false,
"quoteProps": "asNeeded",
"quoteStyle": "alwaysSingle",
"semiColons": "asi",
"setAccessor.spaceBeforeParentheses": false,
"singleBodyPosition": "sameLine",
"spaceAround": false,
"spaceSurroundingProperties": true,
"taggedTemplate.spaceBeforeLiteral": false,
"trailingCommas": "never",
"typeAnnotation.spaceBeforeColon": false,
"typeAssertion.spaceBeforeExpression": false,
"typeLiteral.separatorKind.singleLine": "semiColon",
"typeLiteral.spaceSurroundingProperties": true,
"useBraces": "maintain",
"whileStatement.spaceAfterWhileKeyword": true
},
"useTabs": false
}
9 changes: 8 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ max_line_length = 120

# shellscript
[*.sh]
binary_next_line = true
function_next_line = false
keep_comments = true
keep_padding = false
max_line_length = 100
shell_variant = 0
space_redirects = false
switch_case_indent = true

# snapshots
[*.snap]
Expand All @@ -43,5 +50,5 @@ max_line_length = 130
max_line_length = 100

# yaml
[*.yml]
[{*.yaml,*.yml}]
max_line_length = 100
5 changes: 2 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
**/*.snap
**/*config.*.timestamp*
**/.DS_Store
**/.temp/
**/__tests__/report.json
**/coverage/
**/.temp/
**/dist/
**/node_modules/
**/tsconfig*temp.json
Expand All @@ -23,10 +23,9 @@ yarn.lock
!.codecov.yml
!.commitlintrc.*
!.cspell.json
!.dprint.*
!.github/
!.graphqlrc.yml
!.lintstagedrc.json
!.markdownlint.jsonc
!.prettierrc.json
!.vscode/
!.yarnrc.yml
23 changes: 6 additions & 17 deletions .eslintrc.base.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const config = {
[require('./tsconfig.build.json').compilerOptions.target]: true,
node: true
},
extends: ['plugin:prettier/recommended'],
extends: [],
overrides: [
{
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
Expand All @@ -56,7 +56,6 @@ const config = {
'import',
'jsdoc',
'node',
'prettier',
'promise',
'unicorn'
],
Expand Down Expand Up @@ -958,14 +957,6 @@ const config = {
'jsonc/no-comments': 0
}
},
{
extends: ['plugin:@graphql-eslint/operations-all'],
files: '**/*.gql',
rules: {
'@graphql-eslint/no-anonymous-operations': 0,
'@graphql-eslint/require-id-when-available': 0
}
},
{
files: ['**/package.json'],
rules: {
Expand Down Expand Up @@ -1070,7 +1061,6 @@ const config = {
parser: 'yaml-eslint-parser',
plugins: ['yml'],
rules: {
'prettier/prettier': 0,
'spaced-comment': 0,
'yml/block-mapping': 2,
'yml/block-mapping-question-indicator-newline': [2, 'never'],
Expand Down Expand Up @@ -1167,14 +1157,15 @@ const config = {
files: [
'.github/dependabot.yml',
'.github/workflows/*.yml',
'action.yml'
'action.yml',
'docker*.yml'
],
rules: {
'yml/sort-keys': 0
}
},
{
files: ['.github/workflows/*.yml', '.yarnrc.yml'],
files: ['.github/workflows/*.yml', '.yarnrc.yml', 'docker*.yml'],
rules: {
'yml/key-name-casing': 0
}
Expand All @@ -1186,11 +1177,9 @@ const config = {
}
}
],
plugins: ['prettier'],
plugins: [],
reportUnusedDisableDirectives: true,
rules: {
'prettier/prettier': [2, {}, { usePrettierrc: true }]
},
rules: {},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.cts', '.mts', '.ts', '.tsx']
Expand Down
16 changes: 0 additions & 16 deletions .github/graphql/queries/linked-issues.gql

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/label-linked-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#pull_request
# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
# - https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions
# - https://docs.github.com/graphql/overview/explorer
# - https://docs.github.com/graphql/reference/objects#pullrequest
# - https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request
# - https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_dispatch
Expand Down
7 changes: 0 additions & 7 deletions .graphqlrc.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"*": ["prettier --check", "cspell lint --color --no-progress --relative $@"],
"**/*.{cjs,cts,gql,js,json,json5,jsonc,md,mjs,mts,ts,yml}": [
"*": ["dprint check", "cspell lint --color --no-progress --relative $@"],
"**/*.{cjs,cts,js,json,json5,jsonc,jsx,md,mdx,mjs,mts,ts,tsx,yaml,yml}": [
"eslint --exit-on-fatal-error"
],
"**/*.{cts,mts,ts}": "vitest typecheck --changed --run",
Expand Down
24 changes: 0 additions & 24 deletions .prettierignore

This file was deleted.

36 changes: 0 additions & 36 deletions .prettierrc.json

This file was deleted.

0 comments on commit 7f578c9

Please sign in to comment.