5
5
[ ![ CI] ( https://github.com/joshwilsonvu/eslint-plugin-solid/actions/workflows/ci.yml/badge.svg )] ( https://github.com/joshwilsonvu/eslint-plugin-solid/actions/workflows/ci.yml )
6
6
![ ESLint peer dependency] ( https://img.shields.io/badge/eslint-6.x--8.x-blue )
7
7
8
- This package contains [ Solid] ( https://www.solidjs.com/ ) -specific linting rules for ESLint.
9
- It can ease Solid's learning curve by finding and fixing problems around Solid's reactivity system,
10
- and can migrate some React patterns to Solid code.
8
+ This package contains [ Solid] ( https://www.solidjs.com/ ) -specific linting rules for ESLint. It can
9
+ ease Solid's learning curve by finding and fixing problems around Solid's reactivity system, and can
10
+ migrate some React patterns to Solid code.
11
11
12
- It's approaching a ` 1.0.0 ` release, and it's well tested and should
13
- be helpful in Solid projects today.
12
+ It's approaching a ` 1.0.0 ` release, and it's well tested and should be helpful in Solid projects
13
+ today.
14
14
15
15
## Installation
16
16
@@ -29,10 +29,25 @@ pnpm eslint --init
29
29
yarn eslint --init
30
30
```
31
31
32
- If you're using VSCode, you'll want to install the [ ESLint extension] ( https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint ) .
33
- If you're using Vite, you may want to install [ vite-plugin-eslint] ( https://github.com/gxmari007/vite-plugin-eslint ) .
32
+ If you're using VSCode, you'll want to install the [ ESLint
33
+ extension] ( https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint ) . You're
34
+ encouraged to enable auto-fixing problems on save by adding the following to your ` settings.json `
35
+ file.
34
36
35
- You may also want to check out [ eslint-plugin-jsx-a11y] ( https://github.com/jsx-eslint/eslint-plugin-jsx-a11y ) , which provides useful rules for keeping HTML accessible.
37
+ ``` json
38
+ {
39
+ "editor.codeActionsOnSave" : {
40
+ "source.fixAll" : true
41
+ }
42
+ }
43
+ ```
44
+
45
+ If you're using Vite, you may want to install
46
+ [ vite-plugin-eslint] ( https://github.com/gxmari007/vite-plugin-eslint ) .
47
+
48
+ You may also want to check out
49
+ [ eslint-plugin-jsx-a11y] ( https://github.com/jsx-eslint/eslint-plugin-jsx-a11y ) , which provides
50
+ useful rules for writing accessible HTML.
36
51
37
52
## Configuration
38
53
@@ -60,10 +75,10 @@ This disables some features that overlap with type checking.
60
75
61
76
### Manual Configuration
62
77
63
- If you don't want to use a preset, you can configure rules individually. Add the ` "solid" `
64
- plugin, enable JSX with the parser options (or use the equivalent options for
65
- ` @typescript-eslint/parser ` or ` @ babel/eslint-parser` ), and configure the rules you
66
- would like to use .
78
+ If you don't want to use a preset, you can configure rules individually. Add the ` "solid" ` plugin,
79
+ enable JSX with the parser options (or use the equivalent options for ` @typescript-eslint/parser ` or
80
+ ` @babel/eslint-parser ` ), and configure the rules you would like to use. Some rules have additional
81
+ options you can set .
67
82
68
83
``` json
69
84
{
@@ -81,11 +96,23 @@ would like to use.
81
96
}
82
97
```
83
98
99
+ ### Disabling Rules
100
+
101
+ The rules in this plugin provide sensible guidelines, but there may be occasions where you * know
102
+ what you're doing* and want to ignore a warning. Just [ add a
103
+ comment] ( https://eslint.org/docs/latest/user-guide/configuring/rules#disabling-rules ) like the
104
+ following:
105
+
106
+ ``` jsx
107
+ // eslint-disable-next-line solid/reactivity
108
+ const [editedValue , setEditedValue ] = createSignal (props .value )
109
+ ```
110
+
84
111
## Rules
85
112
86
113
✔: Enabled in the ` recommended ` configuration.
87
114
88
- 🔧: Fixable with [ ` eslint --fix ` ] ( https://eslint.org/docs/user-guide/command-line-interface#fixing-problems ) .
115
+ 🔧: Fixable with [ ` eslint --fix ` ] ( https://eslint.org/docs/user-guide/command-line-interface#fixing-problems ) /IDE auto-fix .
89
116
90
117
<!-- AUTO-GENERATED-CONTENT:START (RULES) -->
91
118
| ✔ | 🔧 | Rule | Description |
0 commit comments