From 4c098db796ec6811efd4c697d53ad70b32a5fedf Mon Sep 17 00:00:00 2001 From: regexowl Date: Tue, 5 Aug 2025 10:45:16 +0200 Subject: [PATCH] Move prettier config to ESLint config ESLint was not enforcing prettier rules defined in `.prettierrc`, this plugs prettier in and moves the rules to ESLint config so all lint settings are in one place. --- .prettierrc | 9 --------- eslint.config.js | 19 ++++++++++++++++--- package-lock.json | 25 +++++++++++++------------ package.json | 1 + 4 files changed, 30 insertions(+), 24 deletions(-) delete mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 258449ff..00000000 --- a/.prettierrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "semi": true, - "tabWidth": 2, - "singleQuote": false, - "jsxSingleQuote": false, - "bracketSpacing": true, - "tsxSingleQuote": true, - "tsSingleQuote": true -} \ No newline at end of file diff --git a/eslint.config.js b/eslint.config.js index 0c4750c1..39da3786 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -7,6 +7,7 @@ const pluginImport = require('eslint-plugin-import'); const fecConfig = require('@redhat-cloud-services/eslint-config-redhat-cloud-services'); const pluginJsxA11y = require('eslint-plugin-jsx-a11y'); const disableAutofix = require('eslint-plugin-disable-autofix'); +const pluginPrettier = require('eslint-plugin-prettier'); const jestDom = require('eslint-plugin-jest-dom'); const pluginTestingLibrary = require('eslint-plugin-testing-library'); const pluginPlaywright = require('eslint-plugin-playwright'); @@ -61,6 +62,7 @@ module.exports = defineConfig([ import: pluginImport, jsxA11y: pluginJsxA11y, 'disable-autofix': disableAutofix, + prettier: pluginPrettier, }, rules: { ...js.configs.recommended.rules, @@ -118,6 +120,17 @@ module.exports = defineConfig([ }, ], 'jsx-a11y/no-autofocus': 'off', + 'prettier/prettier': ['error', { + semi: true, + tabWidth: 2, + singleQuote: true, + jsxSingleQuote: false, + bracketSpacing: true, + tsxSingleQuote: true, + tsSingleQuote: true, + printWidth: 80, + trailingComma: 'es5', + }], }, settings: { react: { @@ -150,10 +163,10 @@ module.exports = defineConfig([ ...pluginPlaywright.configs.recommended.rules, 'playwright/no-conditional-in-test': 'off', 'playwright/no-conditional-expect': 'off', - "playwright/no-skipped-test": [ - "error", + 'playwright/no-skipped-test': [ + 'error', { - "allowConditional": true + 'allowConditional': true } ] }, diff --git a/package-lock.json b/package-lock.json index 539309e7..8f017617 100644 --- a/package-lock.json +++ b/package-lock.json @@ -69,6 +69,7 @@ "eslint-plugin-jest-dom": "5.5.0", "eslint-plugin-jsx-a11y": "6.10.2", "eslint-plugin-playwright": "2.2.2", + "eslint-plugin-prettier": "5.5.3", "eslint-plugin-react": "7.37.5", "eslint-plugin-react-hooks": "5.2.0", "eslint-plugin-react-redux": "4.2.2", @@ -9434,9 +9435,9 @@ } }, "node_modules/eslint-config-prettier": { - "version": "10.1.5", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.5.tgz", - "integrity": "sha512-zc1UmCpNltmVY34vuLRV61r1K27sWuX39E+uyUnY8xS2Bex88VV9cugG+UZbRSRGtGyFboj+D8JODyme1plMpw==", + "version": "10.1.8", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz", + "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", "dev": true, "license": "MIT", "bin": { @@ -9708,9 +9709,9 @@ } }, "node_modules/eslint-plugin-prettier": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.1.tgz", - "integrity": "sha512-dobTkHT6XaEVOo8IO90Q4DOSxnm3Y151QxPJlM/vKC0bVy+d6cVWQZLlFiuZPP0wS6vZwSKeJgKkcS+KfMBlRw==", + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.3.tgz", + "integrity": "sha512-NAdMYww51ehKfDyDhv59/eIItUVzU0Io9H2E8nHNGKEeeqlnci+1gCvrHib6EmZdf6GxF+LCV5K7UC65Ezvw7w==", "dev": true, "license": "MIT", "dependencies": { @@ -25913,9 +25914,9 @@ } }, "eslint-config-prettier": { - "version": "10.1.5", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.5.tgz", - "integrity": "sha512-zc1UmCpNltmVY34vuLRV61r1K27sWuX39E+uyUnY8xS2Bex88VV9cugG+UZbRSRGtGyFboj+D8JODyme1plMpw==", + "version": "10.1.8", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz", + "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", "dev": true, "requires": {} }, @@ -26103,9 +26104,9 @@ } }, "eslint-plugin-prettier": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.1.tgz", - "integrity": "sha512-dobTkHT6XaEVOo8IO90Q4DOSxnm3Y151QxPJlM/vKC0bVy+d6cVWQZLlFiuZPP0wS6vZwSKeJgKkcS+KfMBlRw==", + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.3.tgz", + "integrity": "sha512-NAdMYww51ehKfDyDhv59/eIItUVzU0Io9H2E8nHNGKEeeqlnci+1gCvrHib6EmZdf6GxF+LCV5K7UC65Ezvw7w==", "dev": true, "requires": { "prettier-linter-helpers": "^1.0.0", diff --git a/package.json b/package.json index ad53eed3..1395b45c 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "eslint-plugin-jest-dom": "5.5.0", "eslint-plugin-jsx-a11y": "6.10.2", "eslint-plugin-playwright": "2.2.2", + "eslint-plugin-prettier": "5.5.3", "eslint-plugin-react": "7.37.5", "eslint-plugin-react-hooks": "5.2.0", "eslint-plugin-react-redux": "4.2.2",