Skip to content

Commit 0e0d0fa

Browse files
committed
Update ESLint, update ESLint config, configure Prettier, format all files using new config
1 parent a5581e0 commit 0e0d0fa

39 files changed

+1293
-1971
lines changed

.babelrc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
{
2-
"presets": [
3-
"@babel/env",
4-
"@babel/react"
5-
]
2+
"presets": ["@babel/env", "@babel/react"]
63
}

.eslintrc.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
{
2-
"extends": "wojtekmaj/react",
3-
"parser": "babel-eslint",
4-
"rules": {
5-
"no-restricted-globals": "off"
6-
},
2+
"extends": "wojtekmaj/react-no-automatic-runtime",
73
"overrides": [
84
{
9-
"files": [
10-
"sample/**",
11-
"test/**"
12-
],
5+
"files": ["sample/**", "test/**"],
136
"rules": {
147
"import/no-unresolved": "off"
158
}

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn pretty-quick --staged

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.cache
2+
.yarn
3+
coverage
4+
dist
5+
*.yml

.prettierrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"printWidth": 100,
3+
"singleQuote": true,
4+
"trailingComma": "all"
5+
}

.vscode/extensions.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
{
2-
"recommendations": [
3-
"dbaeumer.vscode-eslint",
4-
"eamodio.gitlens"
5-
],
6-
"unwantedRecommendations": [
7-
"dbaeumer.jshint"
8-
]
2+
"recommendations": ["dbaeumer.vscode-eslint", "eamodio.gitlens", "esbenp.prettier-vscode"],
3+
"unwantedRecommendations": ["dbaeumer.jshint"]
94
}

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"editor.formatOnSave": true,
24
"search.exclude": {
35
"**/.yarn": true
46
}

README.md

Lines changed: 59 additions & 63 deletions
Large diffs are not rendered by default.

jest.config.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
{
2-
"collectCoverageFrom": [
3-
"**/src/**.{js,jsx}",
4-
"!**/src/entry.js",
5-
"!**/src/entry.nostyle.js"
6-
],
7-
"setupFiles": [
8-
"<rootDir>/jest.setup.js"
9-
],
2+
"collectCoverageFrom": ["**/src/**.{js,jsx}", "!**/src/entry.js", "!**/src/entry.nostyle.js"],
3+
"setupFiles": ["<rootDir>/jest.setup.js"],
104
"testEnvironment": "jsdom"
115
}

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"copy-styles": "node ./copy-styles.js",
1313
"jest": "jest",
1414
"lint": "eslint sample/ src/ test/ --ext .jsx,.js",
15+
"postinstall": "husky install",
1516
"prepack": "yarn clean && yarn build",
1617
"test": "yarn lint && yarn jest"
1718
},
@@ -48,12 +49,14 @@
4849
"@babel/preset-env": "^7.15.0",
4950
"@babel/preset-react": "^7.14.0",
5051
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.0",
51-
"babel-eslint": "^10.0.0",
5252
"enzyme": "^3.10.0",
53-
"eslint": "~7.19.0",
54-
"eslint-config-wojtekmaj": "^0.5.0",
53+
"eslint": "^8.5.0",
54+
"eslint-config-wojtekmaj": "^0.6.5",
55+
"husky": "^7.0.0",
5556
"jest": "^27.0.0",
5657
"less": "^4.0.0",
58+
"prettier": "^2.5.0",
59+
"pretty-quick": "^3.1.0",
5760
"react": "^17.0.0",
5861
"react-dom": "^17.0.0",
5962
"rimraf": "^3.0.0"

sample/.babelrc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
22
"presets": [
3-
["@babel/preset-env", {
4-
"modules": false
5-
}],
3+
[
4+
"@babel/preset-env",
5+
{
6+
"modules": false
7+
}
8+
],
69
"@babel/react"
710
]
811
}

sample/Sample.less

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
html,
22
body {
3-
height: 100%;
3+
height: 100%;
44
}
55

66
body {
@@ -9,13 +9,14 @@ body {
99
}
1010

1111
.Sample {
12-
input, button {
12+
input,
13+
button {
1314
font: inherit;
1415
}
1516

1617
header {
1718
background-color: rgb(50, 54, 57);
18-
box-shadow: 0 0 8px rgba(0, 0, 0, .5);
19+
box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
1920
padding: 20px;
2021
color: white;
2122

@@ -48,4 +49,4 @@ body {
4849
align-items: stretch;
4950
}
5051
}
51-
}
52+
}

sample/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en-US">
33
<head>
44
<meta charset="utf-8" />
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>react-datetime-picker sample page</title>
77
</head>
88
<body>

sample/webpack.config.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,15 @@ module.exports = {
2121
rules: [
2222
{
2323
test: /\.jsx?$/,
24-
use: [
25-
'babel-loader',
26-
],
24+
use: ['babel-loader'],
2725
},
2826
{
2927
test: /\.less$/,
30-
use: [
31-
'style-loader',
32-
'css-loader',
33-
'less-loader',
34-
],
28+
use: ['style-loader', 'css-loader', 'less-loader'],
3529
},
3630
{
3731
test: /\.css$/,
38-
use: [
39-
'style-loader',
40-
'css-loader',
41-
],
32+
use: ['style-loader', 'css-loader'],
4233
},
4334
],
4435
},

0 commit comments

Comments
 (0)