Skip to content

ESLint config for React based TypeScript projects

License

Notifications You must be signed in to change notification settings

tisoap/eslint-config-ts-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@tisoap/eslint-config-ts-react

ESLint config for React based TypeScript projects.

Rules

This config assumes that your project uses:

For the full list of rules, check the .eslintrc.js file in this repo.

Installation & Usage

With NPM:

npm install --save-dev eslint typescript @tisoap/eslint-config-ts-react @shopify/eslint-plugin @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import eslint-plugin-jest-dom eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-react-prefer-function-component eslint-plugin-sonarjs eslint-plugin-testing-library eslint-plugin-unicorn

With Yarn:

yarn add -D eslint typescript @tisoap/eslint-config-ts-react @shopify/eslint-plugin @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import eslint-plugin-jest-dom eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-react-prefer-function-component eslint-plugin-sonarjs eslint-plugin-testing-library eslint-plugin-unicorn

.eslintrc configuration:

module.exports = {
	parserOptions: {
		// Replace with the path to your project's tsconfig file
		project: './tsconfig.json'
	},
	extends: ['@tisoap/eslint-config-ts-react']
}

Usage With Prettier

You can skip this section if you don't plan on using Prettier on your project.

Install the plugin and config:

With NPM:

npm install prettier eslint-plugin-prettier eslint-config-prettier --save-dev

With Yarn:

yarn add -D prettier eslint-plugin-prettier eslint-config-prettier

Update your .eslintrc configuration:

module.exports = {
	parserOptions: {
		project: ['./tsconfig.json']
	},
	plugins: ['prettier'],
	extends: ['@tisoap/eslint-config-ts-react', 'plugin:prettier/recommended'],
	rules: {
		'prettier/prettier': ['error', {}, { usePrettierrc: true }]
	}
}

Add a .prettierrc file with your configurations.

License

This project is licensed under the MIT License.

Support

Liked this project and want to show your support? Buy me a coffee:

ko-fi

About

ESLint config for React based TypeScript projects

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published