From f7879dd97679c5c69aa0bf9dc8fd5389ec4f0bc1 Mon Sep 17 00:00:00 2001 From: Subliminal Guy <subliminal_kid@posteo.de> Date: Sun, 9 Feb 2025 13:04:58 +0100 Subject: [PATCH] New Linting Rules --- eslint.config.mjs | 33 +++++++++++++++++++++++++++------ index.html | 2 +- package.json | 4 +++- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 069e292..d20881f 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,16 +1,37 @@ import globals from "globals"; -import pluginJs from "@eslint/js"; +import js from "@eslint/js"; +import airbnbBase from "eslint-config-airbnb-base"; +import importPlugin from "eslint-plugin-import"; +const airbnbRules = airbnbBase.rules; -/** @type {import('eslint').Linter.Config[]} */ +/** @type {import('eslint').Linter.FlatConfig[]} */ export default [ { - languageOptions: { globals: globals.browser }, - "rules": { + languageOptions: { + globals: { + ...globals.browser + }, + parserOptions: { + ecmaVersion: 2022, + sourceType: "module" + } + }, + plugins: { + import: importPlugin + }, + rules: { + ...airbnbRules, + // Your custom rules (these will override Airbnb rules) "max-len": ["error", { "code": 80 }], "indent": ["error", 2] } }, - pluginJs.configs.recommended, - + js.configs.recommended, + { + rules: { + "max-len": ["error", { "code": 80 }], + "indent": ["error", 2] // Any additional rules or overrides + } + } ]; \ No newline at end of file diff --git a/index.html b/index.html index 2a74331..71e02d5 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@ </head> <body> - <button class="main-button" type="button">Click</button> + <button class="main-button" type="button">Click</button> <script type="module" src="index.js"></script> </body> diff --git a/package.json b/package.json index 3a8bf37..7f88562 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.html", "scripts": { "test": "npm run dev", - "lint": "eslint", + "lint": "eslint .", "lint:fix": "npm run lint -- --fix" }, "author": "subliminalguy", @@ -14,6 +14,8 @@ "@eslint/js": "^9.19.0", "eslint": "^8.57.1", "eslint-config-airbnb": "^19.0.4", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-plugin-import": "^2.31.0", "globals": "^15.14.0" } } -- GitLab