From e8e31607e21c406dfeda90be9d244be534a8187e Mon Sep 17 00:00:00 2001 From: hyphenized <28708889+hyphenized@users.noreply.github.com> Date: Mon, 10 Jul 2023 12:07:38 -0500 Subject: [PATCH] Add shared eslint/prettier configs --- .eslintrc.js | 7 ++++ .gitignore | 78 ++++++++--------------------------------- .pre-commit-config.yaml | 25 +++++++++++++ .prettierignore | 4 +++ .tsconfig-eslint.json | 6 ++++ tsconfig.json | 17 +++++---- 6 files changed, 65 insertions(+), 72 deletions(-) create mode 100644 .eslintrc.js create mode 100644 .pre-commit-config.yaml create mode 100644 .prettierignore create mode 100644 .tsconfig-eslint.json diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..cf7fdffb0 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + root: true, + extends: ["@thesis-co"], + env: { + browser: true, + }, +} diff --git a/.gitignore b/.gitignore index 46bbe0ff2..f81327511 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,9 @@ -# Static site build -public/ - # Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* -lerna-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json # Runtime data pids @@ -23,12 +16,11 @@ lib-cov # Coverage directory used by tools like istanbul coverage -*.lcov # nyc test coverage .nyc_output -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) .grunt # Bower dependency directory (https://bower.io/) @@ -37,81 +29,41 @@ bower_components # node-waf configuration .lock-wscript -# Compiled binary addons (https://nodejs.org/api/addons.html) +# Compiled binary addons (http://nodejs.org/api/addons.html) build/Release # Dependency directories node_modules/ jspm_packages/ -# TypeScript v1 declaration files +# Typescript v1 declaration files typings/ -# TypeScript cache -*.tsbuildinfo - # Optional npm cache directory .npm # Optional eslint cache .eslintcache -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - # Optional REPL history .node_repl_history # Output of 'npm pack' *.tgz -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# Next.js build output -.next +# dotenv environment variable files +.env* -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files +# gatsby files .cache/ -# Comment in the public line in if your project uses Gatsby and *not* Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ +public -# TernJS port file -.tern-port +# Mac files +.DS_Store -# Netlify local directory -.netlify -.history/** - -# Linaria cache -.linaria-cache - -# Mac system files -.DS_Store \ No newline at end of file +# Yarn +yarn-error.log +.pnp/ +.pnp.js +# Yarn Integrity file +.yarn-integrity diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..949b1c672 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,25 @@ +repos: + - repo: local + hooks: + - id: lint-js + name: "lint typescript and javascript" + entry: /usr/bin/env npx eslint + files: '\.jsx?$|\.tsx?$' + language: script + description: "Checks JS/TS code according to the package's linter configuration" + - repo: local + hooks: + - id: lint-config + name: "lint config files" + entry: /usr/bin/env npx prettier -c + files: '\.json$|\.yaml$|\.toml$|\.yml$' + language: script + description: "Checks config files according to the package's linter configuration" + - repo: local + hooks: + - id: lint-docs + name: "lint documentation files" + entry: /usr/bin/env npx prettier -c + files: '\.md$' + language: script + description: "Checks documentation files according to the package's linter configuration" diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..58d06c368 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +.cache +package.json +package-lock.json +public diff --git a/.tsconfig-eslint.json b/.tsconfig-eslint.json new file mode 100644 index 000000000..907fbc48a --- /dev/null +++ b/.tsconfig-eslint.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "include": [".eslintrc.js", "**/*.js", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] + } + \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 3636b0854..cbb717e31 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,15 +1,14 @@ { "compilerOptions": { - "module": "commonjs", "target": "esnext", - "jsx": "preserve", - "lib": ["dom", "esnext"], + "declaration": false, + "moduleResolution": "node", + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "jsx": "react-jsx", "strict": true, + "resolveJsonModule": true, "noEmit": true, - "isolatedModules": true, - "esModuleInterop": true, - "noUnusedLocals": false, - "baseUrl": "./src" - }, - "exclude": ["node_modules", "public", ".cache"] + "noImplicitOverride": true + } }