Skip to content

Commit 66d24d1

Browse files
committed
docs: Update README on flat config usage
1 parent 6712e00 commit 66d24d1

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ or
7272

7373
npm i --save-dev eslint-plugin-styled-components-a11y
7474

75-
### Configuration
75+
### Configuration - Legacy Config (`.eslintrc`)
7676

7777
Add styled-components-a11y to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
7878

@@ -100,6 +100,41 @@ Alternatively, you can configure individual rules under the rules section.
100100
}
101101
```
102102

103+
### Configuration - Flat Config
104+
105+
The default export is a plugin object:
106+
107+
```js
108+
import styledA11y from 'eslint-plugin-styled-components-a11y';
109+
110+
export default [
111+
{
112+
plugins: {
113+
'styled-components-a11y': styledA11y,
114+
},
115+
rules: {
116+
'styled-components-a11y/rule-name': 2,
117+
},
118+
},
119+
];
120+
```
121+
122+
#### Shareable Configs
123+
124+
There are two shareable configs provided by the plugin:
125+
126+
- `flatConfigs.recommended`
127+
- `flatConfigs.strict`
128+
129+
```js
130+
import styledA11y from 'eslint-plugin-styled-components-a11y';
131+
132+
export default [
133+
styledA11y.flatConfigs.recommended,
134+
// ... additional configs
135+
];
136+
```
137+
103138
## Examples
104139

105140
a working repo can be found [here](https://github.com/brendanmorrell/styled-components-a11y-example) at brendanmorrell/styled-components-a11y-example which has a file illustrating the linting rules in action for the above four styled component types the library is currently capable of handling

0 commit comments

Comments
 (0)