Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/eslint-config #6

Closed
wants to merge 2 commits into from
Closed
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
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./packages/eslint-config/lib/node"
}
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
],
"scripts": {
"postinstall": "lerna bootstrap",
"lint": "eslint .",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"lerna": "^3.22.1"
"@typescript-eslint/eslint-plugin": "^4.21.0",
"eslint": "^7.24.0",
"lerna": "^3.22.1",
"prettier": "^2.2.1",
"typescript": "^4.2.4"
}
}
1 change: 1 addition & 0 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./lib/defaults')
13 changes: 13 additions & 0 deletions packages/eslint-config/lib/defaults.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
}
5 changes: 5 additions & 0 deletions packages/eslint-config/lib/node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
env: {
node: true,
},
}
14 changes: 14 additions & 0 deletions packages/eslint-config/lib/react.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
root: true,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
extends: [
'defaults',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'prettier',
],
}
35 changes: 35 additions & 0 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@plutotcool/eslint-config",
"version": "1.0.0",
"description": "Base eslint configuration for plutot.cool projects.",
"main": "index.js",
"repository": "plutotcool/configurations",
"homepage": "https://github.com/plutotcool/configurations/tree/main/packages/eslint-config#readme",
"license": "MIT",
"author": "Bastien Robert <bastien@plutot.cool>",
"contributors": [
"Julien Dargelos <julien@plutot.cool>"
],
"publishConfig": {
"access": "public"
},
"keywords": [
"eslint",
"plutotcool"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": ">= 4.21.0",
"eslint": ">= 7",
"eslint-plugin-react": ">= 7.23.0",
"eslint-plugin-react-hooks": ">= 4.2.0",
"prettier": ">= 2",
"typescript": ">= 4"
},
"dependencies": {
"@typescript-eslint/parser": "^4.21.0",
"eslint-config-prettier": "^8.1.0"
}
}
65 changes: 65 additions & 0 deletions packages/eslint-config/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# ESlint configuration

> Base eslint configuration for plutot.cool projects.

## Installation

```bash
yarn add -D eslint @plutotcool/eslint-config
```

Don't forget to install the `peerDependencies` according to the [configuration you want to install](#Configurations).

In `.eslintrc`

```json
{
"extends": "@plutotcool/eslint-config"
}
```

In `package.json`

```json
{
"scripts": {
"lint": "eslint . --ext .ts,.tsx"
}
}
```

## Configurations

| name | description |
| --------------------------------------------------------------------------- | -------------------------------------- |
| [@plutotcool/eslint-config](#@plutotcool/eslint-config) | Basic ESlint configuration. |
| [@plutotcool/eslint-config/lib/node](#@plutotcool/eslint-config/lib/node) | Basic ESlint configuration for NodeJS. |
| [@plutotcool/eslint-config/lib/react](#@plutotcool/eslint-config/lib/react) | Basic ESlint configuration for React. |

### @plutotcool/eslint-config

Basic ESlint configuration.

**Dependencies**:

- @typescript-eslint/eslint-plugin
- prettier
- typescript

### @plutotcool/eslint-config/lib/node

Basic ESlint configuration for NodeJS.

**Dependencies**:

- **[default dependencies](#@plutotcool/eslint-config)**

### @plutotcool/eslint-config/lib/react

Basic ESlint configuration for React.

**Dependencies**:

- **[default dependencies](#@plutotcool/eslint-config)**
- eslint-plugin-react
- eslint-plugin-react-hooks
Loading