Last active
June 28, 2024 17:51
-
-
Save nathan-hyan/878d8e19c43cb94a789002c73d8a25c6 to your computer and use it in GitHub Desktop.
How to install ESLint with the new flat configuration + Prettier without dying
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"useTabs": false, | |
"semi": true, | |
"singleQuote": true, | |
"jsxSingleQuote": true, | |
"trailingComma": "es5", | |
"endOfLine": "lf" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We create the vite project first | |
npm create vite@latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
rules: { | |
"react/react-in-jsx-scope": "off", | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; | |
// ^ This is how we import the recommended configs | |
export default [ | |
// previous configs, | |
eslintPluginPrettierRecommended, // << This has to go at the end of the array... before the rules object | |
{ | |
rules: { | |
"react/react-in-jsx-scope": "off", | |
// ... | |
} | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ESLint installation | |
npm init @eslint/config@latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Installing prettier | |
npm install -D prettier eslint-plugin-prettier eslint-config-prettier |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment