Skip to content

Commit

Permalink
test: enable lint rules for typescript and react
Browse files Browse the repository at this point in the history
  • Loading branch information
waltjones committed Mar 9, 2022
1 parent 73f1277 commit 0a746f0
Show file tree
Hide file tree
Showing 5 changed files with 643 additions and 252 deletions.
33 changes: 33 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
env:
browser: true
es2022: true
jest: true
node: true
extends:
- eslint:recommended
- plugin:react/recommended
- prettier
- plugin:react-hooks/recommended
- plugin:jest/recommended
- plugin:jest-dom/recommended
parser: "@babel/eslint-parser"
plugins:
- "@babel"
- jest
- react
- react-hooks
- testing-library
overrides:
Expand All @@ -13,9 +23,32 @@ overrides:
- "**/?(*.)+(spec|test).[jt]s?(x)"
extends:
- "plugin:testing-library/react"
- files:
- "**/*.ts?(x)"
parser: "@typescript-eslint/parser"
parserOptions:
tsconfigRootDir: .
project: ['./tsconfig.json']
extends:
- eslint:recommended
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
- plugin:@typescript-eslint/recommended-requiring-type-checking
rules:
"@typescript-eslint/no-unused-vars":
- error
- varsIgnorePattern: "^_"
argsIgnorePattern: "^_"
# For compat with jest: https://typescript-eslint.io/rules/unbound-method/
"@typescript-eslint/unbound-method": "off"
"jest/unbound-method": "error"
rules:
quotes:
- error
- single
- avoidEscape: true
allowTemplateLiterals: true
indent: [error, 2]
settings:
react:
version: detect
8 changes: 1 addition & 7 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ module.exports = {
testEnvironment: 'jsdom',
globals: {
'ts-jest': {
tsconfig: {
esModuleInterop: true,
jsx: 'react-jsx',
module: 'commonjs',
strict: true,
target: 'esnext',
}
tsconfig: './tsconfig.json'
}
}
};
Loading

0 comments on commit 0a746f0

Please sign in to comment.