Skip to content

Commit 0271233

Browse files
committed
split eslint stuff into client (v9) & server (v8 still)
1 parent dd92543 commit 0271233

File tree

11 files changed

+80
-42
lines changed

11 files changed

+80
-42
lines changed

.eslintrc.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test: test-install
2424
test-install: echo-exports
2525
npm install --legacy-peer-deps
2626
npm install --legacy-peer-deps --prefix ./server
27-
npm install --legacy-peer-deps --prefix ./client
27+
npm install --prefix ./client
2828

2929
# Launch a local development server for working on the
3030
# React www app (points at deployed/production validation fn)

client/.eslintrc.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"extends": [
3+
"../.eslintrc.json",
4+
"plugin:react/recommended"
5+
],
6+
"plugins": [
7+
"react"
8+
],
9+
"parserOptions": {
10+
"sourceType": "module",
11+
"ecmaVersion": 6,
12+
"ecmaFeatures": {
13+
"jsx": true
14+
}
15+
},
16+
"env": {
17+
"es6": true,
18+
"browser": true,
19+
"jest": true
20+
},
21+
"globals": {
22+
"React": false
23+
},
24+
"rules": {
25+
"react/jsx-uses-vars": 1,
26+
"arrow-parens": ["error", "as-needed"]
27+
}
28+
}

client/.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# dependencies
2+
/node_modules
3+
4+
# testing
5+
/coverage
6+
7+
# production
8+
/build
9+
10+
# misc
11+
.DS_Store
12+
.env.local
13+
.env.development.local
14+
.env.test.local
15+
.env.production.local
16+
117
# Logs
218
logs
319
*.log

client/src/assets/react.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

client/src/registerServiceWorker.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ function registerValidSW(swUrl) {
4747
navigator.serviceWorker
4848
.register(swUrl)
4949
.then(registration => {
50-
// eslint-disable-next-line no-param-reassign
5150
registration.onupdatefound = () => {
5251
const installingWorker = registration.installing;
5352
installingWorker.onstatechange = () => {
@@ -57,21 +56,18 @@ function registerValidSW(swUrl) {
5756
// the fresh content will have been added to the cache.
5857
// It's the perfect time to display a "New content is
5958
// available; please refresh." message in your web app.
60-
// eslint-disable-next-line no-console
6159
console.log('New content is available; please refresh.');
6260
} else {
6361
// At this point, everything has been precached.
6462
// It's the perfect time to display a
6563
// "Content is cached for offline use." message.
66-
// eslint-disable-next-line no-console
6764
console.log('Content is cached for offline use.');
6865
}
6966
}
7067
};
7168
};
7269
})
7370
.catch(error => {
74-
// eslint-disable-next-line no-console
7571
console.error('Error during service worker registration:', error);
7672
});
7773
}
@@ -97,7 +93,6 @@ function checkValidServiceWorker(swUrl) {
9793
}
9894
})
9995
.catch(() => {
100-
// eslint-disable-next-line no-console
10196
console.log(
10297
'No internet connection found. App is running in offline mode.'
10398
);

client/src/views/Home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default function Home() {
6464
navigate(`/report/${reportName}`);
6565
});
6666
});
67-
}, []);
67+
}, [navigate, targetUrl]);
6868

6969
if (isLoading) {
7070
return <Loader />;

client/src/views/Report.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export default function Report() {
149149
useEffect(() => {
150150
const reportUrl = `${STORAGE_URL}/${encodeURIComponent(reportName ?? '')}`;
151151
fetch(reportUrl).then(response => response.json()).then(setReport);
152-
}, [report]);
152+
}, [report, reportName]);
153153

154154
if (!report) {
155155
return <Loader />;

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"devDependencies": {
33
"@testing-library/react": "^13.1.1",
4-
"eslint": "^8.57.1",
5-
"eslint-config-airbnb-base": "^15.0.0",
6-
"eslint-plugin-react": "^7.37.1",
74
"jest": "^24.9.0",
85
"lint-staged": "^15.2.10",
96
"prettier": "^1.19.1",
@@ -22,6 +19,12 @@
2219
"cd server && npm build",
2320
"eslint --fix",
2421
"git add"
22+
],
23+
"*.ts": [
24+
"prettier --write \"server/src/**/*.{js,ts}\"",
25+
"cd server && npm build",
26+
"eslint --fix",
27+
"git add"
2528
]
2629
},
2730
"prettier": {

server/.eslintrc.json

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
11
{
2-
"extends": "../.eslintrc.json",
2+
"extends": "airbnb-base",
33
"env": {
44
"node": true,
55
"jest": true
66
},
77
"rules": {
8-
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}]
8+
"global-require": 0,
9+
"object-curly-spacing": 0,
10+
"no-use-before-define": 0,
11+
"no-plusplus": 0,
12+
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}],
13+
"comma-dangle": ["error", {
14+
"arrays": "ignore",
15+
"functions": "ignore"
16+
}],
17+
"func-names": 0,
18+
"consistent-return": ["error", {"treatUndefinedAsUnspecified": true}],
19+
"no-void": 0,
20+
"class-methods-use-this" : 0,
21+
"max-len": 0,
22+
"arrow-body-style": 0
23+
},
24+
"settings": {
25+
"import/resolver": {
26+
"node": {
27+
"extensions": [".js", ".jsx", ".ts", ".tsx"]
28+
}
29+
}
930
}
10-
}
31+
}

0 commit comments

Comments
 (0)