A CLI to simplify React ESLint setup. I built this CLI since I felt reinventing the wheel of ESLint for React is quite a repeated process.
Spoiler Alert!!!😜 - I am a Newbie to bash script. Please forgive me for the worst syntax. Also, feel free to contribute to improve it.
- Linux
- macOS
- Windows(only with WSL/CMDER).Read this to install WSL https://www.thewindowsclub.com/how-to-run-sh-or-shell-script-file-in-windows-10
-
Navigate to your React project
cd <react_project>
-
Run the below command
exec 3<&1;bash <&3 <(curl https://raw.githubusercontent.com/msgtobala/RESP-CLI/master/resp.sh 2> /dev/null)
-
Select your configurations
- Package Manager - npm/yarn
- ESLint format - .js/.json
- Style guide - Standard/Airbnb/Google
- Prettier - Yes/No
- JSS Linting - Yes/No
-
That's it. Your ESLint is ready. Look for
eslintrc
,stylelintrc
,prettierrc
files in the project root directory.
- eslint
- eslint-plugin-react
- eslint-config-airbnb
- eslint-plugin-import
- eslint-plugin-jsx-a11y
- eslint-plugin-react-hooks
- eslint-config-google
- eslint-config-standard
- eslint-plugin-node
- eslint-plugin-promise
- prettier
- eslint-config-prettier
- eslint-plugin-prettier
- stylelint
- stylelint-config-recommended
- stylelint-config-styled-components
- stylelint-processor-styled-components
"env": {
"browser": true,
"es2021": true,
"commonjs": true
},
"extends": [
"standard",
"plugin:prettier/recommended",
"prettier/react"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error"
}
{
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all"
}
{
"extends": "stylelint-config-recommended",
"rules": {}
}
Read how I created this CLI https://balajisblog.com/i-created-a-cliresp-cli-for-eslint-react/
Read the detailed article on configuring ESLint for React https://balajisblog.com/adding-eslint-to-js-and-react/