From 7bd09b9eb7febd1b5e53aeb4c05b936e2795c48a Mon Sep 17 00:00:00 2001 From: dabico Date: Tue, 9 Apr 2024 00:04:44 +0200 Subject: [PATCH] Replace `eslintrc` with new flat config file --- .eslintrc.json | 40 ---------------------------------------- eslint.config.js | 34 ++++++++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 35 insertions(+), 41 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 eslint.config.js diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 87a4f88..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "env": { - "browser": true, - "es2021": true, - "node": true - }, - "extends": "eslint:recommended", - "overrides": [ - ], - "parserOptions": { - "sourceType": "module", - "ecmaVersion": "latest" - }, - "rules": { - "indent": [ - "error", - 4 - ], - "linebreak-style": [ - "error", - "unix" - ], - "quotes": [ - "error", - "double" - ], - "semi": [ - "error", - "always" - ], - "no-unused-vars": [ - "error", - { - "argsIgnorePattern": "^_", - "varsIgnorePattern": "^_", - "caughtErrorsIgnorePattern": "^_" - } - ] - } -} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..1359ebb --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,34 @@ +import js from "@eslint/js"; +import globals from "globals"; + +export default [ + js.configs.recommended, + { + files: [ + "**/*.js", + "**/*.ts", + "**/*.cjs", + "**/*.mjs", + ], + languageOptions: { + sourceType: "module", + ecmaVersion: 2024, + globals: { + ...globals.node, + ...globals.es2021, + ...globals.browser, + } + }, + rules: { + "semi": ["error", "always"], + "indent": ["error", 4], + "quotes": ["error", "double"], + "linebreak-style": ["error", "unix"], + "no-unused-vars": ["error" , { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "caughtErrorsIgnorePattern": "^_", + }], + } + }, +]; diff --git a/package.json b/package.json index 2522a95..72821a8 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "type": "module", "scripts": { "lint": "npm-run-all --parallel lint:*", - "lint:js": "eslint routes/* util/*", + "lint:js": "eslint .", "lint:css": "stylelint stylelint public/css/*.css", "lint:md": "markdownlint *.md", "minify": "npm-run-all --parallel minify:*",