NOTE: if the install fails with peer dependency errors, add --legacy-peer-deps to the end of the command above and try again.
3. ESLint 9 and later use a “flat config” file instead of the old .eslintrc.json. Create a file called eslint.config.js in the root of your project (next to package.json) and paste in the following:
const { FlatCompat } = require("@eslint/eslintrc");
const js = require("@eslint/js");
const globals = require("globals");
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});
module.exports = [
js.configs.recommended,
...compat.extends("airbnb", "airbnb-typescript", "plugin:prettier/recommended"),
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
rules: {
"prettier/prettier": "warn",
},
},
];
4. Open the project in VSCode using this command: code . (notice the . after code). 5. Create a new file in VSCode called test.js 6. Click the ESLint item in the status bar to check for errors. If there are errors, work with your fellow interns (and Google the errors) to try and resolve them. Bear in mind you may need to restart VSCode to see the effect of changes, such as new npm installs. 7. Type console.log(‘hi’) in the test.js file and then press the Enter key twice. 8. You should get a warning (yellow squiggly line) for the console warning, including which ESLint rule is causing it.
Note: The warning about the console statement occurs because completed apps should not contain console statements. If a console statement is necessary for your app, you can try the “quick fix” at the bottom of the window that pops up when you mouse over. If you find yourself ignoring certain rules a lot, you can update the rules in eslint.config.js.
Bask in the joy of ESLint and Prettier!
Here’s a cheat sheet . While it takes more time in the beginning to learn and remember keyboard shortcuts, they can make you so much more efficient once you’ve learned them. It’s well worth taking the time and effort! A biased list of “most useful shortcuts”: 1. Ctrl + D to select next instance of selection (to edit multiple instances of a term at once) 2. Ctrl + L to select all instances of selection (great for updating every instance of a variable name at once, replacing single quotes with double-quotes, removing newlines, etc) 3. Ctrl + click on a variable/function name to go to its definition (even if it’s in another file!) 4. Ctrl + P to search for a file in the project 5. Ctrl + shift + P to enter a VSCode command 6. Ctrl + shift + F to find a term in all files (and replace, by clicking turndown arrow next to search box) 7. Alt + up arrow / Alt + down arrow to move line with cursor up or down 8. Alt + shift + up arrow / Alt + shift + down arrow to copy line with cursor up or down 9. **Ctrl + ] / Ctrl + [**to indent / outdent line (or selection) 10. Ctrl + / to comment / uncomment line (or selection) 11. Ctrl + G go to a specific line number (option + G/ G on mac) 12. Ctrl + T jump to a symbol 13. Ctrl + B to hide or show the side bar 14. Alt + shift + F to format document 15. Ctrl + K, Ctrl + F to format selection 16. Ctrl + K, W to close all saved windows 17. **Ctrl + **to add new editor side-by-side And a few keyboard shortcuts that aren’t VSCode, but well worth knowing: 1. Alt + Tab to switch applications/windows in Windows 2. Up arrow to see and re-use previous commands in Linux 3. Ctrl + shift + T to reopen a tab that you just closed 4. Alt + right arrow / Alt + left arrow to skip ahead / back one word 5. Double-click to select word 6. Triple-click to select line Do you have other keyboard shortcuts you love? Share with the rest of the interns via Slack.