Fawwaz's Jest react configuration with testing library
MIT License
ESLint, Jest, TSconfig and Prettier rules for all of my personal projects. Feel free to use these conventions :-)
This repository contains set of ESLint, Jest, Typescript & Prettier configurations to be used in JavaScript and Typescript projects.
For ESLint there are two set configurations to be used to:
By using one or more of these packages, you can enforce the desired code styles for each type of project.
For more information on how to use each package and their specific configurations, please read the package's README by following the links below. You may also check the examples listed in Typical Configs to see how the packages may be combined for the most common scenarios.
For more information on how to use each package and their specific configurations, please read the package's README by following the links below. You may also check the examples listed in Typical Configs to see how the packages may be combined for the most common scenarios.
The base config is published as @isfawwaz/eslint-config-base
, check out its README to know how to use it.
There are several enhancer packages, which are intended to be used in conjunction with the base configuration:
@isfawwaz/eslint-config-babel
- If you are going to use Babel to transpile source code.@isfawwaz/eslint-config-jest
- If you are going to use Jest to develop tests.For Jest there are same with ESLint which have two set configurations to be used to, but unfortunely on current version only base configuration available.
The base config is published as @isfawwaz/jest-config-base
, check out its README to know how to use it.
For Typescript config there are two set configuration to be used to:
For Prettier config file, that only one config that can be used. check it out README.md
to know how to use it.
{
"root": true,
"env": {
"browser": true
},
"extends": [
"@isfawwaz/eslint-config-base/esm",
"@isfawwaz/eslint-config-babel",
"@isfawwaz/eslint-config-jest"
]
}
âšī¸ If your project is isomorphic / universal, you may want to enable the node
environment as well.
{
"root": true,
"env": {
"node": true
},
"extends": ["@isfawwaz/eslint-config-base/cjs/es2019", "@isfawwaz/eslint-config-jest"]
}
â ī¸ In the above example, we choose the es2019
version instead of the latest ECMAScript version because there's no Babel compilation and we are restricted to what the Node.js runtime supports. Please check node.green and select the most appropriate ECMAScript version based on the Node.js version you are targeting.
Note: This method only when you need to extend the configuration, import the file in a .prettierrc.js file and export the modifications, e.g:
// .prettierrc.js
module.exports = {
...require('@isfawwaz/prettier-config'),
singleQuote: false,
};
{
"extends": "@isfawwaz/tsconfig/react-library.json",
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
Thanks to @moxy/eslint-config for such amazing inspiration for me to create my version of config.