From 730f164f54b2599effcf0f15264681cec61faab4 Mon Sep 17 00:00:00 2001 From: Christian Stewart Date: Sat, 20 Apr 2024 14:34:12 -0700 Subject: [PATCH] chore: include linter dotfiles Signed-off-by: Christian Stewart --- .eslintrc.js | 18 ++++++++++++++ .golangci.yml | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++ .ignore | 4 +++ Makefile | 2 +- go.mod | 5 ++-- package.json | 2 +- tsconfig.json | 6 +---- 7 files changed, 95 insertions(+), 9 deletions(-) create mode 100644 .eslintrc.js create mode 100644 .golangci.yml create mode 100644 .ignore diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..56fdbff --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,18 @@ +module.exports = { + root: true, + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint'], + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'prettier', + ], + parserOptions: { + project: './tsconfig.json', + }, + rules: { + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-explicit-any': 'off', + } +} diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..8063fc6 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,67 @@ +linters: + enable: + - depguard + - goimports + - gosec + - gosimple + - govet + - importas + - ineffassign + - misspell + - revive + - staticcheck + - typecheck + - unconvert + - unused + + disable: + - errcheck + + run: + concurrency: 4 + modules-download-mode: vendor + + skip-dirs: + - hack + +linters-settings: + staticcheck: + checks: + - all + - '-SA1012' # Allow passing nil contexts. + + importas: + # Do not allow unaliased imports of aliased packages. + no-unaliased: true + + maligned: + suggest-new: true + + depguard: + rules: + main: + deny: + - pkg: io/ioutil + desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil + - pkg: "github.com/stretchr/testify/assert" + desc: Use "gotest.tools/v3/assert" instead + - pkg: "github.com/stretchr/testify/require" + desc: Use "gotest.tools/v3/assert" instead + - pkg: "github.com/stretchr/testify/suite" + desc: Do not use + + revive: + rules: + - name: package-comments + disabled: true + + gosec: + excludes: + - G306 # Allow WriteFile permissions to be 0644. + +issues: + # Maximum issues count per one linter. Set to 0 to disable. Default is 50. + max-issues-per-linter: 0 + + # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. + max-same-issues: 0 diff --git a/.ignore b/.ignore new file mode 100644 index 0000000..3e759c5 --- /dev/null +++ b/.ignore @@ -0,0 +1,4 @@ +node_modules/ +*.pb.go +*.pb.ts +go.sum diff --git a/Makefile b/Makefile index 992fab2..695556a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# https://github.com/aperturerobotics/protobuf-project +# https://github.com/aperturerobotics/template SHELL:=bash PROTOWRAP=hack/bin/protowrap diff --git a/go.mod b/go.mod index e9b0020..7eae187 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,12 @@ module github.com/aperturerobotics/template go 1.22 require ( - github.com/aperturerobotics/protobuf-go-lite v0.3.1 // indirect; latest + github.com/aperturerobotics/protobuf-go-lite v0.3.1 // latest github.com/aperturerobotics/starpc v0.30.0 // latest ) +require github.com/pkg/errors v0.9.1 + require ( github.com/aperturerobotics/util v1.17.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect @@ -28,7 +30,6 @@ require ( github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-multistream v0.5.0 // indirect github.com/multiformats/go-varint v0.0.7 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect golang.org/x/crypto v0.19.0 // indirect diff --git a/package.json b/package.json index 83697d5..2d83453 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "test:js": "echo No JS tests.", "lint": "npm run lint:go && npm run lint:js", "lint:go": "make lint", - "lint:js": "ESLINT_USE_FLAT_CONFIG=false eslint -c .eslintrc.js ./", + "lint:js": "ESLINT_USE_FLAT_CONFIG=false eslint -c .eslintrc.js ./example", "patch": "patch-package --use-yarn --patch-dir ./node_modules/@aperturerobotics/ts-common/patches", "prepare": "npm run patch && go mod vendor", "precommit": "npm run format" diff --git a/tsconfig.json b/tsconfig.json index d07e50c..18c3ce4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,9 +19,5 @@ "strict": true, "lib": ["webworker", "dom"] }, - "exclude": ["node_modules", "vendor", "dist"], - "ts-node": { - "esm": true, - "experimentalSpecifierResolution": true - } + "include": ["example"] }