Linting is the process of analysing code for potential errors and flagging them to the developer.
- 1. Linting
npm run lint:styles
- Lints scss files via sass-lint.
- Flags sass errors up in terminal.
- If you have the Sass lint VSCode plugin or your code editor's equivalent, then the issues will flag up in your code editor too.
{root}/src/assets/sass/**/*.scss
{root}/src/**/*.scss
The config files are located at:
{root}/sass-lint.yml
(configures the sass lint rules){root}/gulp-tasks/lint-styles.js
(gulp task config)
npm run lint:templates
- Lints html files via htmlhint.
- Flags errors up in terminal.
- Lints html files to ensure correct accessibility tags are used, these are up to WCAG2AA standards.
- Produces a folder at
{root}/\_accessibility-logs/
which contains a directory structure exactly the same as the projects{root}src/
directory. Within these folders is a json file which shows the accessibility errors/warnings for the html file referenced at the top of the file.
{root}/build/**/*.html
The config files are located at:
{root}/.htmlhintrc
(general formatting of html files e.g. unique ids, attributes in lower case, tag names match){root}/gulp-tasks/lint-templates.js
(gulp task config)
npm run lint:scripts
- Lints javascript files via ESLint to airbnb-base standards.
- The lint errors are flagged up within the terminal or if you have an ESLint plugin within your code editor they will flag up within your editor of choice.
{root}/src/assets/js/wmn.js
{root}/src/**/*.js
**/*.min.js
are ignored for linting as these files are presumed to have already been linted, mangled and minified.
The config files are located at:
{root}/.eslintrc.json
(configuring how the linting should work){root}/.eslintignore
(controlling what files should be ignored){root}/.prettierrc
(general format of files e.g. spacing, single quotes/double quotes){root}/.prettierignore
(files prettier should ignore){root}/gulp-tasks/lint-scripts.js
(gulp task config)
npm run lint:all
npm run lint:styles
(lint styles)npm run lint:templates
(lint templates)npm run lint:scripts
(lint scripts)