diff --git a/README.md b/README.md index a180cf85..ae0f683f 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ npm install --save-dev eslint eslint-plugin-github ## Setup +### Legacy Configuration (`.eslintrc`) + Add `github` to your list of plugins in your ESLint config. JSON ESLint config example: @@ -28,6 +30,31 @@ JSON ESLint config example: } ``` +### Flat Configurations (`eslint-config.js`) + +Import the `eslint-plugin-github`, and extend any of the configurations using `getFlatConfigs()` as needed like so: + +```js +import github from 'eslint-plugin-github' + +export default [ + github.getFlatConfigs().browser, + github.getFlatConfigs().recommended, + github.getFlatConfigs().react, + ...github.getFlatConfigs().typescript, + { + files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'], + ignores: ['eslint.config.mjs'], + rules: { + 'github/array-foreach': 'error', + 'github/async-preventdefault': 'warn', + 'github/no-then': 'error', + 'github/no-blur': 'error', + }, + }, +] +``` + The available configs are: - `internal`