feat(linting): add `stylelint` and add check to lint script

This commit is contained in:
Thomas Rupprecht 2023-09-06 20:30:40 +02:00
parent db0faab4db
commit a4a0db71c5
6 changed files with 864 additions and 32 deletions

26
.stylelintrc.cjs Normal file
View File

@ -0,0 +1,26 @@
module.exports = {
extends: ["stylelint-config-standard"],
plugins: ["stylelint-plugin-defensive-css", "stylelint-plugin-logical-css"],
rules: {
"custom-property-empty-line-before": null,
"color-hex-length": "long",
"plugin/use-defensive-css": [true, {
"accidental-hover": false,
"background-repeat": true,
"custom-property-fallbacks": false,
"flex-wrapping": false,
"scroll-chaining": false,
"vendor-prefix-grouping": true
}],
"plugin/use-logical-properties-and-values": [true, {
"severity": "warning",
"disable-auto-fix": true,
"ignore": ["overflow-y", "overflow-x"]
}],
"plugin/use-logical-units": [true, {
"severity": "warning",
"disable-auto-fix": true,
"ignore": ["dvh", "dvw"]
}]
}
};

View File

@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
- Add commitlint to enforce commit message format
- Update the changelog automatically on every commit
- Improve colors, refactor css, support rtl lang
- Add `stylelint` and add check to lint script
### 🐛 Bug Fixes
@ -18,6 +19,7 @@ All notable changes to this project will be documented in this file.
- Improve browser-polyfill inject
- Move homepage url to config
- Use `storage.session` instead of `storage.local`
### 📚 Documentation
@ -33,6 +35,8 @@ All notable changes to this project will be documented in this file.
- Update @commitlint/{cli,config-conventional}
- Update @commitlint/{cli,config-conventional}
- Update @commitlint/{cli,config-conventional,cz-commitlint}
- Update @commitlint/{cli,config-conventional,cz-commitlint}, git-cliff
## \[[0.9.2](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.9.2)] - 2023-05-24

854
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,10 @@
"commitizen": "^4.3.0",
"git-cliff": "^1.3.0",
"husky": "^8.0.3",
"stylelint": "^15.10.3",
"stylelint-config-standard": "^34.0.0",
"stylelint-plugin-defensive-css": "^0.8.1",
"stylelint-plugin-logical-css": "^0.13.2",
"web-ext": "^7.6.2"
},
"scripts": {
@ -21,7 +25,9 @@
"uninject-browser-polyfill": "sed -i -r \"s#import '\\./browser-polyfill\\.js';#// \\[INJECT-BROWSER-POLYFILL]#\" src/*.js",
"copy-version": "sed -i 's/^\t\"version\": \".*\",$/\t\"version\": \"'$(rg '^\t\"version\": \"(.+)\",$' -r '$1' < package.json)'\",/' src/manifest.json",
"update-changelog": "npm exec git-cliff > CHANGELOG.md",
"lint": "web-ext lint -w",
"lint": "npm run lint:web-ext && npm run lint:css",
"lint:web-ext": "web-ext lint -w",
"lint:css": "stylelint \"src/*.css\"",
"test": "echo \"Error: no test specified\" && exit 0",
"watch:firefox": "web-ext run -t firefox-desktop",
"watch:firefox-android": "web-ext run -t firefox-android",

View File

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* stylelint-disable */
/* Global */
html,
body {

View File

@ -48,7 +48,7 @@ body {
padding: 6px 12px;
color: var(--color);
background-color: var(--background);
font-family: 'Nunito Sans';
font-family: 'Nunito Sans', sans-serif;
}
section.no-padding {