Linting helps find errors earlier.
Adopting a common style guide stops on-going debates about code style.
Linting and code formatting can be added to projects in many ways:
- Live feedback in text editor that validates code as it is written and provides immediate feedback
- CLI integration that can validate and format code via commands executed from the command line
- CI/CD integration that can validate code as part of the build process
ESLint helps find and fix problems in JavaScript and TypeScript code. It exposes bugs and style errors, as well as offering opinions about syntax.
Django recommends ESLint when working with JavaScript files, and also recommends installing an ESLint plugin into your text editor.
We've added the official ESLint plugin for Vue.js: eslint-plugin-vue. This will specifically expose syntax errors, the wrong uses of Vue.js Directives, and violations of the Vue.js Style Guide.
ESLint will run as a GitHub Action on every pull request. If you want to run ESLint locally, you can do so by running the following commands from ./solution
:
// lint the frontend JS
make eslint-frontend
// lint CDK TS
make eslint-cdk
This will return a list of errors and warnings that need to be fixed.
The best way to start using ESLint is to integrate it into your text editor so you get immediate feedback while writing code. You can manually fix these alerts yourself, or use CodeActions to automatically fix all fixable problems.
Typical workflow for using ESLint in your text editor:
- Write code
- See real-time validation alerts
- Manually change code to satisfy linter and make validation alerts disappear OR
- Execute ESLint code actions/keyboard shortcuts to automatically fix and format entire file
ESLint official Integrations page
Configuring ESLint and Prettier for Vim with ALE