Skip to content

Commit

Permalink
update code to use prettier plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mckelveygreg committed Sep 30, 2024
1 parent 07225cd commit 308ef78
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -11,4 +12,4 @@

/node_modules
.eslintcache
/.vscode
/.vscode
5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

## Usage

### eslint.config.js

```js
import { baseConfig, reactConfig } from "@20i/eslint-config"
import pluginQuery from "@tanstack/eslint-plugin-query"
Expand Down Expand Up @@ -46,6 +48,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
Expand Down Expand Up @@ -149,6 +170,7 @@ npx mrm eslint --preset @20i/mrm-preset
{
"endOfLine": "auto",
"semi": false,
"trailingComma": "es5"
"trailingComma": "es5",
"plugins": ["prettier-plugin-organize-imports"]
}
```
4 changes: 2 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
Expand Down Expand Up @@ -35,7 +36,7 @@
"react.js",
"react-native.js",
"tsconfig.json",
".prettierrc",
"prettier.config.js",
"*.d.ts"
],
"packageManager": "[email protected]",
Expand Down
5 changes: 5 additions & 0 deletions prettier.config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { Config } from "prettier"

declare const config: Config

export default config
12 changes: 12 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions react-native.js
Original file line number Diff line number Diff line change
@@ -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()

Expand Down
4 changes: 2 additions & 2 deletions react.js
Original file line number Diff line number Diff line change
@@ -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()
Expand Down

0 comments on commit 308ef78

Please sign in to comment.