Skip to content

Instantly share code, notes, and snippets.

@MaffooBristol
Last active December 11, 2021 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaffooBristol/11f37ae6133debc9045c5a932994b96f to your computer and use it in GitHub Desktop.
Save MaffooBristol/11f37ae6133debc9045c5a932994b96f to your computer and use it in GitHub Desktop.
React + Typescript + Cypress + Eslint config
plugins:
- react
- '@typescript-eslint'
- '@typescript-eslint/eslint-plugin'
- cypress
- jest
extends:
- eslint:recommended
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
- plugin:@typescript-eslint/recommended-requiring-type-checking
- plugin:react/recommended
- plugin:react-hooks/recommended
- plugin:jest/recommended
- airbnb
- airbnb-typescript
parser: '@typescript-eslint/parser'
parserOptions:
ecmaFeatures:
jsx: true
ecmaVersion: 12
sourceType: module
project: ['tsconfig.json']
ignorePatterns: ["*.test.*", "node_modules/"]
rules:
space-before-function-paren: 2
brace-style: [2, 'stroustrup']
arrow-body-style: 0
no-underscore-dangle: 0
class-methods-use-this: 1
consistent-return: 0
'@typescript-eslint/no-unused-vars': 1
no-bitwise: 0
no-plusplus: 0
linebreak-style: 0
arrow-parens: [2, 'always']
no-useless-escape: 0
curly: [2, 'all']
no-lonely-if: 1
semi: 2
max-len: [1, { code: 120, ignoreComments: true }]
prefer-destructuring: 1
lines-between-class-members: 0
object-curly-newline: 0
indent: 2
jsx-a11y/anchor-is-valid: [ 'error', {
components: [ 'Link' ],
specialLink: [ 'to' ]
}]
jsx-a11y/click-events-have-key-events: 0
jsx-a11y/no-static-element-interactions: 0
jsx-a11y/no-noninteractive-tabindex: 0
react/prefer-stateless-function: 1
react/no-unused-state: 1
react/state-in-constructor: [1, "never"]
react/jsx-one-expression-per-line: 0
react/prop-types: 0
react/jsx-indent: 1
react/jsx-props-no-spreading: 0
import/no-extraneous-dependencies: ["error", {"devDependencies": ["test/**/*.js", "**/*.test.js", "**/*.test.jsx", "**/setupTests.js"]}]
jsx-a11y/label-has-associated-control: [ 2, {
depth: 1,
}]
react/forbid-component-props: ["warn", {"forbid": ["style", "className"]}]
react/forbid-dom-props: ["warn", {"forbid": ["style", "className"]}]
react/jsx-sort-props: ["error", {"callbacksLast": true, "reservedFirst": true, "shorthandFirst": true, "noSortAlphabetically": true}]
id-blacklist: [1, "data", "err", "e", "cb", "callback", "response"]
react-redux/prefer-separate-component-file: 0
react-hooks/rules-of-hooks: 2
react-hooks/exhaustive-deps: 1
import/prefer-default-export: 0
import/no-absolute-path: 0
max-lines: [1, 300]
react/no-unescaped-entities: ["error", {"forbid": [">", "}"]}]
env:
browser: true
es2021: true
jest/globals: true
node_modules/
dist/
*.swp
*.ORIG
*.REMOTE
.cache/
coverage-ts/
cypress/videos
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
};
{
"name": "eslint-typescript-react-cypress",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test:check": "tsc --noEmit",
"test:cypress": "cypress run",
"test:lint": "eslint src",
"test:unit": "jest",
"test": "run-p test:**"
},
"author": "",
"license": "ISC",
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.0",
"@babel/preset-typescript": "^7.16.0",
"@types/cypress": "^1.1.3",
"@types/enzyme": "^3.10.10",
"@types/jest": "^27.0.2",
"@types/react": "^17.0.33",
"@types/react-dom": "^17.0.10",
"@typescript-eslint/eslint-plugin": "^5.3.0",
"@typescript-eslint/parser": "^5.3.0",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.5",
"babel-jest": "^27.3.1",
"cypress": "^8.5.0",
"enzyme": "^3.11.0",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-airbnb-typescript": "^16.1.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jest": "^25.2.2",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-react-hooks": "^4.2.0",
"jest": "^27.3.1",
"npm-run-all": "^4.1.5",
"parcel": "^2.0.0-nightly.620",
"ts-jest": "^27.0.7",
"typescript": "^4.4.3"
}
}
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"lib": [
"ESNext",
"DOM"
],
"jsx": "react",
"sourceMap": true,
"strict": true,
"moduleResolution": "node",
"baseUrl": "./src",
"paths": {
"~/*": [ "./*" ]
},
"typeRoots": [
"node_modules/@types"
],
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
"include": [
"src/**/*",
"cypress/**/*",
"*.js"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment