Skip to content

Commit d7eb120

Browse files
committed
Add eslint with eslint-config-airbnb
1 parent fa29da1 commit d7eb120

6 files changed

+132
-25
lines changed

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ web-format:
145145
web-format-check:
146146
cd web && npm run format:check
147147

148+
web-lint:
149+
cd web && npm run lint
150+
148151
# Main server/client build
149152

150153
cli: cli-deps
@@ -233,7 +236,7 @@ cli-build-results:
233236

234237
# Test/check targets
235238

236-
check: test web-format-check fmt-check vet lint staticcheck
239+
check: test web-format-check fmt-check vet web-lint lint staticcheck
237240

238241
test: .PHONY
239242
go test $(shell go list ./... | grep -vE 'ntfy/(test|examples|tools)')

web/.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/app/emojis.js

web/.eslintrc

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"extends": ["airbnb", "prettier"],
3+
"env": {
4+
"browser": true
5+
},
6+
"globals": {
7+
"config": "readonly"
8+
},
9+
"parserOptions": {
10+
"ecmaVersion": 2023
11+
},
12+
"rules": {
13+
"no-console": "off",
14+
"class-methods-use-this": "off",
15+
"func-style": ["error", "expression"],
16+
"no-restricted-syntax": ["error", "ForInStatement", "LabeledStatement", "WithStatement"],
17+
"no-await-in-loop": "error",
18+
"import/no-cycle": "warn",
19+
"react/prop-types": "off",
20+
"react/destructuring-assignment": "off",
21+
"react/jsx-no-useless-fragment": "off",
22+
"react/jsx-props-no-spreading": "off",
23+
"react/function-component-definition": [
24+
"error",
25+
{
26+
"namedComponents": "arrow-function",
27+
"unnamedComponents": "arrow-function"
28+
}
29+
]
30+
}
31+
}

web/.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
build/
22
dist/
33
public/static/langs/
4+
src/app/emojis.js

web/package-lock.json

+82-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/package.json

+13-5
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
"version": "1.0.0",
44
"private": true,
55
"scripts": {
6-
"start": "react-scripts start",
7-
"build": "react-scripts build",
8-
"test": "react-scripts test",
9-
"eject": "react-scripts eject",
6+
"start": "DISABLE_ESLINT_PLUGIN=true react-scripts start",
7+
"build": "DISABLE_ESLINT_PLUGIN=true react-scripts build",
8+
"test": "DISABLE_ESLINT_PLUGIN=true react-scripts test",
9+
"eject": "DISABLE_ESLINT_PLUGIN=true react-scripts eject",
1010
"format": "prettier . --write",
11-
"format:check": "prettier . --check"
11+
"format:check": "prettier . --check",
12+
"lint": "eslint --report-unused-disable-directives --ext .js,.jsx ./src/"
1213
},
1314
"dependencies": {
1415
"@mui/icons-material": "^5.4.2",
@@ -29,6 +30,13 @@
2930
"stacktrace-js": "^2.0.2"
3031
},
3132
"devDependencies": {
33+
"eslint": "^8.41.0",
34+
"eslint-config-airbnb": "^19.0.4",
35+
"eslint-config-prettier": "^8.8.0",
36+
"eslint-plugin-import": "^2.27.5",
37+
"eslint-plugin-jsx-a11y": "^6.7.1",
38+
"eslint-plugin-react": "^7.32.2",
39+
"eslint-plugin-react-hooks": "^4.6.0",
3240
"prettier": "^2.8.8",
3341
"react-scripts": "^5.0.0"
3442
},

0 commit comments

Comments
 (0)