1 | # @berlysia/eslint-config
|
2 |
|
3 | > ESLint config for myself
|
4 |
|
5 | ## Features
|
6 |
|
7 | - React
|
8 | - TypeScript
|
9 | - prettier
|
10 |
|
11 | ## Install
|
12 |
|
13 | ```sh
|
14 | $ yarn add --dev eslint @berlysia/eslint-config
|
15 | ```
|
16 |
|
17 | ```sh
|
18 | $ npm install --save-dev eslint @berlysia/eslint-config
|
19 | ```
|
20 |
|
21 | ## Config
|
22 |
|
23 | in `.eslintrc`
|
24 |
|
25 | ```json
|
26 | {
|
27 | "extends": ["@berlysia/eslint-config/auto"]
|
28 | }
|
29 | ```
|
30 |
|
31 | ### opt-in rules for TypeScript
|
32 |
|
33 | ```json
|
34 | {
|
35 | "extends": [
|
36 | "@berlysia/eslint-config/auto"
|
37 | "@berlysia/eslint-config/typescript-with-type"
|
38 | ],
|
39 | "parserOptions": {
|
40 | "project": "./tsconfig.json"
|
41 | }
|
42 | }
|
43 | ```
|
44 |
|
45 | ## Manual Config
|
46 |
|
47 | in `.eslintrc`
|
48 |
|
49 | ```json
|
50 | {
|
51 | "extends": [
|
52 | "@berlysia" // base
|
53 | ],
|
54 | "overrides": [
|
55 | {
|
56 | "files": [
|
57 | "*.{test,spec}.{js,ts,jsx,tsx}",
|
58 | "**/__tests__/**/*.{js,ts,jsx,tsx}"
|
59 | ],
|
60 | "extends": "@berlysia/eslint-config/jest"
|
61 | },
|
62 | {
|
63 | "files": ["*.{ts,tsx}"],
|
64 | "extends": "@berlysia/eslint-config/typescript-without-type"
|
65 | },
|
66 | {
|
67 | "files": ["*.{ts,tsx}"],
|
68 | "extends": "@berlysia/eslint-config/typescript-with-type",
|
69 | "parserOptions": {
|
70 | "project": "./tsconfig.json"
|
71 | }
|
72 | }
|
73 | ]
|
74 | }
|
75 | ```
|