-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update README.md and documentation
- Update README.md for end user instruction, badges - Add more comments for clarity in src/index.js
- Loading branch information
1 parent
9712308
commit e3ea74e
Showing
5 changed files
with
95 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,73 @@ | ||
# eslint-config-next-flat [![GitHub Actions badge](https://github.com/jeremy-code/eslint-config-next-flat/actions/workflows/ci.yml/badge.svg)](https://github.com/jeremy-code/eslint-config-next-flat/actions/workflows/ci.yml) [![License](https://img.shields.io/github/license/jeremy-code/eslint-config-next-flat)](LICENSE) | ||
# eslint-config-next-flat | ||
|
||
[![GitHub Actions badge][github-actions-badge]][github-actions] | ||
[![License][license-badge]](LICENSE) | ||
[![License][npm-version-badge]][npm-package] | ||
|
||
Flat config port of the Next.js ESLint config [`eslint-config-next`](https://www.npmjs.com/package/eslint-config-next). | ||
|
||
## Installation | ||
|
||
```bash | ||
git clone https://github.com/jeremy-code/eslint-config-next-flat.git | ||
cd eslint-config-next-flat | ||
corepack enable | ||
pnpm install | ||
npm install -D eslint eslint-config-next-flat # npm | ||
yarn add -D eslint eslint-config-next-flat # yarn | ||
pnpm install -D eslint eslint-config-next-flat # pnpm | ||
``` | ||
|
||
## Usage | ||
Create an `eslint.config.js` file in the root of your Next.js project and add the following: | ||
|
||
```bash | ||
# Set Node.js version | ||
nvm use | ||
```js | ||
const js = require("@eslint/js"); | ||
const next = require("eslint-config-next-flat"); | ||
|
||
# Build | ||
pnpm build | ||
/** @type {import('eslint').Linter.FlatConfig}[] */ | ||
module.exports = [ | ||
{ ignore: [".next"] }, // Change if `distDir` in Next.js config is different | ||
js.configs.recommended, | ||
next, | ||
]; | ||
``` | ||
|
||
If not using TypeScript, add custom Next.js Babel parser from `"next/dist/compiled/babel/eslint-parser"`. Otherwise, for TypeScript, use [`typescript-eslint`](https://typescript-eslint.io/getting-started/). | ||
|
||
```js | ||
const js = require("@eslint/js"); | ||
const next = require("eslint-config-next-flat"); | ||
const parser = require("next/dist/compiled/babel/eslint-parser"); | ||
|
||
/** @type {import('eslint').Linter.FlatConfig}[] */ | ||
module.exports = [ | ||
{ ignore: [".next"] }, // Change if `distDir` in Next.js config is different | ||
js.configs.recommended, | ||
next, | ||
{ | ||
files: ["**/*.js", "**/*.mjs"], | ||
languageOptions: { | ||
parser, | ||
parserOptions: { | ||
requireConfigFile: false, | ||
sourceType: "module", | ||
allowImportExportEverywhere: true, | ||
babelOptions: { | ||
presets: ["next/babel"], | ||
caller: { | ||
supportsTopLevelAwait: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; | ||
``` | ||
|
||
## License | ||
|
||
This project is licensed under the [MIT license](LICENSE). | ||
`next-config-next-flat` is licensed under the [MIT license](LICENSE). | ||
|
||
<!-- Badges --> | ||
|
||
[github-actions-badge]: https://github.com/jeremy-code/eslint-config-next-flat/actions/workflows/ci.yml/badge.svg | ||
[github-actions]: https://github.com/jeremy-code/eslint-config-next-flat/actions/workflows/ci.yml | ||
[license-badge]: https://img.shields.io/github/license/jeremy-code/eslint-config-next-flat | ||
[npm-version-badge]: https://img.shields.io/npm/v/eslint-config-next-flat | ||
[npm-package]: https://npmjs.com/package/eslint-config-next-flat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.