From 7893d7981017869cd6ee559904946889acbfee86 Mon Sep 17 00:00:00 2001 From: jyc.dev Date: Fri, 11 Apr 2025 18:20:41 +0000 Subject: [PATCH] [BREAKING] switch .prettierrc.mjs to .prettierrc.js (fix #966) (#969) --- .prettierrc.js | 23 +++++++++++++++++++++++ .prettierrc.mjs | 23 ----------------------- .changeset/all-sheep-wear.md | 5 +++++ packages/eslint-config/.prettierrc.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ packages/eslint-config/.prettierrc.mjs | 48 ------------------------------------------------ packages/eslint-config/cmd.js | 4 ++-- packages/eslint-config/package.json | 2 +- docs/src/content/docs/docs/tools/08_eslint-config.mdx | 4 ++-- 8 file(s) changed, 81 insertion(s)(+), 76 deletion(s)(-) diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,23 @@ +import { kitql } from './packages/eslint-config/.prettierrc.js' + +export default { + ...kitql(), + // Some custom things? +} + +// The astro config was: (if needed at some point!) +// { +// "plugins": ["prettier-plugin-astro"], +// "overrides": [ +// { +// "files": "*.astro", +// "options": { +// "parser": "astro" +// } +// } +// ], +// "semi": false, +// "singleQuote": true, +// "tabWidth": 2, +// "printWidth": 100 +// } diff --git a/.prettierrc.mjs b/.prettierrc.mjs deleted file mode 100644 --- a/.prettierrc.mjs +++ /dev/null @@ -1,23 +0,0 @@ -import { kitql } from './packages/eslint-config/.prettierrc.mjs' - -export default { - ...kitql(), - // Some custom things? -} - -// The astro config was: (if needed at some point!) -// { -// "plugins": ["prettier-plugin-astro"], -// "overrides": [ -// { -// "files": "*.astro", -// "options": { -// "parser": "astro" -// } -// } -// ], -// "semi": false, -// "singleQuote": true, -// "tabWidth": 2, -// "printWidth": 100 -// } diff --git a/.changeset/all-sheep-wear.md b/.changeset/all-sheep-wear.md new file mode 100644 --- /dev/null +++ b/.changeset/all-sheep-wear.md @@ -0,0 +1,5 @@ +--- +'@kitql/eslint-config': minor +--- + +[BREAKING] switch .prettierrc.mjs to .prettierrc.js diff --git a/packages/eslint-config/.prettierrc.js b/packages/eslint-config/.prettierrc.js new file mode 100644 --- /dev/null +++ b/packages/eslint-config/.prettierrc.js @@ -0,0 +1,48 @@ +import prettierConfig from '@theguild/prettier-config' + +const config = { + ...prettierConfig, + tabWidth: 1, + useTabs: true, + singleQuote: true, + semi: false, + arrowParens: 'always', + plugins: [ + ...prettierConfig.plugins, + 'prettier-plugin-svelte', + 'prettier-plugin-tailwindcss', // MUST come last + ], + importOrderParserPlugins: ['typescript', 'decorators-legacy'], + importOrder: [ + '', + '', + '^(\\$houdini)(.*)$', // special + '^(remult)(.*)$', // special + '^(firstly)(.*)$', // special + '^(firstly/)(.*)$', // special + '^(@kitql)(.*)$', // special + '', + '^(\\$env)(.*)$', // special sveltekit + '^(\\$app)(.*)$', // special sveltekit + '', + '^(\\$server)(.*)$', // special firstly + '^(\\$modules)(.*)$', // special firstly + '^(\\$)(.*)$', // Aliases + '', + '^[./]', // inside + ], + overrides: [ + { + files: ['README.md', 'packages/**/README.md'], + options: { + useTabs: false, + tabWidth: 2, + }, + }, + ], +} +export default config + +export const kitql = () => { + return config +} diff --git a/packages/eslint-config/.prettierrc.mjs b/packages/eslint-config/.prettierrc.mjs deleted file mode 100644 --- a/packages/eslint-config/.prettierrc.mjs +++ /dev/null @@ -1,48 +0,0 @@ -import prettierConfig from '@theguild/prettier-config' - -const config = { - ...prettierConfig, - tabWidth: 1, - useTabs: true, - singleQuote: true, - semi: false, - arrowParens: 'always', - plugins: [ - ...prettierConfig.plugins, - 'prettier-plugin-svelte', - 'prettier-plugin-tailwindcss', // MUST come last - ], - importOrderParserPlugins: ['typescript', 'decorators-legacy'], - importOrder: [ - '', - '', - '^(\\$houdini)(.*)$', // special - '^(remult)(.*)$', // special - '^(firstly)(.*)$', // special - '^(firstly/)(.*)$', // special - '^(@kitql)(.*)$', // special - '', - '^(\\$env)(.*)$', // special sveltekit - '^(\\$app)(.*)$', // special sveltekit - '', - '^(\\$server)(.*)$', // special firstly - '^(\\$modules)(.*)$', // special firstly - '^(\\$)(.*)$', // Aliases - '', - '^[./]', // inside - ], - overrides: [ - { - files: ['README.md', 'packages/**/README.md'], - options: { - useTabs: false, - tabWidth: 2, - }, - }, - ], -} -export default config - -export const kitql = () => { - return config -} diff --git a/packages/eslint-config/cmd.js b/packages/eslint-config/cmd.js --- a/packages/eslint-config/cmd.js +++ b/packages/eslint-config/cmd.js @@ -40,7 +40,7 @@ const options_cli = program.opts() const pathPrettierIgnore = findFileOrUp('.prettierignore') -const pathPrettierMjs = findFileOrUp('.prettierrc.mjs') +const pathPrettier_js = findFileOrUp('.prettierrc.js') const format = options_cli.format ?? false let glob = options_cli.glob ?? '.' @@ -294,7 +294,7 @@ // ignore? ` --ignore-path ${pathPrettierIgnore}` + // config - ` --config ${pathPrettierMjs}` + + ` --config ${pathPrettier_js}` + // format or not `${format ? ' --write' : ''}` + // exec diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -17,7 +17,7 @@ }, "main": "eslint.config.js", "files": [ - ".prettierrc.mjs", + ".prettierrc.js", "cmd.js", "eslint.config.js", "helper/findFileOrUp.js" diff --git a/docs/src/content/docs/docs/tools/08_eslint-config.mdx b/docs/src/content/docs/docs/tools/08_eslint-config.mdx --- a/docs/src/content/docs/docs/tools/08_eslint-config.mdx +++ b/docs/src/content/docs/docs/tools/08_eslint-config.mdx @@ -56,8 +56,8 @@ ### prettier config ```js -// .prettierrc.mjs -import { kitql } from '@kitql/eslint-config/.prettierrc.mjs' +// .prettierrc.js +import { kitql } from '@kitql/eslint-config/.prettierrc.js' export default { ...kitql(), -- tangled.sh