Skip to content

Commit 3adcc68

Browse files
committed
chore: update eslint rule
1 parent 05d98bc commit 3adcc68

File tree

6 files changed

+16
-24
lines changed

6 files changed

+16
-24
lines changed

.eslintrc

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
11
{
2-
"parser": "babel-eslint",
32
"env": {
43
"browser": true,
54
"node": true,
65
"jest": true
76
},
8-
"extends": [
9-
"eslint:recommended",
10-
"plugin:react/recommended"
11-
],
12-
"plugins": [
13-
"react-hooks"
14-
],
7+
"extends": "airbnb",
158
"rules": {
16-
"react-hooks/rules-of-hooks": "error"
17-
},
18-
"settings": {
19-
"react": {
20-
"version": "16.7.0-alpha"
21-
}
9+
"consistent-return": 0,
10+
"react/jsx-one-expression-per-line": 0
2211
}
2312
}

__tests__/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
const hooks = require('../src/index').default;
2+
13
describe('hooks test', () => {
24
it('should be a function', () => {
3-
expect(require('../src/index').default).toEqual(expect.any(Function));
5+
expect(hooks).toEqual(expect.any(Function));
46
});
5-
});
7+
});

example/App.js renamed to example/App.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function App() {
1010
<div>
1111
<h2>DEMO of <span style={{ color: '#F44336' }}>@use-hooks/image-size</span></h2>
1212
<div>
13-
<img src={url} width={100} height={100} alt=""/>
13+
<img src={url} width={100} height={100} alt="" />
1414
<div>Natural size: {width} x {height}</div>
1515
</div>
1616
</div>
File renamed without changes.

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"start": "webpack-dev-server --progress --color",
1212
"build": "webpack --env build",
1313
"example": "webpack --env example",
14-
"lint": "eslint src",
15-
"lint:fix": "eslint src --fix",
14+
"lint": "eslint src example",
15+
"lint:fix": "eslint src example --fix",
1616
"prepublishOnly": "npm run build"
1717
},
1818
"repository": {
@@ -33,12 +33,13 @@
3333
"@babel/preset-env": "^7.2.0",
3434
"@babel/preset-react": "^7.0.0",
3535
"babel-core": "^7.0.0-bridge.0",
36-
"babel-eslint": "^10.0.1",
3736
"babel-jest": "^23.6.0",
3837
"babel-loader": "^8.0.4",
3938
"eslint": "^5.10.0",
39+
"eslint-config-airbnb": "^17.1.0",
40+
"eslint-plugin-import": "^2.14.0",
41+
"eslint-plugin-jsx-a11y": "^6.1.2",
4042
"eslint-plugin-react": "^7.11.1",
41-
"eslint-plugin-react-hooks": "^0.0.0",
4243
"html-webpack-plugin": "^3.2.0",
4344
"husky": "^1.2.0",
4445
"jest": "^23.6.0",
@@ -54,7 +55,7 @@
5455
}
5556
},
5657
"lint-staged": {
57-
"*.js": [
58+
"*.{js,jsx}": [
5859
"eslint --fix",
5960
"git add"
6061
]

webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const path = require('path');
22
const webpack = require('webpack');
33
const HtmlWebpackPlugin = require('html-webpack-plugin');
44

5-
module.exports = function(env) {
5+
module.exports = (env) => {
66
const isExample = env === 'example';
77
const isBuild = env === 'build';
88
const isDev = !env;
@@ -52,5 +52,5 @@ module.exports = function(env) {
5252
isDev && new webpack.NamedModulesPlugin(),
5353
isDev && new webpack.HotModuleReplacementPlugin(),
5454
].filter(Boolean),
55-
}
55+
};
5656
};

0 commit comments

Comments
 (0)