Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cSpell.words": [
"neostandard",
"tseslint"
]
}
45 changes: 9 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,26 @@
# Rocketseat ESLint config

## Whats included?

- Standard config base;
- React plugin;
- React Hooks plugin;
- JSX a11y plugin;
- Prettier;

## Setup

### 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"
]
}
```

### React (without Next.js)
### React

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

export default config
```

### Node.js

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

export default config
```
31 changes: 31 additions & 0 deletions base.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// @ts-check

import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
import neostandard, { resolveIgnoresFromGitignore } from 'neostandard'

export default [
eslint.configs.recommended,
...tseslint.configs.recommended,
...neostandard({
ignores: resolveIgnoresFromGitignore(),
}),
{
rules: {
'@stylistic/max-len': ['warn', {
code: 80,
tabWidth: 2,
ignoreUrls: true,
ignoreComments: false,
}],
'@stylistic/space-before-function-paren': ['error',
{
anonymous: 'always',
asyncArrow: 'always',
named: 'never',
},
],
'@stylistic/jsx-quotes': ['error', 'prefer-double'],
},
},
]
Binary file modified bun.lockb
Binary file not shown.
3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import config from './base.mjs'

export default config
56 changes: 0 additions & 56 deletions next.js

This file was deleted.

31 changes: 0 additions & 31 deletions node.js

This file was deleted.

13 changes: 13 additions & 0 deletions node.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import globals from 'globals'
import config from './base.mjs'

export default [
...config,
{
languageOptions: {
globals: {
...globals.node,
},
},
},
]
28 changes: 11 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
{
"name": "@rocketseat/eslint-config",
"version": "2.2.2",
"version": "3.0.7",
"private": false,
"description": "ESLint configuration used by Rocketseat.",
"main": "index.js",
"main": "base.mjs",
"license": "MIT",
"repository": {
"url": "rocketseat/eslint-config-rocketseat"
},
"peerDependencies": {
"eslint": "^8.0.0",
"typescript": ">=5"
"typescript": ">=5",
"eslint": ">=9"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "^3.2.5"
"@eslint/js": "^9.8.0",
"@types/eslint__js": "^8.42.3",
"eslint": "9.8.0",
"eslint-plugin-react-hooks": "canary",
"neostandard": "^0.11.2",
"typescript": "^5.5.4",
"typescript-eslint": "^8.0.1"
}
}
65 changes: 0 additions & 65 deletions react.js

This file was deleted.

22 changes: 22 additions & 0 deletions react.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// @ts-check

import globals from 'globals'
import eslintPluginReactHooks from 'eslint-plugin-react-hooks'
import config from './base.mjs'

export default [
...config,
{
plugins: {
'react-hooks': eslintPluginReactHooks,
},
rules: {
...eslintPluginReactHooks.configs.recommended.rules,
},
languageOptions: {
globals: {
...globals.browser,
},
},
},
]