From e27dce45d4e0bdd5f72b06f90fca20696d6d3653 Mon Sep 17 00:00:00 2001 From: mahula Date: Mon, 19 Feb 2024 18:34:08 +0100 Subject: [PATCH] add linting --- .eslintrc.cjs | 19 ++++++++++++++++++- package-lock.json | 2 +- package.json | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 433136a..67cb397 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -35,6 +35,13 @@ module.exports = { // Optional eslint-comments rule '@eslint-community/eslint-comments/no-unused-disable': 'error', '@eslint-community/eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }], + // cypress + 'cypress/no-assigning-return-values': 'error', + 'cypress/no-unnecessary-waiting': 'error', + 'cypress/assertion-before-screenshot': 'warn', + 'cypress/no-force': 'warn', + 'cypress/no-async-tests': 'error', + 'cypress/no-pause': 'error', // import 'import/export': 'error', 'import/no-deprecated': 'error', @@ -78,7 +85,7 @@ module.exports = { 'import/group-exports': 'off', 'import/newline-after-import': 'error', 'import/no-anonymous-default-export': 'off', // todo - consider to enable again - 'import/no-default-export': 'off', // incompatible with vite & vike + 'import/no-default-export': 'off', 'import/no-duplicates': 'error', 'import/no-named-default': 'error', 'import/no-namespace': 'error', @@ -123,6 +130,8 @@ module.exports = { parser: '@typescript-eslint/parser', sourceType: 'module', }, + plugins: ['cypress'], + extends: ['plugin:cypress/recommended'], plugins: ['@typescript-eslint'], extends: [ 'plugin:@typescript-eslint/recommended', @@ -143,6 +152,14 @@ module.exports = { 'prettier/prettier': 'error', }, }, + { + files: ['!*.json'], + plugins: ['prettier'], + extends: ['plugin:prettier/recommended'], + rules: { + 'prettier/prettier': 'error', + }, + }, { files: ['*.json'], plugins: ['json'], diff --git a/package-lock.json b/package-lock.json index 536e1bf..c8a5348 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "eslint-plugin-import": "^2.29.1", "eslint-plugin-json": "^3.1.0", "eslint-plugin-prettier": "^5.1.3", + "eslint-plugin-promise": "^6.1.1", "eslint-plugin-security": "^2.1.1", "eslint-plugin-yml": "^1.12.2", "multiple-cucumber-html-reporter": "^3.6.2", @@ -6982,7 +6983,6 @@ "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz", "integrity": "sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==", "dev": true, - "peer": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, diff --git a/package.json b/package.json index 5f97623..cc1c39f 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "eslint-plugin-import": "^2.29.1", "eslint-plugin-json": "^3.1.0", "eslint-plugin-prettier": "^5.1.3", + "eslint-plugin-promise": "^6.1.1", "eslint-plugin-security": "^2.1.1", "eslint-plugin-yml": "^1.12.2", "multiple-cucumber-html-reporter": "^3.6.2",