Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2 from smooth-code/hooks
Browse files Browse the repository at this point in the history
feat: add react hooks & ajust rules
  • Loading branch information
gregberge authored Mar 2, 2019
2 parents 9751148 + bcc4aad commit 98934c7
Show file tree
Hide file tree
Showing 8 changed files with 1,175 additions and 771 deletions.
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CHANGELOG.md
node_modules/
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "all",
"semi": false
}
11 changes: 2 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
language: node_js

node_js:
- 6
- 8

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.5.1
- export PATH="$HOME/.yarn/bin:$PATH"
- 10

notifications:
email: false

cache:
yarn: true
directories:
- "node_modules"
cache: yarn
1 change: 1 addition & 0 deletions dev.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
rules: {
// https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules
'import/no-extraneous-dependencies': 'off',
},
}
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ module.exports = {
sourceType: 'module',
},
rules: {
// https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules
'import/prefer-default-export': 'off',
'import/first': 'error',
'import/no-amd': 'error',
'import/no-webpack-loader-syntax': 'error',
'import/no-extraneous-dependencies': [
'error',
{ devDependencies: ['**/*.stories.js', '**/*.test.js'] },
],

'no-param-reassign': 'off',
'no-shadow': 'off',
Expand Down
36 changes: 20 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,31 @@
"main": "index.js",
"license": "MIT",
"scripts": {
"format": "prettier --write \"*.{js,md}\"",
"release": "standard-version && conventional-github-releaser -p angular",
"test": "eslint ."
},
"devDependencies": {
"babel-eslint": "^8.2.2",
"conventional-github-releaser": "^2.0.2",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.10.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0",
"standard-version": "^4.3.0"
"babel-eslint": "^10.0.1",
"conventional-github-releaser": "^3.1.2",
"eslint": "^5.15.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^4.1.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.12.4",
"eslint-plugin-react-hooks": "^1.4.0",
"prettier": "^1.16.4",
"standard-version": "^5.0.1"
},
"peerDependencies": {
"babel-eslint": ">=8.2.2",
"eslint": ">=4.19.1",
"eslint-config-airbnb": ">=16.1.0",
"eslint-config-prettier": ">=2.9.0",
"eslint-plugin-import": ">=2.10.0",
"eslint-plugin-jsx-a11y": ">=6.0.3",
"eslint-plugin-react": ">=7.7.0"
"babel-eslint": "^10.0.0",
"eslint": "^5.15.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^4.1.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^6.2.0",
"eslint-plugin-react": "^7.12.0",
"eslint-plugin-react-hooks": "^1.4.0"
}
}
29 changes: 28 additions & 1 deletion react.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,41 @@ const baseRules = require('./index').rules

module.exports = {
extends: ['airbnb', 'prettier', 'prettier/react'],
plugins: ['react-hooks'],
rules: Object.assign(baseRules, {
// https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules
'react/jsx-filename-extension': ['error', { extensions: ['.js'] }],
'react/prop-types': 'off',
'react/sort-comp': 'off',
'react/no-did-mount-set-state': 'off',
'react/require-default-props': 'off',
'react/no-array-index-key': 'off',
'react/no-typos': 'off',
'react/destructuring-assignment': 'off',
'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
'react/jsx-no-comment-textnodes': 'warn',
'react/jsx-no-duplicate-props': ['warn', { ignoreCase: true }],
'react/jsx-no-target-blank': 'warn',
'react/jsx-no-undef': 'error',
'react/jsx-pascal-case': [
'warn',
{
allowAllCaps: true,
ignore: [],
},
],
'react/jsx-uses-react': 'warn',
'react/jsx-uses-vars': 'warn',
'react/no-danger-with-children': 'warn',
'react/no-deprecated': 'warn',
'react/no-direct-mutation-state': 'warn',
'react/no-is-mounted': 'warn',
'react/no-typos': 'error',
'react/react-in-jsx-scope': 'error',
'react/require-render-return': 'error',
'react/style-prop-object': 'warn',

'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',

'jsx-a11y/anchor-is-valid': 'off',
'jsx-a11y/anchor-has-content': 'off',
Expand Down
Loading

0 comments on commit 98934c7

Please sign in to comment.