Add linter and formatter

This commit is contained in:
ShatteredBunny 2022-08-28 00:20:45 +02:00
parent 7fb2767ee7
commit 2abf6cb66f
6 changed files with 25214 additions and 1368 deletions

View File

@ -24,6 +24,7 @@ All RoboSats contributors submit changes via pull requests. The workflow is as f
- Fork the repository
- Create a topic branch from the `main` branch
- Commit patches
- Run formatter if the frontend was changed: `npm run format`
- Squash redundant or unnecessary commits
- Submit a pull request from your topic branch back to the `main` branch of the main repository
- Make changes to the pull request if reviewers request them and request a re-review

View File

@ -1,27 +1,42 @@
{
"parser": "@typescript-eslint/parser",
"env": {
"browser": true,
"es2021": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"standard-with-typescript",
"prettier"
],
"overrides": [],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
"ecmaVersion": "latest",
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": [
"react",
"react-hooks",
"@typescript-eslint",
"react-hooks"
],
"extends": [
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
"prettier"
],
"rules": {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
"react/react-in-jsx-scope": "off"
},
"settings": {
"import/resolver": {
"typescript": {}
},
"react": {
"pragma": "React",
"version": "detect"
}
}
}
}

1
frontend/.prettierignore Normal file
View File

@ -0,0 +1 @@
src/components/payment-methods/code/code.js

9
frontend/.prettierrc Normal file
View File

@ -0,0 +1,9 @@
{
"semi": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all",
"jsxSingleQuote": true,
"bracketSpacing": true
}

26509
frontend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,10 @@
"scripts": {
"dev": "webpack --watch --progress --mode development",
"test": "jest",
"build": "webpack --mode production"
"build": "webpack --mode production",
"lint": "eslint src/**/*.{js,ts,tsx}",
"lint:fix": "eslint --fix 'src/**/*.{js,ts,tsx}'",
"format": "prettier --write 'src/**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc"
},
"keywords": [],
"author": "",
@ -22,13 +25,21 @@
"@types/react": "^17.0.44",
"@types/react-dom": "^18.0.1",
"@types/webpack": "^5.28.0",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"@typescript-eslint/eslint-plugin": "^5.35.1",
"@typescript-eslint/parser": "^5.35.1",
"babel-loader": "^8.2.5",
"eslint": "^8.13.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.4.0",
"eslint": "^8.23.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-standard-with-typescript": "^22.0.0",
"eslint-import-resolver-typescript": "^3.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.2.5",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.0.1",
"eslint-plugin-react": "^7.31.1",
"eslint-plugin-react-hooks": "^4.6.0",
"jest": "^27.5.1",
"prettier": "^2.7.1",
"ts-node": "^10.7.0",
"typescript": "^4.6.3",
"webpack": "^5.72.0",
@ -68,4 +79,4 @@
"webln": "^0.3.0",
"websocket": "^1.0.34"
}
}
}