Skip to content

Commit

Permalink
Add React Hooks plugin. Remove Lodash and no-loops plugins.
Browse files Browse the repository at this point in the history
  • Loading branch information
iansu committed May 7, 2019
1 parent 9f63150 commit b487281
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 58 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ You can also install a specific version of the package by appending the version
### Install Peer Dependencies

```sh
yarn add --dev eslint lint-staged husky typescript
yarn add --dev --exact prettier@1.16.4
yarn add --dev eslint prettier lint-staged husky typescript
```

*It is recommended that you install an exact version of Prettier as they may introduce formatting changes in minor versions.*

### Make ESLint Config File

Add `.eslintrc` to project root
Expand Down Expand Up @@ -76,7 +73,7 @@ Add the engines field to `package.json`

```json
"engines": {
"node": ">=10.0.0"
"node": "^10.0.0"
}
```

Expand All @@ -86,7 +83,6 @@ Add scripts for linting and formatting to `package.json`

```json
"scripts": {
"precommit": "lint-staged",
"lint": "eslint .",
"format": "prettier --write \"**/*.{ts,tsx,js,json,graphql,md}\"",
"format:check": "prettier --debug-check \"**/*.{ts,tsx,js,json,graphql,md}\""
Expand All @@ -98,6 +94,11 @@ Add scripts for linting and formatting to `package.json`
Add a precommit hook to `package.json` to automatically lint and format any files staged for commit

```json
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"concurrent": false,
"linters": {
Expand Down
17 changes: 3 additions & 14 deletions config-backend.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
module.exports = {
extends: ['eslint-config-neo', 'plugin:node/recommended'],
plugins: ['node'],
extends: ['eslint-config-neo'],
env: {
node: true,
jest: true,
mongo: true
},
rules: {
'no-process-exit': 'off',

'unicorn/no-process-exit': 'off',

'node/exports-style': 'error',
'node/no-unpublished-require': 'warn',
'node/no-unsupported-features/es-syntax': [
'warn',
{
ignores: ['modules']
}
]
'node/no-unpublished-require': 'warn'
}
};
21 changes: 7 additions & 14 deletions config-frontend.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
module.exports = {
extends: ['eslint-config-neo', 'plugin:node/recommended', 'plugin:react/recommended'],
plugins: ['node', 'react'],
plugins: ['node', 'react', 'react-hooks'],
env: {
browser: true
browser: true,
jest: true
},
settings: {
react: {
version: 'detect'
}
},
rules: {
'no-process-exit': 'off',

'unicorn/no-process-exit': 'off',

'node/exports-style': 'error',
'node/no-unpublished-require': 'off',
'node/no-unsupported-features/es-syntax': [
'warn',
{
ignores: ['modules']
}
],

'react/prop-types': 'off'
'react/prop-types': 'off',

'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn'
}
};
21 changes: 13 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:node/recommended',
'plugin:jest/recommended',
'plugin:unicorn/recommended',
'plugin:promise/recommended',
'plugin:lodash/recommended',
'prettier',
'prettier/@typescript-eslint'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'jest', 'unicorn', 'promise', 'lodash', 'no-loops'],
plugins: ['@typescript-eslint', 'node', 'jest', 'unicorn', 'promise'],
env: {
es6: true,
jest: true
Expand All @@ -32,6 +32,7 @@ module.exports = {
'no-mixed-requires': 'error',
'no-new-require': 'error',
'no-param-reassign': 'error',
'no-process-exit': 'off',
'no-return-await': 'error',
'no-throw-literal': 'error',
'no-undef-init': 'error',
Expand All @@ -45,13 +46,17 @@ module.exports = {

'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_+' }],

'unicorn/no-abusive-eslint-disable': 'off',
'unicorn/prevent-abbreviations': 'off',

'lodash/prefer-constant': 'off',
'lodash/prefer-lodash-method': 'off',
'node/exports-style': 'error',
'node/no-unsupported-features/es-syntax': [
'warn',
{
ignores: ['modules']
}
],

'no-loops/no-loops': 'warn'
'unicorn/no-abusive-eslint-disable': 'off',
'unicorn/no-process-exit': 'off',
'unicorn/prevent-abbreviations': 'off'
},
overrides: [
{
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-neo",
"version": "0.1.0",
"version": "0.2.0",
"description": "Official Neo Financial ESLint configuration",
"main": "index.js",
"author": "Neo Financial Engineering <engineering@neofinancial.com>",
Expand All @@ -22,11 +22,10 @@
"@typescript-eslint/parser": "^1.6.0",
"eslint-config-prettier": "^4.1.0",
"eslint-plugin-jest": "^22.4.1",
"eslint-plugin-lodash": "^5.1.0",
"eslint-plugin-no-loops": "^0.3.0",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-react": "^7.12.4",
"eslint-plugin-react-hooks": "^1.6.0",
"eslint-plugin-unicorn": "^8.0.1"
},
"devDependencies": {
Expand Down
19 changes: 6 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -278,18 +278,6 @@ eslint-plugin-jest@^22.4.1:
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.4.1.tgz#a5fd6f7a2a41388d16f527073b778013c5189a9c"
integrity sha512-gcLfn6P2PrFAVx3AobaOzlIEevpAEf9chTpFZz7bYfc7pz8XRv7vuKTIE4hxPKZSha6XWKKplDQ0x9Pq8xX2mg==

eslint-plugin-lodash@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-lodash/-/eslint-plugin-lodash-5.1.0.tgz#f7dc6c14f104cacb169a18d17c27d9c015a53924"
integrity sha512-mMKmf1OMLS8VExtaHCcrwBmsYIiOVYEibnAFDzXrbJdtFGOcLEw37tryN/WGYKBiJy6nAIGC43i5Wh3KA9lO2g==
dependencies:
lodash "4.17.11"

eslint-plugin-no-loops@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-no-loops/-/eslint-plugin-no-loops-0.3.0.tgz#e81fecb4eaaf494a926d9caba9a7cd84d1fede7d"
integrity sha1-6B/stOqvSUqSbZyrqafNhNH+3n0=

eslint-plugin-node@^8.0.1:
version "8.0.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-8.0.1.tgz#55ae3560022863d141fa7a11799532340a685964"
Expand All @@ -307,6 +295,11 @@ eslint-plugin-promise@^4.1.1:
resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.1.1.tgz#1e08cb68b5b2cd8839f8d5864c796f56d82746db"
integrity sha512-faAHw7uzlNPy7b45J1guyjazw28M+7gJokKUjC5JSFoYfUEyy6Gw/i7YQvmv2Yk00sUjWcmzXQLpU1Ki/C2IZQ==

eslint-plugin-react-hooks@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.6.0.tgz#348efcda8fb426399ac7b8609607c7b4025a6f5f"
integrity sha512-lHBVRIaz5ibnIgNG07JNiAuBUeKhEf8l4etNx5vfAEwqQ5tcuK3jV9yjmopPgQDagQb7HwIuQVsE3IVcGrRnag==

eslint-plugin-react@^7.12.4:
version "7.12.4"
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.12.4.tgz#b1ecf26479d61aee650da612e425c53a99f48c8c"
Expand Down Expand Up @@ -730,7 +723,7 @@ lodash.zip@^4.2.0:
resolved "https://registry.yarnpkg.com/lodash.zip/-/lodash.zip-4.2.0.tgz#ec6662e4896408ed4ab6c542a3990b72cc080020"
integrity sha1-7GZi5IlkCO1KtsVCo5kLcswIACA=

lodash@4.17.11, lodash@^4.17.11:
lodash@^4.17.11:
version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==
Expand Down

0 comments on commit b487281

Please sign in to comment.