1
0
mirror of https://github.com/jenil/chota.git synced 2023-08-10 21:13:07 +03:00

Jenil/linter (#92)

* add linter and format files

* remove custom scrollbar css

* add caniuse

* add stylelint to test cmd

* revert test file change
This commit is contained in:
Jenil Gogari 2023-03-20 23:57:54 -04:00 committed by GitHub
parent a0514001db
commit 1430bfe73a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 1574 additions and 884 deletions

1
.gitignore vendored
View File

@ -80,7 +80,6 @@ typings/
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/

12
.stylelintrc Normal file
View File

@ -0,0 +1,12 @@
{
"extends": [
"stylelint-config-standard",
"stylelint-config-prettier"
],
"ignorePath": [
"dist/**"
],
"rules": {
"custom-property-pattern": null
}
}

View File

@ -211,6 +211,8 @@ GEM
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.16.3)
nokogiri (1.13.10-arm64-darwin)
racc (~> 1.4)
nokogiri (1.13.10-x86_64-linux)
racc (~> 1.4)
octokit (4.25.1)
@ -253,6 +255,8 @@ GEM
zeitwerk (2.6.0)
PLATFORMS
arm64-darwin-21
arm64-darwin-22
x86_64-linux
DEPENDENCIES

175
dist/chota.css vendored
View File

