UNPKG

@perfective/eslint-config

Version:
38 lines 1.34 kB
import eslintPluginCypress from 'eslint-plugin-cypress/flat'; import { cypressFiles } from "../../linter/glob.js"; import { importNoExtraneousDependencies } from "../import/rules/no-extraneous-dependencies.js"; export function cypressConfig(files = [cypressFiles]) { return { files, plugins: { cypress: eslintPluginCypress }, rules: Object.assign({ 'cypress/assertion-before-screenshot': 'error', 'cypress/no-assigning-return-values': 'error', 'cypress/no-async-before': 'error', 'cypress/no-async-tests': 'error', 'cypress/no-chained-get': 'error', 'cypress/no-debug': 'error', 'cypress/no-force': 'error', 'cypress/no-pause': 'error', 'cypress/no-unnecessary-waiting': 'error', 'cypress/no-xpath': 'error', 'cypress/require-data-selectors': 'error', 'cypress/unsafe-to-chain-command': 'error' }, perfectiveRules()) }; } function perfectiveRules() { return { 'init-declarations': 'off', '@typescript-eslint/init-declarations': 'off', 'import/no-extraneous-dependencies': ['error', importNoExtraneousDependencies({ devDependencies: [cypressFiles] })], 'max-nested-callbacks': ['error', 4], 'new-cap': ['error', { capIsNewExceptions: ['Given', 'When', 'Then', 'And', 'But', 'Before', 'After'] }] }; }