From 1d47b83779624b00423212980e638a92a7bbdd1b Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Tue, 30 Jul 2024 15:35:07 +0300 Subject: [PATCH] Fix ESlint inconsistencies --- eslint.config.mjs | 44 ++++++++++---------------------- lib/plugin/variable-collector.js | 1 + 2 files changed, 15 insertions(+), 30 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index c7ff0a07..4b030e0c 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,9 +1,9 @@ import jsdoc from "eslint-plugin-jsdoc"; import globals from "globals"; import path from "node:path"; -import { fileURLToPath } from "node:url"; +import {fileURLToPath} from "node:url"; import js from "@eslint/js"; -import { FlatCompat } from "@eslint/eslintrc"; +import {FlatCompat} from "@eslint/eslintrc"; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); @@ -26,6 +26,7 @@ export default [ languageOptions: { globals: { ...globals.node, + ...globals.mocha, }, ecmaVersion: 8, @@ -41,10 +42,10 @@ export default [ }, rules: { - indent: ["error", "tab"], + "indent": ["error", "tab"], "linebreak-style": ["error", "unix"], - quotes: [ + "quotes": [ "error", "double", { @@ -52,7 +53,7 @@ export default [ }, ], - semi: ["error", "always"], + "semi": ["error", "always"], "no-negated-condition": "off", "require-jsdoc": "off", "no-mixed-requires": "off", @@ -77,34 +78,17 @@ export default [ "no-tabs": "off", "valid-jsdoc": 0, - // Starting with ESLint v8, it needs to be disabled as it currently can't be supported - // See: https://github.com/eslint/eslint/issues/14745 - "jsdoc/check-examples": 0, - "jsdoc/check-param-names": 2, - "jsdoc/check-tag-names": 2, - "jsdoc/check-types": 2, - "jsdoc/no-undefined-types": 0, - "jsdoc/require-description": 0, - "jsdoc/require-description-complete-sentence": 0, - "jsdoc/require-example": 0, - "jsdoc/require-hyphen-before-param-description": 0, - "jsdoc/require-param": 2, "jsdoc/require-param-description": 0, - "jsdoc/require-param-name": 2, - "jsdoc/require-param-type": 2, - "jsdoc/require-returns": 0, "jsdoc/require-returns-description": 0, - "jsdoc/require-returns-type": 2, - - "jsdoc/tag-lines": [ - 2, - "any", - { - startLines: 1, - }, - ], + "jsdoc/require-returns": 0, + }, + }, + { + files: ["**/*.mjs"], - "jsdoc/valid-types": 0, + languageOptions: { + ecmaVersion: 2022, + sourceType: "module", }, }, ]; diff --git a/lib/plugin/variable-collector.js b/lib/plugin/variable-collector.js index a66bbb72..b42fc7b2 100644 --- a/lib/plugin/variable-collector.js +++ b/lib/plugin/variable-collector.js @@ -39,6 +39,7 @@ VariableCollector.prototype = { filename: node.currentFileInfo.filename, rootFilename: node.currentFileInfo.rootFilename }; + // eslint-disable-next-line no-unused-vars } catch (err) { // Errors might occur within mixins. // But as we only collect global variables, this doesn't matter...