The ScandiPWA out of the box comes with a very strict linter. It is here to ensure the quality and consistency of the code between projects. In some cases, the configured defaults might seem too strict, this guide is here to help developers configure to match their needs.
Some rules are our preference, some are "essential" to make sure the code you are writing is compatible with ScandiPWA's plugin architecture. The list of such rules can be found below.
scandipwaspecific rules can be found in
@scandipwa/eslint-plugin-scandipwa-guidelinesNPM package. To use it in your ESLint configuration, add the following fields to your declaration:
// Force @namespace comments in the code
// Use "__construct" instead of "constructor"
By default, ESLint is always enabled and check on every compilation. This ensures the quality of code before committing it (otherwise if checked on commit, the changes made are commonly not checked by the developer on a working site).
To disable the ESLint, the following configuration must be added to the ScandiPWA theme's
- Extend a completely different preset
- Add "overrides" to default configuration values
To change any of these, the ScandiPWA theme's
eslintConfigfields. For example: