From 6f355dea7e1bfe8d2d773bdc0f8ac4ef8bd75b43 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 1 Oct 2025 16:40:47 +0200 Subject: [PATCH] chore: adjust ESLint for Cypress Signed-off-by: Ferdinand Thiessen --- eslint.config.mjs | 69 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 5a3da909745..95f309bb331 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -5,6 +5,7 @@ import { includeIgnoreFile } from '@eslint/compat' import { recommendedVue2 } from '@nextcloud/eslint-config' +import CypressEslint from 'eslint-plugin-cypress' import { defineConfig } from 'eslint/config' import * as globals from 'globals' import { fileURLToPath } from 'node:url' @@ -12,30 +13,72 @@ import { fileURLToPath } from 'node:url' const gitignorePath = fileURLToPath(new URL('.gitignore', import.meta.url)) export default defineConfig([ - ...recommendedVue2, - includeIgnoreFile(gitignorePath, 'Imported .gitignore patterns'), { - ignores: [ - '3rdparty/', // PHP tests - 'tests/', // PHP tests - '**/l10n/', // all translations (config only ignored in root) - ], + linterOptions: { + reportUnusedDisableDirectives: 'error', + reportUnusedInlineConfigs: 'error', + }, }, + + ...recommendedVue2, + + // respect .gitignore + includeIgnoreFile(gitignorePath, 'Imported .gitignore patterns'), + { - files: ['cypress/**'], - rules: { - 'no-console': 'off', + name: 'server/custom-webpack-globals', + files: ['**/*.js', '**/*.ts', '**/*.vue'], + languageOptions: { + globals: { + PRODUCTION: 'readonly', + }, }, }, - // scripts are cjs + { - files: ['*.js', 'build/**/*.js'], + name: 'server/scripts-are-cjs', + files: [ + '*.js', + 'build/**/*.js', + '**/core/src/icons.cjs', + ], + languageOptions: { globals: { ...globals.es2023, ...globals.node, - ...globals.nodeBuiltin, }, }, + + rules: { + 'no-console': 'off', + 'jsdoc/require-jsdoc': 'off', + }, + }, + // Cypress setup + CypressEslint.configs.recommended, + { + name: 'server/cypress', + files: ['cypress/**', '**/*.cy.*'], + rules: { + 'no-console': 'off', + 'jsdoc/require-jsdoc': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unused-expressions': 'off', + }, + }, + // customer server ignore files + { + name: 'server/ignored-files', + ignores: [ + '.devcontainer/', + 'composer.json', + '**/*.php', + '3rdparty/', + 'tests/', // PHP tests + '**/js/', + '**/l10n/', // all translations (config only ignored in root) + '**/vendor/', // different vendors + ], }, ])