-
Notifications
You must be signed in to change notification settings - Fork 46
Update linting in sub theme
Rémy Denton edited this page Aug 18, 2021
·
4 revisions
Before upgrading to the 4.x branches of Bolt, first update linting in your sub theme by taking the following steps:
fin composer update pega/pega_bolt_theme
fin fe-build
- Copy
.eslintrc.json
,.stylelintrc
, and.prettierrc
from the base theme to your sub theme (if they don't already exist). - If you have a
.eslintrc.yml
file in your subtheme, remove it. - If your project has a
scripts/cs/phpcs
script, replace the lineIGNORE='*/node_modules/*,*/dist/*'
withIGNORE='*/node_modules/*,*/dist/*,*.sass,*.js'
to prevent phpcs from improperly linting js and CSS files.
You can use the following commands to fix most issues automatically:
fin exec yarn eslint packages/**/*.js --fix
fin exec yarn stylelint packages/**/*.scss --fix
-
IMPORTANT: Linting may raise errors like the following:
These are a the result of some tricks in the theming system (see the docs for more details) and are not actually wrong. You should NOT remove the lines like
Unable to resolve path to module '@drupal(core/drupal)' import/no-unresolved
const Drupal = require('@drupal(core/drupal)');
at the top of your js files. Instead, ignore them from this linting rule like this (see components in pega_bolt_theme for examples):const Drupal = require('@drupal(core/drupal)'); // eslint-disable-line import/no-unresolved
- Smoke test the linting updates by rebuilding the front-end.
- If the build is sucessful, you should MR these linting updates now before beginning the 4.x upgrade so that linting issues can be reviewed in isolation.
- Basic A11y Checklist
- Get started with Bolt locally
- Bolt Specific Standards and Conventions
- How to save SVG graphics and SVG icons
- Upgrade to minor release
- Upgrade to 4.x
- Upgrade to 5.x
- Release Workflow
- VS Code Configuration
- Bolt Doc Writing Guide
- Prefixing Custom Attributes
- Standard Props for Passing Content in Twig
- Building Websites with Bolt in Drupal
- From Design Mockup to Code
- Override with Utility Classes