diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..572406bfdde3e3cce38a8f5a356cc09cf0a90f88 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules +package-lock.json \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000000000000000000000000000000000000..069e292f4c999c399ebfac52ef0e8bace19a17c2 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,16 @@ +import globals from "globals"; +import pluginJs from "@eslint/js"; + + +/** @type {import('eslint').Linter.Config[]} */ +export default [ + { + languageOptions: { globals: globals.browser }, + "rules": { + "max-len": ["error", { "code": 80 }], + "indent": ["error", 2] + } + }, + pluginJs.configs.recommended, + +]; \ No newline at end of file diff --git a/helper/data.js b/helper/data.js new file mode 100644 index 0000000000000000000000000000000000000000..33be81cbdd428f81733941a69c8e7ba8ce5cdf6a --- /dev/null +++ b/helper/data.js @@ -0,0 +1,10 @@ +const data = [ + { + "id": 1, + "name": "Leanne Graham", + "username": "Bret", + "email": "Q7Z2H@example.com", + } +] + +export default data \ No newline at end of file diff --git a/index.html b/index.html index 280a17715aae9d54c04e5bff85758bd74e822488..2a74331fd46ebd8412ce9a60f5cafe8d2572351b 100644 --- a/index.html +++ b/index.html @@ -1,14 +1,17 @@ <!DOCTYPE html> <html lang="en"> - <head> - <meta charset="UTF-8" /> - <meta name="viewport" content="width=device-width, initial-scale=1.0" /> - <link rel="stylesheet" href="style.css" /> - - <title>rbb Schulung</title> - </head> - <body> - <button class="main-button" type="button">Click</button> - <script type="text/javascript" src="index.js"></script> - </body> -</html> + +<head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <link rel="stylesheet" href="style.css" /> + + <title>rbb Schulung</title> +</head> + +<body> + <button class="main-button" type="button">Click</button> + <script type="module" src="index.js"></script> +</body> + +</html> \ No newline at end of file diff --git a/index.js b/index.js index 0cdebe575da91381f0d85dc1d475762c3b2d9bfb..a1ef5070a7ce5160aa182b75c64d77bf99312ecc 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,12 @@ +import data from "./helper/data.js"; + + const button = document.getElementsByClassName("main-button")[0]; button.addEventListener("click", () => { - console.log("clicked"); + console.log(data); }); + + + + diff --git a/package.json b/package.json index 1f557093da277bdeaade57da9c479ef3d27f3aa1..3a8bf377c64849a4bfbb0fde130228b1ee5f7c8a 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,16 @@ "description": "A basic vanilla repo for education", "main": "index.html", "scripts": { - "test": "npm run dev" + "test": "npm run dev", + "lint": "eslint", + "lint:fix": "npm run lint -- --fix" }, "author": "subliminalguy", - "license": "ISC" + "license": "ISC", + "devDependencies": { + "@eslint/js": "^9.19.0", + "eslint": "^8.57.1", + "eslint-config-airbnb": "^19.0.4", + "globals": "^15.14.0" + } }