Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/long-woo/eslint-config-typescript-prettier

🔧 一个 TypeScript 的 ESLint 配置,使用 Prettier 格式化代码。Typescript prettier
https://github.com/long-woo/eslint-config-typescript-prettier

eslint eslint-prettier eslint-typescript

Last synced: 7 days ago
JSON representation

🔧 一个 TypeScript 的 ESLint 配置,使用 Prettier 格式化代码。Typescript prettier

Awesome Lists containing this project

README

        

# eslint-config-typescript-prettier

🔧 ESLint configuration for TypeScript, using Prettier to format code.

> If you need to format Vue code, you can use [@loongwoo/eslint-config-vue](https://github.com/long-woo/eslint-config-vue).

## use

1. Install dependencies

```sh
pnpm add -D @loongwoo/eslint-config-typescript-prettier

#or
yarn add -D @loongwoo/eslint-config-typescript-prettier

# or
npm install --save-dev @loongwoo/eslint-config-typescript-prettier
```

2. Configure ESLint

```js
import tsPrettier from '@loongwoo/eslint-config-typescript-prettier';

/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigFile} */
export default [
...tsPrettier,
{
files: ['*.ts', '*.tsx'],
ignores: ['src/vite-env.d.ts'],
},
];
```

3. Open the `package.json` file and add the `eslint` command in the `scripts` configuration.

```json
{
"scripts": {
"lint": "eslint . --fix"
}
}
```