Skip to content

Commit

Permalink
feat: Add Next.js version
Browse files Browse the repository at this point in the history
  • Loading branch information
diego3g committed Jul 17, 2023
1 parent bc4672e commit 8cf3f4d
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 6 deletions.
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,44 @@

## Setup

1. Install the dependencies
### React (with Next.js)

Install dependencies:
```
npm i -D eslint @rocketseat/eslint-config
```
Inside `.eslintrc.json`
```
{
"extends": [
"@rocketseat/eslint-config/next",
"next/core-web-vitals"
]
}
```

2. Create a `.eslintrc.json` file extending the config:
### React (without Next.js)

Install dependencies:
```
npm i -D eslint @rocketseat/eslint-config
```
Inside `.eslintrc.json`
```
{
"extends": "@rocketseat/eslint-config/react"
// "extends": "@rocketseat/eslint-config/node"
}
```

> You can also use a `.eslintrc.js` instead of JSON if you prefer.
### Node.js

Install dependencies:
```
npm i -D eslint @rocketseat/eslint-config
```
Inside `.eslintrc.json`
```
{
"extends": "@rocketseat/eslint-config/node"
}
```
55 changes: 55 additions & 0 deletions next.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
module.exports = {
env: {
browser: true,
es2021: true,
jest: true,
},
extends: [
'standard',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 'latest',
sourceType: 'module'
},
plugins: [
'jsx-a11y',
'@typescript-eslint'
],
rules: {
'prettier/prettier': ["error", {
'printWidth': 80,
'tabWidth': 2,
'singleQuote': true,
'trailingComma': 'all',
'arrowParens': 'always',
'semi': false,
'endOfLine': 'auto',
}],
'jsx-a11y/alt-text': [
'warn',
{
elements: ['img'],
img: ['Image'],
},
],
'jsx-a11y/aria-props': 'warn',
'jsx-a11y/aria-proptypes': 'warn',
'jsx-a11y/aria-unsupported-elements': 'warn',
'jsx-a11y/role-has-required-aria-props': 'warn',
'jsx-a11y/role-supports-aria-props': 'warn',
},
settings: {
react: {
version: 'detect',
},
'import/parsers': {
[require.resolve('@typescript-eslint/parser')]: ['.ts', '.tsx', '.d.ts'],
},
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rocketseat/eslint-config",
"version": "2.0.0",
"version": "2.1.0",
"private": false,
"description": "ESLint configuration used by Rocketseat.",
"main": "index.js",
Expand All @@ -17,7 +17,7 @@
"optional": true
}
},
"devDependencies": {
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.25.0",
"@typescript-eslint/parser": "^5.25.0",
"eslint": "^8.0.0",
Expand Down

0 comments on commit 8cf3f4d

Please sign in to comment.