Skip to content

Commit aeeeb14

Browse files
authored
feat: add eslint-plugin-jsx-a11y via jsx.a11y option (#743)
1 parent 2e56cfc commit aeeeb14

File tree

12 files changed

+1295
-15
lines changed

12 files changed

+1295
-15
lines changed

eslint.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export default antfu(
1414
formatters: true,
1515
pnpm: true,
1616
type: 'lib',
17+
jsx: {
18+
a11y: true,
19+
},
1720
},
1821
{
1922
ignores: [

fixtures/eslint.config.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { antfu } from './src'
2+
3+
export default antfu(
4+
{
5+
vue: {
6+
a11y: true,
7+
},
8+
react: true,
9+
solid: true,
10+
svelte: true,
11+
astro: true,
12+
typescript: true,
13+
formatters: true,
14+
pnpm: true,
15+
type: 'lib',
16+
},
17+
{
18+
ignores: [
19+
'fixtures',
20+
'_fixtures',
21+
'**/constants-generated.ts',
22+
],
23+
},
24+
{
25+
files: ['src/**/*.ts'],
26+
rules: {
27+
'perfectionist/sort-objects': 'error',
28+
},
29+
},
30+
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function App() {
2+
return (
3+
<div>
4+
<a href="#">Click here</a>
5+
<a href="javascript:void(0)">Go nowhere</a>
6+
<a href="#content">Jump to content</a>
7+
</div>
8+
);
9+
}
10+
11+
export default App;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
function App() {
2+
return (
3+
<div>
4+
<img src="test.jpg" alt="A decorative element" />
5+
<label htmlFor="name-input">
6+
Enter your name:
7+
<input type="text" id="name-input" />
8+
</label>
9+
<button type="button" onClick={() => console.log('clicked')}>
10+
Click me
11+
</button>
12+
<a href="https://example.com">Visit our website</a>
13+
</div>
14+
);
15+
}
16+
17+
export default App;

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"eslint": "^9.10.0",
5252
"eslint-plugin-astro": "^1.2.0",
5353
"eslint-plugin-format": ">=0.1.0",
54+
"eslint-plugin-jsx-a11y": ">=6.10.2",
5455
"eslint-plugin-react-hooks": "^5.2.0",
5556
"eslint-plugin-react-refresh": "^0.4.19",
5657
"eslint-plugin-solid": "^0.14.3",
@@ -82,6 +83,9 @@
8283
"eslint-plugin-format": {
8384
"optional": true
8485
},
86+
"eslint-plugin-jsx-a11y": {
87+
"optional": true
88+
},
8589
"eslint-plugin-react-hooks": {
8690
"optional": true
8791
},
@@ -152,13 +156,15 @@
152156
"@eslint/config-inspector": "catalog:dev",
153157
"@next/eslint-plugin-next": "catalog:peer",
154158
"@prettier/plugin-xml": "catalog:peer",
159+
"@types/eslint-plugin-jsx-a11y": "catalog:dev",
155160
"@types/node": "catalog:dev",
156161
"@unocss/eslint-plugin": "catalog:peer",
157162
"astro-eslint-parser": "catalog:peer",
158163
"bumpp": "catalog:dev",
159164
"eslint": "catalog:peer",
160165
"eslint-plugin-astro": "catalog:peer",
161166
"eslint-plugin-format": "catalog:peer",
167+
"eslint-plugin-jsx-a11y": "catalog:peer",
162168
"eslint-plugin-react-hooks": "catalog:peer",
163169
"eslint-plugin-react-refresh": "catalog:peer",
164170
"eslint-plugin-solid": "catalog:peer",

0 commit comments

Comments
 (0)