From 2db12b866bdf511eef3ef463afd99e1792226517 Mon Sep 17 00:00:00 2001 From: Nathan de Balthasar Date: Thu, 23 Nov 2023 16:46:43 +0100 Subject: [PATCH] fix: add missing files --- .eslintignore | 11 +++++++++++ .eslintrc.js | 42 ++++++++++++++++++++++++++++++++++++++++++ .husky/.gitignore | 1 + .husky/pre-commit | 5 +++++ .lintstagedrc.js | 19 +++++++++++++++++++ .nvmrc | 1 + .prettierrc | 6 ++++++ 7 files changed, 85 insertions(+) create mode 100644 .eslintignore create mode 100644 .eslintrc.js create mode 100644 .husky/.gitignore create mode 100644 .husky/pre-commit create mode 100644 .lintstagedrc.js create mode 100644 .nvmrc create mode 100644 .prettierrc diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..f302f38 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,11 @@ +node_modules +amplify +tests +public +aws-video-exports.js +aws-exports.js +src/models +.cache +.github +.idea +.vscode diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..0a08902 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,42 @@ +module.exports = { + parser: "@typescript-eslint/parser", // Specifies the ESLint parser + extends: [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended", + "prettier", + ], + settings: { + react: { + version: "detect", + }, + }, + env: { + browser: true, + node: true, + es6: true, + }, + plugins: ["@typescript-eslint", "react"], + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features + sourceType: "module", // Allows for the use of imports + }, + rules: { + "react/prop-types": "off", // Disable prop-types as we use TypeScript for type checking + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + }, + overrides: [ + // Override some TypeScript rules just for .js files + { + files: ["*.js"], + rules: { + "@typescript-eslint/no-var-requires": "off", // + }, + }, + ], +}; diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 0000000..c9cdc63 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..7c788bb --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,5 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm run pre-commit +#exit 1 diff --git a/.lintstagedrc.js b/.lintstagedrc.js new file mode 100644 index 0000000..584a6d7 --- /dev/null +++ b/.lintstagedrc.js @@ -0,0 +1,19 @@ +const { ESLint } = require('eslint') +const filterAsync = require('node-filter-async').default + +const eslintCli = new ESLint() + +const removeIgnoredFiles = async (files) => { + const filteredFiles = await filterAsync(files, async (file) => { + const isIgnored = await eslintCli.isPathIgnored(file) + return !isIgnored + }) + return filteredFiles.join(' ') +} + +module.exports = { + '**/*.{ts,tsx,js,jsx}': async (files) => { + const filesToLint = await removeIgnoredFiles(files) + return [`eslint --max-warnings=0 ${filesToLint}`] + }, +} diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..d09e7b5 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v16.20.0 \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..e74ed9f --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "trailingComma": "es5", + "tabWidth": 4, + "semi": false, + "singleQuote": true +}