Configuring ESLint
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.
Essential rules
All scandipwa
specific rules can be found in @scandipwa/eslint-plugin-scandipwa-guidelines
NPM package. To use it in your ESLint configuration, add the following fields to your declaration:
How to disable ESLint
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 package.json
file:
Learn more about ignorePatterns
in official ESLint docs.
How to change ESlint configurations
You have two main options to change (learn about more options in the official ESLint guide):
Extend a completely different preset
Add "overrides" to default configuration values
To change any of these, the ScandiPWA theme's package.json
file's eslintConfig
fields. For example:
Last updated