Skip to content

Commit dc06535

Browse files
docs: add example config with typescript-eslint and Prettier (#2522)
Co-authored-by: Flo Edelmann <[email protected]>
1 parent 618f49c commit dc06535

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

docs/user-guide/index.md

+38
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,44 @@ You can use the following configs by adding them to `eslint.config.js`.
6767
By default, all rules from **base** and **essential** categories report ESLint errors. Other rules - because they're not covering potential bugs in the application - report warnings. What does it mean? By default - nothing, but if you want - you can set up a threshold and break the build after a certain amount of warnings, instead of any. More information [here](https://eslint.org/docs/user-guide/command-line-interface#handling-warnings).
6868
:::
6969

70+
#### Example configuration with [typescript-eslint](https://typescript-eslint.io/) and [Prettier](https://prettier.io/)
71+
72+
```bash
73+
npm install --save-dev eslint eslint-config-prettier eslint-plugin-vue globals typescript-eslint
74+
```
75+
76+
```ts
77+
import eslint from '@eslint/js';
78+
import eslintConfigPrettier from 'eslint-config-prettier';
79+
import eslintPluginVue from 'eslint-plugin-vue';
80+
import globals from 'globals';
81+
import typescriptEslint from 'typescript-eslint';
82+
83+
export default tseslint.config(
84+
{ ignores: ['*.d.ts', '**/coverage', '**/dist'] },
85+
{
86+
extends: [
87+
eslint.configs.recommended,
88+
...typescriptEslint.configs.recommended,
89+
...eslintPluginVue.configs['flat/recommended'],
90+
],
91+
files: ['**/*.{ts,vue}'],
92+
languageOptions: {
93+
ecmaVersion: 'latest',
94+
sourceType: 'module',
95+
globals: globals.browser,
96+
parserOptions: {
97+
parser: typescriptEslint.parser,
98+
},
99+
},
100+
rules: {
101+
// your rules
102+
},
103+
},
104+
eslintConfigPrettier
105+
);
106+
```
107+
70108
### Configuration (`.eslintrc`)
71109

72110
Use `.eslintrc.*` file to configure rules in ESLint < v9. See also: <https://eslint.org/docs/latest/use/configure/>.

0 commit comments

Comments
 (0)