Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"root": true,
"parser": "@typescript-eslint/parser", // Allow ESLint to parse TypeScript
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended", // Uses recommended rules from @typescript-eslint
"plugin:@typescript-eslint/eslint-recommended", // Uses recommended rules from @typescript-eslint
// "prettier",
// "prettier/@typescript-eslint", // Disables ESLint rules that would conflict with Prettier
"plugin:prettier/recommended" // Links Prettier errors into ESLint errors
],
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": 2018, // Parse modern ECMAScript features
"sourceType": "module", // Allow module imports
"ecmaFeatures": {
"jsx": true
}
},
"ignorePatterns": ["node_modules", "**/*.test.*", "**/*.spec.*", "application"],
"rules": {
"for-direction": "warn", // Check for-loop increments counter
"getter-return": "error", // Enforce return statements in getters
"no-async-promise-executor": "error", // Disallow using an async function as a Promise executor
"no-await-in-loop": "error", // Disallow `await` inside of loops
"no-compare-neg-zero": "error", // Disallow comparing against -0
"no-cond-assign": "error", // Disallow conditional assignment
"no-constant-condition": "warn", // Disallow constant expressions in conditions
"no-console": "error", // Disallow the use of console commands
"no-control-regex": "error", // Disallow control characters in regex
"no-debugger": "error", // Disallow the use of `debugger`
"no-dupe-args": "error", // Disallow duplicate arguments in `function` definitions
"no-dupe-else-if": "error", // Disallow duplicate conditions in if-else chains
"no-dupe-keys": "error", // Disallow duplicate keys in object literals
"no-empty": "warn", // Disallow empty function blocks
"no-empty-character-class": "error", // Disallow empty character class in regular expressions
"no-ex-assign": "error", // Prevents destructive reassigning of exception errors
"no-extra-boolean-cast": "warn", // Disallows unnecessary boolean casts
"no-extra-parens": [
"error",
"all",
{
"returnAssign": true,
"nestedBinaryExpressions": false,
"ignoreJSX": "single-line",
"enforceForArrowConditionals": true,
"enforceForSequenceExpressions": true
}
],
"no-extra-semi": "warn", // Disallows additional semicolons
"@typescript-eslint/explicit-function-return-type": "off"
},
"noInlineConfig": false,
"settings": {
"react": {
"version": "detect"
}
},
"overrides": [
{
// Configure custom rules for files matching the specific pattern, using a global eslint and then extending it in specific eslints would be better, using where appropriate
"files": ["*.test.*", "*.spec.*"],
"rules": {
"no-unused-expressions": "warn"
}
}
]
}
3 changes: 0 additions & 3 deletions babel.config.js

This file was deleted.

13 changes: 13 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
displayName: 'web',
testMatch: ['<rootDir>/src/**/*.spec.{ts,tsx}'],
moduleDirectories: ['node_modules', 'src'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': 'test-file-stub',
'\\.(css|less)$': 'identity-obj-proxy',
},
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
}
24 changes: 8 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,31 @@
"typescript": "^3.7.5"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.4",
"@babel/plugin-proposal-export-namespace-from": "^7.8.3",
"@babel/plugin-proposal-object-rest-spread": "^7.8.3",
"@babel/preset-env": "^7.8.4",
"@babel/preset-es2015": "^7.0.0-beta.53",
"@babel/preset-react": "^7.8.3",
"@babel/preset-typescript": "^7.8.3",
"@types/jest": "^25.1.2",
"@types/lodash": "^4.14.149",
"@types/node": "^13.7.1",
"@types/reach__router": "^1.3.0",
"@types/react": "^16.9.19",
"@types/react-dom": "^16.9.5",
"@typescript-eslint/eslint-plugin": "^2.20.0",
"@typescript-eslint/parser": "^2.20.0",
"awesome-typescript-loader": "^5.2.1",
"babel-jest": "^25.1.0",
"babel-loader": "^8.0.6",
"babel-plugin-dynamic-import-node-babel-7": "^2.0.7",
"babel-preset-es2015": "^6.24.1",
"css-loader": "^3.4.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.18.3",
"html-webpack-plugin": "^3.2.0",
"husky": "^4.2.3",
"identity-obj-proxy": "^3.0.0",
"jest": "^25.1.0",
"mini-css-extract-plugin": "^0.9.0",
"path": "^0.12.7",
"prettier": "^1.19.1",
"pretty-quick": "^2.0.1",
"react-test-renderer": "^16.12.0",
"style-loader": "^1.1.3",
"tslint": "^6.0.0",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.1.0",
"typescript-tslint-plugin": "^0.5.5",
"ts-jest": "^25.2.1",
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
Expand Down
16 changes: 5 additions & 11 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"compileOnSave": true,
"compilerOptions": {
"noImplicitThis": true,
"jsx": "react",
Expand All @@ -19,24 +20,17 @@
"noUnusedLocals": true,
"pretty": true,
"declaration": true,
"plugins": [
{
"name": "typescript-tslint-plugin",
"configFile": "./tslint.json"
}
],
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"isolatedModules": true,
"isolatedModules": false,
"noEmit": true,
"typeRoots": ["node_modules/@types", "src/**/*.interface.ts"]
"typeRoots": ["node_modules/@types"]
},
"exclude": ["node_modules"],
"compileOnSave": true,
"include": ["./src/**/*", "**/*", "./**/*.d.ts"],
"exclude": ["node_modules", "**/*.spec.ts", "**/*.test.ts"],
"paths": {
"components": ["./src/components"]
"components": "./src/components"
},
"awesomeTypescriptLoaderOptions": {
"reportFiles": ["./src/**/*"]
Expand Down
Loading