Icu 7083 add stylelint to admin (#1519)

* Added styelint to `ui/admin'

* refactor: 💡 quick refactor

Refactor attribute name back to original

✅ Closes: ICU-7083

* Update _notify.scss

for got to set the calling of the animation back in the selector

* refactor: 💡 quick refactor for stylelintrc file

possible pattern selector settings

* refactor: 💡 added rule for selector class pattern

Added rule for kebab-case, HDS, and CodeMirror

✅ Closes: ICU-7083

* Update app.scss

fixed linting errors.

* refactor: 💡 refactor stylelintrc

Simplify regex for `stylelintrc` and added
comments that details what
the regex is doing.

✅ Closes: ICU-7083

* Update ui/admin/.stylelintrc.js

Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>

Co-authored-by: Randall Morey <randall@randallmorey.com>
Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>
This commit is contained in:
authored and GitHub committed 2022-12-14 12:22:44 -05:00
1 parent 8a61c28254
commit c4a70e9e9e
7 files changed
+74 -389

No files matched your search

+1
View File
@@ -32,6 +32,7 @@ module.exports = {
'.eslintrc.js',
'.prettierrc.js',
'.template-lintrc.js',
'.stylelintrc.js',
'ember-cli-build.js',
'testem.js',
'blueprints/*/index.js',
-8
View File
@@ -1,8 +0,0 @@
files:
include: 'app/styles/**/*.s+(a|c)ss'
rules:
leading-zero: 0
mixins-before-declarations: 0
nesting-depth: 0
placeholder-in-extend: 0
property-sort-order: 0
+33
View File
@@ -0,0 +1,33 @@
'use strict';
module.exports = {
extends: ['stylelint-config-standard-scss', 'stylelint-config-prettier-scss'],
rules: {
// We oftentimes want to have long form properties for readability
'declaration-block-no-redundant-longhand-properties': null,
// This is just a personal preference unless the quotes are needed
// to escape special characters
'function-url-quotes': null,
// This is often limited by the DOM and we want to order our declarations by our own standard
'no-descending-specificity': null,
// -Webkit animation CSS for older browsers. Need a decision to remove `-webkit` syntax in
// favor of normal CSS
'property-no-vendor-prefix': null,
'at-rule-no-vendor-prefix': null,
// As a team we want to stick to using kebab-case as our selector class pattern, but there are a couple
// of exceptions in which we overrride CSS from addons like CodeMirror and HDS, in which they use
// pascal case and a double-kebab-case. This regex checks for all of those 3 patterns and won't fail
// lint check, but will fail if its any other pattern.
'selector-class-pattern': [
'(^([a-z][a-z0-9]*)(-{1,2}[a-z0-9]+)*$)|(^CodeMirror)',
{
message: (selector) =>
`Expected class selector "${selector}" to be kebab-case`,
},
],
},
};
+4 -5
View File
@@ -1,7 +1,6 @@
// This file is essentially a rip of the default ember notify styles with some minor tweaks for positioning.
// sass-lint:disable no-vendor-prefixes
@-webkit-keyframes 'ember-notify-show' {
@-webkit-keyframes ember-notify-show {
from {
left: -310px;
}
@@ -10,7 +9,7 @@
left: 0;
}
}
@keyframes 'ember-notify-show' {
@keyframes ember-notify-show {
from {
left: -310px;
}
@@ -19,7 +18,7 @@
left: 0;
}
}
@-webkit-keyframes 'ember-notify-hide' {
@-webkit-keyframes ember-notify-hide {
from {
left: 0;
}
@@ -28,7 +27,7 @@
left: -310px;
}
}
@keyframes 'ember-notify-hide' {
@keyframes ember-notify-hide {
from {
left: 0;
}
+9 -8
View File
@@ -1,4 +1,3 @@
// sass-lint:disable no-color-literals class-name-format
@use 'rose/variables/sizing';
@use 'rose/variables/media';
@use 'rose/utilities/type';
@@ -194,11 +193,11 @@
}
mark {
animation: fadeBackground 0.75s linear;
animation: fade-background 0.75s linear;
background-color: transparent;
color: inherit;
@keyframes fadeBackground {
@keyframes fade-background {
0% {
background-color: var(--action-subtler-1);
}
@@ -222,7 +221,7 @@
white-space: nowrap;
}
// Spinning animation for refresh button icon
// Spinning animation for refresh button icon
@media (prefers-reduced-motion: no-preference) {
.is-loading {
.rose-icon {
@@ -239,7 +238,7 @@
}
}
//onboarding quick setup styles
// onboarding quick setup styles
.choose-path {
display: block;
width: sizing.rems(xl) * 15;
@@ -416,7 +415,7 @@
.worker-auth-token {
align-items: flex-end;
display: flex;
gap: sizing.rems(m); // sass-lint:disable-line no-misspelled-properties
gap: sizing.rems(m);
}
.worker-success {
@@ -427,7 +426,7 @@
> div {
align-items: center;
display: flex;
gap: sizing.rems(xs); // sass-lint:disable-line no-misspelled-properties
gap: sizing.rems(xs);
p {
margin-bottom: sizing.rems(xxs);
@@ -484,7 +483,7 @@
&.has-icon {
.flight-icon {
position: absolute;
transform: translatey(sizing.rems(xl) - sizing.rems(xs));
transform: translateY(sizing.rems(xl) - sizing.rems(xs));
}
.hds-form-helper-text,
@@ -577,6 +576,7 @@
left: 50%;
position: absolute;
top: 50%;
// centers message with editor body and gutter
transform: translate(-50%, -50%);
z-index: 1;
@@ -587,6 +587,7 @@
border: sizing.rems(xxxxs) solid var(--ui-gray);
border-radius: sizing.rems(xxxs);
box-shadow: 0 sizing.rems(xxs) sizing.rems(xxs) var(--button-shadow);
// using ui-gray directly so it does not change when
// user is in dark mode since the secret editor
// does not change theme colors between light and dark
+5 -3
View File
@@ -21,7 +21,8 @@
"lint:hbs": "ember-template-lint .",
"lint:hbs:fix": "ember-template-lint . --fix",
"lint:js": "eslint .",
"lint:sass": "sass-lint -v -q",
"lint:sass": "stylelint 'app/styles/**/*.scss'",
"lint:sass:fix": "stylelint 'app/styles/**/*.scss' --fix",
"format": "npm-run-all format:*",
"format:hbs": "prettier --write 'app/**/*.hbs'",
"format:js": "prettier --write '{app,config,stories,tests}/**/*.js' *.js",
@@ -91,8 +92,9 @@
"qunit": "^2.17.2",
"qunit-dom": "^2.0.0",
"rose": "*",
"sass": "^1.55.0",
"sass-lint": "^1.13.1",
"stylelint": "^14.14.0",
"stylelint-config-prettier-scss": "^0.0.1",
"stylelint-config-standard-scss": "^6.0.0",
"sinon": "^14.0.0",
"webpack": "^5"
},