feat: add ESLint and update linting errors (#26)

* Install ESLint and Astro ESLint plugin

* Configure 2 plugins

* Improve ignore files

* Add lint script

* Install astro-eslint-parser

* Add parser and fix linting errors
This commit is contained in:
Sha Mwe La
2023-02-02 16:24:38 +06:30
committed by GitHub
parent 29e07761f7
commit a9631d0e1e
6 changed files with 1629 additions and 25 deletions
+4
View File
@@ -0,0 +1,4 @@
.husky
.vscode
node_modules
public
+23
View File
@@ -0,0 +1,23 @@
module.exports = {
env: {
node: true,
es2022: true,
browser: true,
},
extends: ["eslint:recommended", "plugin:astro/recommended"],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
overrides: [
{
files: ["*.astro"],
parser: "astro-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
extraFileExtensions: [".astro"],
},
rules: {},
},
],
};
+1 -1
View File
@@ -9,5 +9,5 @@
!astro.config.mjs
!package.json
!.prettierrc
!.eslintrc.json
!.eslintrc.js
!README.md
+1594 -22
View File
File diff suppressed because it is too large Load Diff
+6 -1
View File
@@ -12,7 +12,8 @@
"format:check": "prettier --check .",
"format": "prettier --write .",
"cz": "cz",
"prepare": "husky install"
"prepare": "husky install",
"lint": "eslint ."
},
"dependencies": {
"@astrojs/rss": "^2.1.0",
@@ -31,8 +32,12 @@
"@tailwindcss/typography": "^0.5.9",
"@types/github-slugger": "^1.3.0",
"@types/react": "^18.0.27",
"@typescript-eslint/parser": "^5.50.0",
"astro-eslint-parser": "^0.11.0",
"commitizen": "^4.3.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.33.0",
"eslint-plugin-astro": "^0.23.0",
"husky": "^8.0.3",
"lint-staged": "^13.1.0",
"prettier": "^2.8.3",
+1 -1
View File
@@ -191,7 +191,7 @@ const { activeNav } = Astro.props;
const secondLine = document.querySelector("#second-line ")?.classList;
const thirdLine = document.querySelector("#third-line")?.classList;
menuBtn!.addEventListener("click", function (event) {
menuBtn?.addEventListener("click", function () {
const menuExpanded = menuBtn?.getAttribute("aria-expanded");
if (menuExpanded === "false") {
menuBtn?.setAttribute("aria-expanded", "true");