@ -1,8 +1,8 @@
/*! chota.css v0.8.1 | MIT License | github.com/jenil/chota */
:root {
--bg-color: #ffffff;
--bg-color: #fff;
--bg-secondary-color: #f3f3f6;
--color-primary: #14854F;
--color-primary: #14854f;
--color-lightGrey: #d2d6dd;
--color-grey: #747681;
--color-darkGrey: #3f4144;
@ -11,10 +11,10 @@
--grid-maxWidth: 120rem;
--grid-gutter: 2rem;
--font-size: 1.6rem;
--font-color: #333333;
--font-family-sans: -apple-system, BlinkMacSystemFont, Avenir, "Avenir Next",
"Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans",
"Droid Sans", "Helvetica Neue", sans-serif;
--font-color: #333;
--font-family-sans: -apple-system, "BlinkMacSystemFont", "Avenir",
"Avenir Next", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
"Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
--font-family-mono: monaco, "Consolas", "Lucida Console", monospace;
}
html {
@ -22,32 +22,23 @@ html {
box-sizing: border-box;
font-size: 62.5%;
line-height: 1.15;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
-moz-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
text-size-adjust: 100%;
}
*, *:before, *:after {
*,
*::before,
*::after {
-webkit-box-sizing: inherit;
box-sizing: inherit;
}
* {
scrollbar-width: thin;
scrollbar-color: var(--color-lightGrey) var(--bg-primary);
}
*::-webkit-scrollbar {
width: 8px;
}
*::-webkit-scrollbar-track {
background: var(--bg-primary);
}
*::-webkit-scrollbar-thumb {
background: var(--color-lightGrey);
}
body {
background-color: var(--bg-color);
line-height: 1.6;
font-size: var(--font-size);
color: var(--font-color);
font-family: "Segoe UI", "Helvetica Neue", sans-serif; /*fallback*/
font-family: "Segoe UI", "Helvetica Neue", sans-serif; /* fallback */
font-family: var(--font-family-sans);
margin: 0;
padding: 0;
@ -59,7 +50,7 @@ h4,
h5,
h6 {
font-weight: 500;
margin: 0.35em 0 0.7em 0;
margin: 0.35em 0 0.7em;
}
h1 {
font-size: 2em;
@ -136,7 +127,6 @@ tt {
}
code,
kbd {
padding: 0 0.4rem;
font-size: 90%;
white-space: pre-wrap;
border-radius: 4px;
@ -202,7 +192,7 @@ iframe {
}
.col,
[class*=" col-"],
[class^='col-'] {
[class^="col-"] {
margin: 0 calc(var(--grid-gutter) / 2) calc(var(--grid-gutter) / 2);
}
.col-1 {
@ -284,7 +274,7 @@ iframe {
.col,
[class*="col-"],
[class^='col-'] {
[class^="col-"] {
-webkit-box-flex: 0;
-ms-flex: 0 1 100%;
flex: 0 1 100%;
@ -469,7 +459,7 @@ legend {
font-size: 0.8em;
letter-spacing: 0.1rem;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="color"]):not([type="button"]):not([type="reset"]),
input:not([type="checkbox"], [type="radio"], [type="submit"], [type="color"], [type="button"], [type="reset"]),
select,
textarea,
textarea[type="text"] {
@ -483,42 +473,15 @@ textarea[type="text"] {
display: block;
width: 100%;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="color"]):not([type="button"]):not([type="reset"]):not(:disabled):hover,
select:hover,
textarea:hover,
textarea[type="text"]:hover {
border-color: var(--color-grey);
}
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="color"]):not([type="button"]):not([type="reset"]):focus,
select:focus,
textarea:focus,
textarea[type="text"]:focus {
outline: none;
border-color: var(--color-primary);
-webkit-box-shadow: 0 0 1px var(--color-primary);
box-shadow: 0 0 1px var(--color-primary);
}
input.error:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="color"]):not([type="button"]):not([type="reset"]),
textarea.error {
border-color: var(--color-error);
}
input.success:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="color"]):not([type="button"]):not([type="reset"]),
textarea.success {
border-color: var(--color-success);
}
select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: #f3f3f6 no-repeat 100%;
background-size: 1ex;
background-origin: content-box;
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='40' fill='%23555'><polygon points='0,0 60,0 30,40'/></svg>");
}
[type="checkbox"],
[type="radio"] {
width: 1.6rem;
height: 1.6rem;
}
/* BUTTONS */
.button,
[type="button"],
[type="reset"],
@ -540,27 +503,16 @@ button {
display: inline-block;
cursor: pointer;
}
.grouped {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.grouped > *:not(:last-child) {
margin-right: 16px;
}
.grouped.gapless > * {
margin: 0 0 0 -1px !important;
border-radius:0 !important;
}
.grouped.gapless > *:first-child {
margin: 0 !important;
border-radius:4px 0 0 4px !important;
}
.grouped.gapless > *:last-child {
border-radius:0 4px 4px 0 !important;
}
.button + .button {
margin-left: 1rem;
.button.primary,
.button.secondary,
.button.dark,
.button.error,
.button.success,
[type="submit"] {
color: #fff;
z-index: 1; /* hightlight from other button's border when grouped */
background-color: #000;
background-color: var(--color-primary);
}
.button:hover,
[type="button"]:hover,
@ -578,22 +530,62 @@ button:active {
transform: scale(0.98);
}
input:disabled,
button:disabled,
input:disabled:hover,
button:disabled,
button:disabled:hover {
opacity: 0.4;
cursor: not-allowed;
}
.button.primary,
.button.secondary,
.button.dark,
.button.error,
.button.success,
[type="submit"] {
color: #fff;
z-index: 1; /* hightlight from other button's border when grouped */
background-color: #000;
background-color: var(--color-primary);
.grouped {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.grouped > *:not(:last-child) {
margin-right: 16px;
}
.grouped.gapless > * {
margin: 0 0 0 -1px !important;
border-radius: 0 !important;
}
.grouped.gapless > *:first-child {
margin: 0 !important;
border-radius: 4px 0 0 4px !important;
}
.grouped.gapless > *:last-child {
border-radius: 0 4px 4px 0 !important;
}
input:not([type="checkbox"], [type="radio"], [type="submit"], [type="color"], [type="button"], [type="reset"], :disabled):hover,
select:hover,
textarea:hover,
textarea[type="text"]:hover {
border-color: var(--color-grey);
}
input:not([type="checkbox"], [type="radio"], [type="submit"], [type="color"], [type="button"], [type="reset"]):focus,
select:focus,
textarea:focus,
textarea[type="text"]:focus {
outline: none;
border-color: var(--color-primary);
-webkit-box-shadow: 0 0 1px var(--color-primary);
box-shadow: 0 0 1px var(--color-primary);
}
input.error:not([type="checkbox"], [type="radio"], [type="submit"], [type="color"], [type="button"], [type="reset"]),
textarea.error {
border-color: var(--color-error);
}
input.success:not([type="checkbox"], [type="radio"], [type="submit"], [type="color"], [type="button"], [type="reset"]),
textarea.success {
border-color: var(--color-success);
}
[type="checkbox"],
[type="radio"] {
width: 1.6rem;
height: 1.6rem;
}
/* BUTTONS */
.button + .button {
margin-left: 1rem;
}
.button.secondary {
background-color: var(--color-grey);
@ -669,7 +661,7 @@ button:disabled:hover {
.nav img {
max-height: 3rem;
}
.nav>.container {
.nav > .container {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
@ -701,12 +693,13 @@ button:disabled:hover {
}
@media screen and (max-width: 480px) {
.nav,
.nav>.container {
.nav > .container {
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
}
.nav-center,
.nav-left,
.nav-right {
@ -809,7 +802,7 @@ button:disabled:hover {
padding: 0.7rem;
font-size: 1.125em;
}
.tag+.tag {
.tag + .tag {
margin-left: 1rem;
}
details.dropdown {

2
dist/chota.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,6 @@
/* stylelint-disable color-function-notation */
/* stylelint-disable length-zero-no-unit */
/* stylelint-disable property-no-vendor-prefix */
body.dark {
--bg-color: #000;
--bg-secondary-color: #262626;
@ -60,21 +63,21 @@ hr {
margin: 3rem 0;
}
body.dark .card {
box-shadow: 0 1px 3px var(--color-darkGrey);
}
#grid .card {
padding: 1rem 0rem;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
background-color: rgba(26, 159, 96, 0.2);
background-color: rgba(26, 159, 96, 20%);
font-size: 1.2rem;
}
body.dark #grid .card {
background-color: rgba(26, 159, 96, 0.4);
}
body.dark .card {
box-shadow: 0 1px 3px var(--color-darkGrey);
background-color: rgba(26, 159, 96, 40%);
}
.buttons {
@ -95,6 +98,7 @@ body.dark .card {
code {
background-color: var(--bg-secondary-color);
}
.highlight .c {
color: #93a1a1;
} /* Comment */

View File

@ -5,11 +5,11 @@
"main": "dist/chota.min.css",
"scripts": {
"start": "run-p docs watch",
"docs": "jekyll s -s docs",
"build": "rimraf dist/* && yarn postcss && cross-env NODE_ENV=production yarn postcss --ext .min.css && gzip -c dist/chota.min.css | wc -c | xargs echo 'Size:'",
"docs": "bundle exec jekyll s -s docs",
"build": "rimraf dist/* && stylelint src/*.css --fix && yarn postcss && cross-env NODE_ENV=production yarn postcss --ext .min.css && gzip -c dist/chota.min.css | wc -c | xargs echo 'Size:'",
"postcss": "postcss ./src/chota.css -d dist/",
"watch": "cross-env NODE_ENV=development yarn postcss -w",
"test": "echo \"Error: no test specified\" && exit 1",
"test": "stylelint src/*.css",
"prepublish": "yarn build"
},
"keywords": [
@ -28,15 +28,21 @@
"url": "https://github.com/jenil/chota/issues"
},
"devDependencies": {
"autoprefixer": "^10.4.8",
"cross-env": "^7.0.2",
"cssnano": "^5.1.13",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.16",
"postcss-cli": "^10.0.0",
"postcss-csso": "^6.0.1",
"postcss-import": "^15.0.0",
"rimraf": "^3.0.0"
"autoprefixer": "10.4.8",
"caniuse-lite": "1.0.30001468",
"cross-env": "7.0.2",
"cssnano": "5.1.13",
"npm-run-all": "4.1.5",
"postcss": "8.4.16",
"postcss-cli": "10.0.0",
"postcss-csso": "6.0.1",
"postcss-import": "15.0.0",
"postcss-reporter": "7.0.5",
"prettier": "2.7.1",
"rimraf": "3.0.0",
"stylelint": "14.11.0",
"stylelint-config-prettier": "9.0.3",
"stylelint-config-standard": "28.0.0"
},
"files": [
"src/",
@ -45,5 +51,9 @@
],
"browserslist": [
"last 2 versions"
]
],
"prettier": {
"tabWidth": 2
},
"dependencies": {}
}

View File

@ -1,16 +1,19 @@
let plugins = [
require("postcss-import"),
require("autoprefixer")()
require("postcss-import")({
plugins: [require("stylelint")({ fix: true, formatter: "compact" })],
}),
require("autoprefixer")(),
require("postcss-reporter")({ clearReportedMessages: true }),
];
// if (process.env.NODE_ENV == 'production') plugins.push(require("postcss-csso"))
if (process.env.NODE_ENV == "production")
plugins.push(
require("cssnano")({
preset: "default"
preset: "default",
})
);
module.exports = {
plugins
plugins,
};

View File

@ -1,7 +1,7 @@
:root {
--bg-color: #ffffff;
--bg-color: #fff;
--bg-secondary-color: #f3f3f6;
--color-primary: #14854F;
--color-primary: #14854f;
--color-lightGrey: #d2d6dd;
--color-grey: #747681;
--color-darkGrey: #3f4144;
@ -10,10 +10,10 @@
--grid-maxWidth: 120rem;
--grid-gutter: 2rem;
--font-size: 1.6rem;
--font-color: #333333;
--font-family-sans: -apple-system, BlinkMacSystemFont, Avenir, "Avenir Next",
"Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans",
"Droid Sans", "Helvetica Neue", sans-serif;
--font-color: #333;
--font-family-sans: -apple-system, "BlinkMacSystemFont", "Avenir",
"Avenir Next", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
"Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
--font-family-mono: monaco, "Consolas", "Lucida Console", monospace;
}
@ -21,37 +21,21 @@ html {
box-sizing: border-box;
font-size: 62.5%;
line-height: 1.15;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
text-size-adjust: 100%;
}
*, *:before, *:after {
*,
*::before,
*::after {
box-sizing: inherit;
}
* {
scrollbar-width: thin;
scrollbar-color: var(--color-lightGrey) var(--bg-primary);
}
*::-webkit-scrollbar {
width: 8px;
}
*::-webkit-scrollbar-track {
background: var(--bg-primary);
}
*::-webkit-scrollbar-thumb {
background: var(--color-lightGrey);
}
body {
background-color: var(--bg-color);
line-height: 1.6;
font-size: var(--font-size);
color: var(--font-color);
font-family: "Segoe UI", "Helvetica Neue", sans-serif; /*fallback*/
font-family: "Segoe UI", "Helvetica Neue", sans-serif; /* fallback */
font-family: var(--font-family-sans);
margin: 0;
padding: 0;
@ -64,7 +48,7 @@ h4,
h5,
h6 {
font-weight: 500;
margin: 0.35em 0 0.7em 0;
margin: 0.35em 0 0.7em;
}
h1 {
@ -161,7 +145,6 @@ tt {
code,
kbd {
padding: 0 0.4rem;
font-size: 90%;
white-space: pre-wrap;
border-radius: 4px;

View File

@ -8,7 +8,7 @@ legend {
letter-spacing: 0.1rem;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="color"]):not([type="button"]):not([type="reset"]),
input:not([type="checkbox"], [type="radio"], [type="submit"], [type="color"], [type="button"], [type="reset"]),
select,
textarea,
textarea[type="text"] {
@ -22,47 +22,14 @@ textarea[type="text"] {
width: 100%;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="color"]):not([type="button"]):not([type="reset"]):not(:disabled):hover,
select:hover,
textarea:hover,
textarea[type="text"]:hover {
border-color: var(--color-grey);
}
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="color"]):not([type="button"]):not([type="reset"]):focus,
select:focus,
textarea:focus,
textarea[type="text"]:focus {
outline: none;
border-color: var(--color-primary);
box-shadow: 0 0 1px var(--color-primary);
}
input.error:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="color"]):not([type="button"]):not([type="reset"]),
textarea.error {
border-color: var(--color-error);
}
input.success:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="color"]):not([type="button"]):not([type="reset"]),
textarea.success {
border-color: var(--color-success);
}
select {
-webkit-appearance: none;
appearance: none;
background: #f3f3f6 no-repeat 100%;
background-size: 1ex;
background-origin: content-box;
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='40' fill='%23555'><polygon points='0,0 60,0 30,40'/></svg>");
}
[type="checkbox"],
[type="radio"] {
width: 1.6rem;
height: 1.6rem;
}
/* BUTTONS */
.button,
[type="button"],
[type="reset"],
@ -83,29 +50,16 @@ button {
cursor: pointer;
}
.grouped {
display: flex;
}
.grouped > *:not(:last-child) {
margin-right: 16px;
}
.grouped.gapless > * {
margin: 0 0 0 -1px !important;
border-radius:0 !important;
}
.grouped.gapless > *:first-child {
margin: 0 !important;
border-radius:4px 0 0 4px !important;
}
.grouped.gapless > *:last-child {
border-radius:0 4px 4px 0 !important;
}
.button + .button {
margin-left: 1rem;
.button.primary,
.button.secondary,
.button.dark,
.button.error,
.button.success,
[type="submit"] {
color: #fff;
z-index: 1; /* hightlight from other button's border when grouped */
background-color: #000;
background-color: var(--color-primary);
}
.button:hover,
@ -125,23 +79,71 @@ button:active {
}
input:disabled,
button:disabled,
input:disabled:hover,
button:disabled,
button:disabled:hover {
opacity: 0.4;
cursor: not-allowed;
}
.button.primary,
.button.secondary,
.button.dark,
.button.error,
.button.success,
[type="submit"] {
color: #fff;
z-index: 1; /* hightlight from other button's border when grouped */
background-color: #000;
background-color: var(--color-primary);
.grouped {
display: flex;
}
.grouped > *:not(:last-child) {
margin-right: 16px;
}
.grouped.gapless > * {
margin: 0 0 0 -1px !important;
border-radius: 0 !important;
}
.grouped.gapless > *:first-child {
margin: 0 !important;
border-radius: 4px 0 0 4px !important;
}
.grouped.gapless > *:last-child {
border-radius: 0 4px 4px 0 !important;
}
input:not([type="checkbox"], [type="radio"], [type="submit"], [type="color"], [type="button"], [type="reset"], :disabled):hover,
select:hover,
textarea:hover,
textarea[type="text"]:hover {
border-color: var(--color-grey);
}
input:not([type="checkbox"], [type="radio"], [type="submit"], [type="color"], [type="button"], [type="reset"]):focus,
select:focus,
textarea:focus,
textarea[type="text"]:focus {
outline: none;
border-color: var(--color-primary);
box-shadow: 0 0 1px var(--color-primary);
}
input.error:not([type="checkbox"], [type="radio"], [type="submit"], [type="color"], [type="button"], [type="reset"]),
textarea.error {
border-color: var(--color-error);
}
input.success:not([type="checkbox"], [type="radio"], [type="submit"], [type="color"], [type="button"], [type="reset"]),
textarea.success {
border-color: var(--color-success);
}
[type="checkbox"],
[type="radio"] {
width: 1.6rem;
height: 1.6rem;
}
/* BUTTONS */
.button + .button {
margin-left: 1rem;
}
.button.secondary {
@ -194,6 +196,7 @@ button:disabled:hover {
.button.icon > img {
margin-left: 2px;
}
.button.icon-only {
padding: 1rem;
}

View File

@ -23,7 +23,7 @@
.col,
[class*=" col-"],
[class^='col-'] {
[class^="col-"] {
margin: 0 calc(var(--grid-gutter) / 2) calc(var(--grid-gutter) / 2);
}
@ -94,7 +94,7 @@
.col,
[class*="col-"],
[class^='col-'] {
[class^="col-"] {
flex: 0 1 100%;
max-width: 100%;
}

View File

@ -8,7 +8,7 @@
max-height: 3rem;
}
.nav>.container {
.nav > .container {
display: flex;
}
@ -33,9 +33,10 @@
@media screen and (max-width: 480px) {
.nav,
.nav>.container {
.nav > .container {
flex-direction: column;
}
.nav-center,
.nav-left,
.nav-right {

View File

@ -18,6 +18,6 @@
font-size: 1.125em;
}
.tag+.tag {
.tag + .tag {
margin-left: 1rem;
}

View File

@ -2,11 +2,9 @@
@import "_base.css";
@import "_grid.css";
@import "_form.css";
@import "_nav.css";
@import "_card.css";
@import "_tab.css";
@import "_tag.css";
@import "_dropdown.css";
@import "_util.css";

730
yarn.lock

File diff suppressed because it is too large Load Diff