chore: add configs for eslint, prettier, import-sorter

This commit is contained in:
jamaljsr 2020-04-09 12:48:03 -04:00
parent e4e7551e7e
commit f4754f4154
6 changed files with 129 additions and 11 deletions

66
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,66 @@
{
"files.associations": {
".commitlintrc": "jsonc",
".electronbuildrc": "jsonc",
".eslintrc": "jsonc",
".lintstagedrc": "jsonc",
".prettierrc": "jsonc",
".renovaterc": "jsonc",
".stylelintrc": "json",
".versionrc": "json",
".tsimportsorter": "json"
},
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"importSorter.generalConfiguration.sortOnBeforeSave": true,
"importSorter.sortConfiguration.removeUnusedImports": true,
"importSorter.importStringConfiguration.tabSize": 2,
"importSorter.importStringConfiguration.trailingComma": "multiLine",
"importSorter.importStringConfiguration.maximumNumberOfImportExpressionsPerLine.count": 90,
"importSorter.importStringConfiguration.maximumNumberOfImportExpressionsPerLine.type": "newLineEachExpressionAfterCountLimit",
"importSorter.sortConfiguration.customOrderingRules.defaultNumberOfEmptyLinesAfterGroup": 0,
"importSorter.sortConfiguration.customOrderingRules.defaultOrderLevel": 50,
"importSorter.sortConfiguration.customOrderingRules.rules": [
{
"regex": "^(first entry ignored by the plugin. idk why)",
"orderLevel": 0
},
{
"regex": "^(react)",
"orderLevel": 10
},
{
"regex": "^(mobx|mobx-react|types)",
"orderLevel": 20
},
{
"regex": "^[@]",
"orderLevel": 30
},
{
"type": "importMember",
"regex": "^$",
"orderLevel": 40,
"disableSort": true
},
{
"regex": "^(action|api|store)",
"orderLevel": 60
},
{
"regex": "^(components|resources)",
"orderLevel": 70
},
{
"regex": "^[.]",
"orderLevel": 80
}
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}

28
app/.eslintrc Normal file
View file

@ -0,0 +1,28 @@
{
"parser": "@typescript-eslint/parser", // Specifies the ESLint parser
"extends": [
"plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from @typescript-eslint/eslint-plugin
"prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
"plugin:prettier/recommended" // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
"parserOptions": {
"ecmaVersion": 2018, // Allows for the parsing of modern ECMAScript features
"sourceType": "module", // Allows for the use of imports
"ecmaFeatures": {
"jsx": true // Allows for the parsing of JSX
}
},
"settings": {
"react": {
"version": "detect" // Tells eslint-plugin-react to automatically detect the version of React to use
}
},
"rules": {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
"react/prop-types": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/no-explicit-any": 0
}
}

19
app/.prettierrc Normal file
View file

@ -0,0 +1,19 @@
{
"overrides": [
{
"files": [".prettierrc", ".babelrc", ".eslintrc", ".stylelintrc"],
"options": {
"parser": "json"
}
}
],
"printWidth": 90,
"singleQuote": true,
"useTabs": false,
"semi": true,
"tabWidth": 2,
"trailingComma": "all",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "avoid"
}

View file

@ -14,23 +14,28 @@
"proxy": "https://localhost:8443",
"dependencies": {
"@improbable-eng/grpc-web": "0.12.0",
"mobx": "5.15.4",
"mobx-react": "6.2.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
},
"devDependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@types/google-protobuf": "3.7.2",
"@types/jest": "^24.0.0",
"@types/node": "^12.0.0",
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"google-protobuf": "3.11.4",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1",
"prettier": "2.0.4",
"ts-protoc-gen": "0.12.0",
"typescript": "~3.7.2"
},
"devDependencies": {
"@types/google-protobuf": "3.7.2",
"ts-protoc-gen": "0.12.0"
},
"eslintConfig": {
"extends": "react-app",
"ignorePatterns": [

View file

@ -9,6 +9,7 @@
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
@ -17,7 +18,8 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
"jsx": "react",
"baseUrl": "src"
},
"include": [
"src"

4
go.mod
View file

@ -3,7 +3,6 @@ module github.com/lightninglabs/shushtar
go 1.14
require (
github.com/btcsuite/btcutil v1.0.1
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.2.0
@ -11,10 +10,9 @@ require (
github.com/improbable-eng/grpc-web v0.12.0
github.com/jessevdk/go-flags v1.4.0
github.com/jpillora/backoff v1.0.0 // indirect
github.com/mitranim/gow v0.0.0-20200310140433-1453861c60a5 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76
github.com/prometheus/client_golang v1.5.1
github.com/prometheus/client_golang v1.5.1 // indirect
github.com/rs/cors v1.7.0 // indirect
github.com/sirupsen/logrus v1.5.0
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e