I am new to web development, and I have never seen tags closed by {" "}. Why is that?
I have a React project created with the Create React App: https://reactjs.org/docs/create-a-new-react-app.html#create-react-app
I have my project set up with ESLint, Prettier, and Flow using VSCode as my editor. I followed this when setting up my project: https://medium.com/js-imaginea/setup-eslint-prettier-and-flow-in-vscode-a3fd6a48b70a
Here are my VSCode Extensions:
- Beautify
- Editor Config for VS Code
- ESLint
- Flow Language Support
- Prettier - Code formatter
Here is my .eslint.json:
{
"env": {
"browser": true,
"es6": true
},
"extends": [
"eslint:recommended",
"prettier",
"plugin:prettier/recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"react",
"prettier"
],
"rules": {
"prettier/prettier": "error",
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1,
"react/react-in-jsx-scope": 1
}
}
Here is my VSCode Settings:
{
"editor.formatOnSave": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"explorer.confirmDragAndDrop": false,
"explorer.confirmDelete": false,
"terminal.integrated.cursorStyle": "line",
"terminal.integrated.enableBell": true,
"dart.flutterCreateIOSLanguage": "swift",
"dart.flutterCreateAndroidLanguage": "kotlin",
"eslint.autoFixOnSave": true,
"editor.suggestSelection": "first",
"window.zoomLevel": 1,
"prettier.eslintIntegration": true,
"terminal.integrated.shell.osx": "/bin/bash",
"eslint.alwaysShowStatus": true,
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
"files.autoSave": "off",
"editor.tabSize": 2,
"editor.detectIndentation": false,
"prettier.jsxBracketSameLine": true,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": true,
"prettier.jsxSingleQuote": true,
}
Normally, I thought elements were closed like so:
<h1>Hello World!</h1>
But, something happening with ESLint, Prettier, and/or Flow that's formatting it like this (on save):
<h1> Hello World! </h1>{" "}
I don't know what the
{" "}
is. It also adds spaces around the string inside. Is this the right way of formatting? If not, how do I go about removing it? Whenever I save my project, it adds that to the end of an element.