Problem/Motivation

yarn lint:css and yarn lint:js commands are not working properly.

Proposed resolution

- We need to follow coding standards from drupal core, so add stylelint/eslint/prettier configs from core into the theme.
- Fix and recompile all styles/scripts.

CommentFileSizeAuthor
#2 3125908-2.patch821.54 KBkostyashupenko

Comments

kostyashupenko created an issue. See original summary.

kostyashupenko’s picture

Assigned: kostyashupenko » Unassigned
Priority: Normal » Major
Status: Needs work » Needs review
StatusFileSize
new821.54 KB

1. Added .eslintignore, .eslintrc.json, .eslintrc.passing.json, .prettierrc.json and .stylelintrc.json configs to theme. It is fully based on drupal core configs.
2. Fixed absolutely all errors and warnings of all css/js. 99% of those errors were related to the order/whitespaces/linebreaks, for 1% of other errors/warnings i did some changes in code manually, like: move js function on top, or replace == by ===, or replace function () {} by () => {} or smth like this. It was minor changes i did, so i tried to not break anything.

Now no errors in code:

$ yarn lint:css && yarn lint:js
yarn run v1.22.4
$ stylelint "css/src/**/*.css"
✨  Done in 1.77s.
yarn run v1.22.4
$ node ./node_modules/eslint/bin/eslint.js .
Warning: React version was set to "detect" in eslint-plugin-react settings, but the "react" package is not installed. Assuming latest React version for linting.
✨  Done in 1.77s.

What was additionally done:
1. Removed package-lock.json - we don't need it. We have and use yarn.lock
2. Added cool command yarn lint-fix which will fix your code automatically, based on linters. Updated also README.md. So before your patch you just need to run yarn lint-fix

mherchel’s picture

This is amazing! Thank for the hard work.

I committed the config files, and then the CSS changes.

I have yet to commit the JS changes... I want to QA those more thoroughly.

I'll leave this in needs review until I do the review of the JS

mherchel’s picture

Status: Needs review » Fixed

Committed earlier today!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.