Skip to content

Commit 297d0b1

Browse files
committed
add linters
1 parent 2e91562 commit 297d0b1

File tree

9 files changed

+11230
-52
lines changed

9 files changed

+11230
-52
lines changed

Diff for: .eslintrc.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es6": true,
5+
"jest": true
6+
},
7+
"parser": "babel-eslint",
8+
"parserOptions": {
9+
"ecmaVersion": 2018,
10+
"sourceType": "module"
11+
},
12+
"extends": ["airbnb-base"],
13+
"rules": {
14+
"no-shadow": "off",
15+
"no-param-reassign": "off",
16+
"eol-last": "off",
17+
"import/extensions": [ 1, {
18+
"js": "always", "json": "always"
19+
}]
20+
},
21+
"ignorePatterns": [
22+
"dist/",
23+
"build/"
24+
]
25+
}

Diff for: .github/workflows/linters.yml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Linters
2+
3+
on: pull_request
4+
5+
env:
6+
FORCE_COLOR: 1
7+
8+
jobs:
9+
lighthouse:
10+
name: Lighthouse
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: "18.x"
17+
- name: Setup Lighthouse
18+
run: npm install -g @lhci/[email protected]
19+
- name: Lighthouse Report
20+
run: lhci autorun --upload.target=temporary-public-storage --collect.staticDistDir=.
21+
webhint:
22+
name: Webhint
23+
runs-on: ubuntu-22.04
24+
steps:
25+
- uses: actions/checkout@v3
26+
- uses: actions/setup-node@v3
27+
with:
28+
node-version: "18.x"
29+
- name: Setup Webhint
30+
run: |
31+
npm install --save-dev [email protected]
32+
[ -f .hintrc ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/html-css-js/.hintrc
33+
- name: Webhint Report
34+
run: npx hint .
35+
stylelint:
36+
name: Stylelint
37+
runs-on: ubuntu-22.04
38+
steps:
39+
- uses: actions/checkout@v3
40+
- uses: actions/setup-node@v3
41+
with:
42+
node-version: "18.x"
43+
- name: Setup Stylelint
44+
run: |
45+
46+
[ -f .stylelintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/html-css-js/.stylelintrc.json
47+
- name: Stylelint Report
48+
run: npx stylelint "**/*.{css,scss}"
49+
eslint:
50+
name: ESLint
51+
runs-on: ubuntu-22.04
52+
steps:
53+
- uses: actions/checkout@v3
54+
- uses: actions/setup-node@v3
55+
with:
56+
node-version: "18.x"
57+
- name: Setup ESLint
58+
run: |
59+
60+
[ -f .eslintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/html-css-js/.eslintrc.json
61+
- name: ESLint Report
62+
run: npx eslint .
63+
nodechecker:
64+
name: node_modules checker
65+
runs-on: ubuntu-22.04
66+
steps:
67+
- uses: actions/checkout@v3
68+
- name: Check node_modules existence
69+
run: |
70+
if [ -d "node_modules/" ]; then echo -e "\e[1;31mThe node_modules/ folder was pushed to the repo. Please remove it from the GitHub repository and try again."; echo -e "\e[1;32mYou can set up a .gitignore file with this folder included on it to prevent this from happening in the future." && exit 1; fi

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

Diff for: .hintrc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"connector": {
3+
"name": "local",
4+
"options": {
5+
"pattern": ["**", "!.git/**", "!node_modules/**"]
6+
}
7+
},
8+
"extends": ["development"],
9+
"formatters": ["stylish"],
10+
"hints": [
11+
"button-type",
12+
"disown-opener",
13+
"html-checker",
14+
"meta-charset-utf-8",
15+
"meta-viewport"
16+
]
17+
}

Diff for: .stylelintrc.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"extends": ["stylelint-config-standard"],
3+
"plugins": ["stylelint-scss", "stylelint-csstree-validator"],
4+
"rules": {
5+
"at-rule-no-unknown": [
6+
true,
7+
{
8+
"ignoreAtRules": ["tailwind", "apply", "variants", "responsive", "screen"]
9+
}
10+
],
11+
"scss/at-rule-no-unknown": [
12+
true,
13+
{
14+
"ignoreAtRules": ["tailwind", "apply", "variants", "responsive", "screen"]
15+
}
16+
],
17+
"csstree/validator": true
18+
},
19+
"ignoreFiles": ["build/**", "dist/**", "**/reset*.css", "**/bootstrap*.css", "**/*.js", "**/*.jsx"]
20+
}

Diff for: ExpandsCards/script.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
const panels = document.querySelectorAll(".panel");
2-
panels.forEach((panel) => {
3-
panel.addEventListener("click", () => {
4-
removeActiveClasses();
5-
panel.classList.add("active");
6-
});
7-
});
1+
const panels = document.querySelectorAll('.panel');
82

93
const removeActiveClasses = () => {
104
panels.forEach((panel) => {
11-
panel.classList.remove("active");
5+
panel.classList.remove('active');
126
});
137
};
8+
panels.forEach((panel) => {
9+
panel.addEventListener('click', () => {
10+
removeActiveClasses();
11+
panel.classList.add('active');
12+
});
13+
});

Diff for: ExpandsCards/style.css

+48-44
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,65 @@
11
* {
2-
box-sizing: border-box;
2+
box-sizing: border-box;
33
}
44

55
body {
6-
font-family: sans-serif;
7-
margin: 0;
8-
overflow: hidden;
9-
height: 100vh;
6+
font-family: sans-serif;
7+
margin: 0;
8+
overflow: hidden;
9+
height: 100vh;
1010
}
1111

12-
h1, .container{
13-
display: flex;
14-
justify-content: center;
12+
h1,
13+
.container {
14+
display: flex;
15+
justify-content: center;
1516
}
1617

17-
.container{
18-
align-items: center;
19-
width: 90vw;
20-
margin: auto;
18+
.container {
19+
align-items: center;
20+
width: 90vw;
21+
margin: auto;
2122
}
22-
.panel{
23-
background-size: auto 100%;
24-
background-repeat: no-repeat;
25-
background-position: center;
26-
height: 80vh;
27-
border-radius: 50px;
28-
color: #494747;
29-
cursor: pointer;
30-
flex: 0.5;
31-
margin: 10px;
32-
position: relative;
33-
transition: flex 0.7s ease-in;
23+
24+
.panel {
25+
background-size: auto 100%;
26+
background-repeat: no-repeat;
27+
background-position: center;
28+
height: 80vh;
29+
border-radius: 50px;
30+
color: #494747;
31+
cursor: pointer;
32+
flex: 0.5;
33+
margin: 10px;
34+
position: relative;
35+
transition: flex 0.7s ease-in;
3436
}
3537

36-
.panel h3{
37-
font-size: 24px;
38-
position: absolute;
39-
bottom: 25px;
40-
left: 10vh;
41-
margin: 0;
42-
opacity: 0;
38+
.panel h3 {
39+
font-size: 24px;
40+
position: absolute;
41+
bottom: 25px;
42+
left: 10vh;
43+
margin: 0;
44+
opacity: 0;
4345
}
4446

4547
.panel.active {
46-
flex: 5;
48+
flex: 5;
4749
}
4850

4951
.panel.active h3 {
50-
opacity: 1;
51-
transition: opacity 0.3s ease-in 0.4s;
52-
}
53-
@media(max-width: 480px){
54-
.container {
55-
width: 100vw;
56-
}
57-
.panel:nth-of-type(4),
58-
.panel:nth-of-type(5){
59-
display:none;
60-
}
61-
}
52+
opacity: 1;
53+
transition: opacity 0.3s ease-in 0.4s;
54+
}
55+
56+
@media (max-width: 480px) {
57+
.container {
58+
width: 100vw;
59+
}
60+
61+
.panel:nth-of-type(4),
62+
.panel:nth-of-type(5) {
63+
display: none;
64+
}
65+
}

0 commit comments

Comments
 (0)