diff --git a/.gitignore b/.gitignore index cefa84b..6652d42 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ !/.yarn/plugins !/.yarn/releases !/.yarn/sdks +!/.yarn/versions # Swap the comments on the following lines if you don't wish to use zero-installs # Documentation here: https://yarnpkg.com/features/zero-installs @@ -11,4 +12,4 @@ /node_modules .eslintcache -/.vscode \ No newline at end of file +/.vscode diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 68c61be..0000000 --- a/.prettierrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "endOfLine": "auto", - "semi": false, - "trailingComma": "es5" -} diff --git a/README.md b/README.md index 439f2e1..a9f33ec 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ ## Usage +### eslint.config.js + ```js import baseConfig from "@20i/eslint-config" import reactConfig from "@20i/eslint-config/react" @@ -47,6 +49,25 @@ export default tsEslint.config( ) ``` +### prettier.config.js + +We can share prettier configs now! 🎉 + +```js +import sharedConfig from "@20i/eslint-config/prettier.config" +/** + * @see https://prettier.io/docs/en/configuration.html + * @type {import("prettier").Config} + */ +const config = { + ...sharedConfig, + // override any shared config here + arrowParens: "avoid", +} + +export default config +``` + ## Configure VS Code [1]: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint @@ -150,6 +171,7 @@ npx mrm eslint --preset @20i/mrm-preset { "endOfLine": "auto", "semi": false, - "trailingComma": "es5" + "trailingComma": "es5", + "plugins": ["prettier-plugin-organize-imports"] } ``` diff --git a/eslint.config.js b/eslint.config.js index 33a7cd5..4c7bd97 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,9 +1,9 @@ // @ts-check -import globals from "globals" import eslint from "@eslint/js" -import tsEslint from "typescript-eslint" import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended" +import globals from "globals" +import tsEslint from "typescript-eslint" export default tsEslint.config( eslint.configs.recommended, diff --git a/package.json b/package.json index d8460d5..36b99e7 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,13 @@ { "name": "@20i/eslint-config", - "version": "4.0.0-rc.1", + "version": "4.0.0", "description": "ESLint and Prettier Config for Twenty Ideas", "main": "index.js", "exports": { "./react": "./react.js", "./react-native": "./react-native.js", - ".": "./index.js" + ".": "./index.js", + "./prettier.config": "./prettier.config.js" }, "type": "module", "author": "Greg McKelvey ", @@ -35,7 +36,7 @@ "react.js", "react-native.js", "tsconfig.json", - ".prettierrc", + "prettier.config.js", "*.d.ts" ], "packageManager": "yarn@4.4.1", diff --git a/prettier.config.d.ts b/prettier.config.d.ts new file mode 100644 index 0000000..8a6b9f7 --- /dev/null +++ b/prettier.config.d.ts @@ -0,0 +1,5 @@ +import type { Config } from "prettier" + +declare const config: Config + +export default config diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 0000000..461beaf --- /dev/null +++ b/prettier.config.js @@ -0,0 +1,12 @@ +/** + * @see https://prettier.io/docs/en/configuration.html + * @type {import("prettier").Config} + */ +const config = { + endOfLine: "auto", + semi: false, + trailingComma: "es5", + plugins: ["prettier-plugin-organize-imports"], +} + +export default config diff --git a/react-native.js b/react-native.js index 4607f6a..cd37aa1 100644 --- a/react-native.js +++ b/react-native.js @@ -1,8 +1,8 @@ +import { FlatCompat } from "@eslint/eslintrc" import reactConfig from "eslint-plugin-react" +import reactNative from "eslint-plugin-react-native" import globals from "globals" -import { FlatCompat } from "@eslint/eslintrc" import tsEslint from "typescript-eslint" -import reactNative from "eslint-plugin-react-native" const compat = new FlatCompat() diff --git a/react.js b/react.js index e0d9cc2..3c17709 100644 --- a/react.js +++ b/react.js @@ -1,7 +1,7 @@ -import reactConfig from "eslint-plugin-react" +import { FlatCompat } from "@eslint/eslintrc" import jsxA11y from "eslint-plugin-jsx-a11y" +import reactConfig from "eslint-plugin-react" import globals from "globals" -import { FlatCompat } from "@eslint/eslintrc" import tsEslint from "typescript-eslint" const compat = new FlatCompat() diff --git a/yarn.lock b/yarn.lock index 7505041..2fe7c13 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2584,19 +2584,16 @@ __metadata: linkType: hard "prettier-plugin-organize-imports@npm:^4.0.0": - version: 4.0.0 - resolution: "prettier-plugin-organize-imports@npm:4.0.0" + version: 4.1.0 + resolution: "prettier-plugin-organize-imports@npm:4.1.0" peerDependencies: - "@vue/language-plugin-pug": ^2.0.24 prettier: ">=2.0" typescript: ">=2.9" - vue-tsc: ^2.0.24 + vue-tsc: ^2.1.0 peerDependenciesMeta: - "@vue/language-plugin-pug": - optional: true vue-tsc: optional: true - checksum: 10/444bc34858ddadd9e4c9afa5f45ee80786d539a28f3535af7e341e885eb569b465fc7b27b2738a69cb99cc530c6e15367514a7b97ed52dea8161307d7d55b3ac + checksum: 10/8223af6d42d06f6a5140a2724a6c6c2cef4a2e149721ceb25b945af71f4de7499bc63e47ea003b9eee84e6b94728b59d91b4275d3c53b718a747e273fb30cee2 languageName: node linkType: hard