From 8133f2e0fb0428e199bed4fd8400b0c222c1a1c0 Mon Sep 17 00:00:00 2001 From: Jace Date: Mon, 15 Jun 2020 13:13:57 -0700 Subject: [PATCH] Use affinityproject eslint and prettier configs and other tweaks --- generate | 4 +++- template/.eslintrc.js | 14 ++++---------- template/.prettierrc.js | 2 +- template/tsconfig-paths.js | 9 --------- template/tsconfig.build.json | 7 ------- template/tsconfig.json | 12 +++--------- 6 files changed, 11 insertions(+), 37 deletions(-) delete mode 100644 template/tsconfig-paths.js delete mode 100644 template/tsconfig.build.json diff --git a/generate b/generate index 89a1e80..0599a1b 100755 --- a/generate +++ b/generate @@ -66,7 +66,9 @@ cp -rvf "$GENERATOR_DIR"/template/* "$GENERATOR_DIR"/template/.* "$CLIENT_DIR/" pushd "$CLIENT_DIR" npm install --save axios '@types/axios' +npm install --save-dev '@affinityproject/eslint-config' '@affinityproject/prettier-config' '@typescript-eslint/eslint-plugin' '@typescript-eslint/parser' eslint eslint-config-prettier eslint-plugin-prettier prettier npx prettier --write ./src/**/*.ts -tsdx lint src test --fix +npm run lint -- src test --fix rm -f yarn.lock +rm -rf test npm run build diff --git a/template/.eslintrc.js b/template/.eslintrc.js index 5fb7698..2dffb58 100644 --- a/template/.eslintrc.js +++ b/template/.eslintrc.js @@ -1,14 +1,8 @@ module.exports = { + extends: ['@affinityproject/eslint-config'], rules: { - '@typescript-eslint/no-unused-vars': ['off'], - '@typescript-eslint/consistent-type-assertions': ['off'], - '@typescript-eslint/consistent-type-assertions': ['off'], - '@typescript-eslint/interface-name-prefix': [ - 'off', - { - prefixWithI: 'always', - }, - ], - '@typescript-eslint/no-namespace': ['off', {allowDeclarations: false, allowDefinitionFiles: false}], + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/ban-types': 'off', + 'no-unused-vars': 'off', }, } diff --git a/template/.prettierrc.js b/template/.prettierrc.js index 9edaa94..4a26882 100644 --- a/template/.prettierrc.js +++ b/template/.prettierrc.js @@ -1 +1 @@ -module.exports = require('@bloomprotocol/prettier-config') +module.exports = require('@affinityproject/prettier-config') diff --git a/template/tsconfig-paths.js b/template/tsconfig-paths.js deleted file mode 100644 index 0bd5adc..0000000 --- a/template/tsconfig-paths.js +++ /dev/null @@ -1,9 +0,0 @@ -const tsConfig = require('./tsconfig.json') -const tsConfigPaths = require('tsconfig-paths') - -// this is needed for paths to work when running files in the build folder -const baseUrl = './build' -tsConfigPaths.register({ - baseUrl, - paths: tsConfig.compilerOptions.paths, -}) diff --git a/template/tsconfig.build.json b/template/tsconfig.build.json deleted file mode 100644 index c1a0ab2..0000000 --- a/template/tsconfig.build.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "allowJs": true - }, - "include": ["src", "knexfile.ts"] -} diff --git a/template/tsconfig.json b/template/tsconfig.json index 1bd69fc..7653fad 100644 --- a/template/tsconfig.json +++ b/template/tsconfig.json @@ -1,5 +1,4 @@ { - "include": ["src", "types", "test"], "compilerOptions": { "target": "es5", "module": "esnext", @@ -7,7 +6,7 @@ "importHelpers": true, "declaration": true, "sourceMap": true, - "outDir": "build", + "rootDir": "./src", "strict": true, "noImplicitAny": true, "strictNullChecks": true, @@ -20,14 +19,9 @@ "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "moduleResolution": "node", - "baseUrl": ".", - "paths": { - "*": ["node_modules/*"], - ".*": ["src/*"], - "@src/*": ["src/*"] - }, "jsx": "react", "esModuleInterop": true, "allowSyntheticDefaultImports": true - } + }, + "include": ["src"] }