فهرست منبع

OCPBUGS-65887: Bump eslint to v9

logonoff 6 ماه پیش
والد
کامیت
1d71d47fe3
7فایلهای تغییر یافته به همراه492 افزوده شده و 327 حذف شده
  1. 0 26
      .eslintrc.yml
  2. 59 0
      eslint.config.mjs
  3. 0 17
      integration-tests/.eslintrc
  4. 0 1
      integration-tests/support/login.ts
  5. 18 5
      integration-tests/tests/example-page.cy.ts
  6. 11 10
      package.json
  7. 404 268
      yarn.lock

+ 0 - 26
.eslintrc.yml

@@ -1,26 +0,0 @@
-env:
-  browser: true
-  es2021: true
-extends:
-  - eslint:recommended
-  - plugin:react/recommended
-  - plugin:@typescript-eslint/recommended
-  - prettier
-parser: '@typescript-eslint/parser'
-parserOptions:
-  ecmaFeatures:
-    jsx: true
-  ecmaVersion: 2021
-  sourceType: module
-plugins:
-  - prettier
-  - react
-  - '@typescript-eslint'
-rules:
-  prettier/prettier:
-    - error
-  react/react-in-jsx-scope: # Not required with React 17+
-    - off
-settings:
-  react:
-    version: detect

+ 59 - 0
eslint.config.mjs

@@ -0,0 +1,59 @@
+import eslint from '@eslint/js';
+import tseslint from 'typescript-eslint';
+import react from 'eslint-plugin-react';
+import prettier from 'eslint-plugin-prettier/recommended';
+import reactHooks from 'eslint-plugin-react-hooks';
+import cypress from 'eslint-plugin-cypress';
+import globals from 'globals';
+
+export default tseslint.config(
+  {
+    ignores: ['dist/', 'node_modules/'],
+  },
+  eslint.configs.recommended,
+  tseslint.configs.recommended,
+  reactHooks.configs.flat.recommended,
+  {
+    files: ['src/**/*.{ts,tsx}'],
+    plugins: {
+      react,
+    },
+    rules: {
+      ...eslint.configs.recommended.rules,
+      ...tseslint.configs.recommended.rules,
+      ...react.configs.recommended.rules,
+      ...react.configs['jsx-runtime'].rules,
+    },
+    languageOptions: {
+      globals: globals.browser,
+      parserOptions: {
+        ecmaFeatures: {
+          jsx: true,
+        },
+      }
+    },
+    settings: {
+      react: {
+        version: 'detect',
+      },
+    }
+  },
+  {
+    files: ['integration-tests/**/*.{ts,tsx,js}'],
+    ...cypress.configs.recommended,
+    languageOptions: {
+      globals: {
+        require: 'readonly',
+        module: 'writable',
+      },
+    },
+    rules: {
+      ...cypress.configs.recommended.rules,
+      'no-console': 'off',
+      '@typescript-eslint/no-namespace': 'off',
+      '@typescript-eslint/no-require-imports': 'off',
+      '@typescript-eslint/no-unused-expressions': 'off',
+    },
+  },
+  prettier,
+);

+ 0 - 17
integration-tests/.eslintrc

@@ -1,17 +0,0 @@
-{
-    "env": {
-      "cypress/globals": true,
-      "node": true
-    },
-    "extends": ["../.eslintrc.yml", "plugin:cypress/recommended"],
-    "plugins": ["cypress"],
-    "rules": {
-      "no-console": "off",
-      "no-namespace": "off",
-      "no-redeclare": "off",
-      "promise/catch-or-return": "off",
-      "promise/no-nesting": "off",
-      "@typescript-eslint/no-var-requires":"off",
-      "@typescript-eslint/no-namespace":"off"
-    }
-  }

+ 0 - 1
integration-tests/support/login.ts

@@ -22,7 +22,6 @@ Cypress.Commands.add(
     username: string = KUBEADMIN_USERNAME,
     password: string = Cypress.env('BRIDGE_KUBEADMIN_PASSWORD'),
   ) => {
-    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     const baseURL = Cypress.config('baseUrl')!;
 
     // Make sure we clear the cookie in case a previous test failed to logout.

+ 18 - 5
integration-tests/tests/example-page.cy.ts

@@ -2,11 +2,11 @@ import { checkErrors } from '../support';
 
 const PLUGIN_TEMPLATE_NAME = 'console-plugin-template';
 const PLUGIN_TEMPLATE_PULL_SPEC = Cypress.env('PLUGIN_TEMPLATE_PULL_SPEC');
-// We know that the baseUrl is always set because it's in the cypress config
-// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+
 export const isLocalDevEnvironment = Cypress.config('baseUrl')!.includes('localhost');
 
 const installHelmChart = (path: string) => {
+  // Install the plugin in a dedicated namespace using the helm chart from this repo
   cy.exec(
     `cd ../../console-plugin-template && ${path} upgrade -i ${PLUGIN_TEMPLATE_NAME} charts/openshift-console-plugin -n ${PLUGIN_TEMPLATE_NAME} --create-namespace --set plugin.image=${PLUGIN_TEMPLATE_PULL_SPEC}`,
     {
@@ -15,9 +15,22 @@ const installHelmChart = (path: string) => {
   ).then((result) => {
     result.stderr && cy.log('Error installing helm chart: ', result.stderr);
     result.stdout && cy.log('Successfully installed helm chart: ', result.stdout);
-    cy.visit('/k8s/cluster/operator.openshift.io~v1~Console/cluster/console-plugins');
-    cy.get('[data-test="console-plugin-template-status"]').should('include.text', 'loaded');
   });
+
+  // Wait for the plugin deployment to be ready
+  cy.exec(
+    `oc rollout status -n ${PLUGIN_TEMPLATE_NAME} deploy/${PLUGIN_TEMPLATE_NAME} -w --timeout=300s`,
+    { timeout: 360000, failOnNonZeroExit: false },
+  );
+
+  // Wait for console pods to restart with the new plugin
+  cy.exec('oc rollout status -w deploy/console -n openshift-console --timeout=300s', {
+    timeout: 360000,
+    failOnNonZeroExit: false,
+  });
+
+  cy.visit('/k8s/cluster/operator.openshift.io~v1~Console/cluster/console-plugins');
+  cy.get(`[data-test="${PLUGIN_TEMPLATE_NAME}-status"]`).should('include.text', 'Loaded');
 };
 const deleteHelmChart = (path: string) => {
   cy.exec(
@@ -36,7 +49,7 @@ describe('Console plugin template test', () => {
     cy.login();
     cy.get(`[data-test="tour-step-footer-secondary"]`).contains('Skip tour').click();
     if (!isLocalDevEnvironment) {
-      console.log('this is not a local env, installig helm');
+      console.log('this is not a local env, installing helm');
 
       cy.exec('cd ../../console-plugin-template && ./install_helm.sh', {
         failOnNonZeroExit: false,

+ 11 - 10
package.json

@@ -35,18 +35,18 @@
     "@types/node": "^22.0.0",
     "@types/react": "^17.0.37",
     "@types/react-router-dom": "^5.3.3",
-    "@typescript-eslint/eslint-plugin": "^5.62.0",
-    "@typescript-eslint/parser": "^5.62.0",
     "babel-loader": "^10.0.0",
     "copy-webpack-plugin": "^14.0.0",
     "css-loader": "^7.1.4",
     "cypress": "^15.11.0",
     "cypress-multi-reporters": "^2.0.5",
-    "eslint": "^8.10.0",
-    "eslint-config-prettier": "^8.5.0",
-    "eslint-plugin-cypress": "^2.12.1",
-    "eslint-plugin-prettier": "^4.0.0",
-    "eslint-plugin-react": "^7.29.1",
+    "eslint": "^9.7.0",
+    "eslint-config-prettier": "^10.1.8",
+    "eslint-plugin-cypress": "^6.1.0",
+    "eslint-plugin-prettier": "^5.5.5",
+    "eslint-plugin-react": "^7.37.5",
+    "eslint-plugin-react-hooks": "^7.0.1",
+    "globals": "^17.4.0",
     "i18next": "^23.11.5",
     "i18next-parser": "^9.4.0",
     "mocha": "^10.2.0",
@@ -54,7 +54,7 @@
     "mochawesome": "^7.1.4",
     "mochawesome-merge": "^4.3.0",
     "pluralize": "^8.0.0",
-    "prettier": "^2.7.1",
+    "prettier": "^3.8.1",
     "prettier-stylelint": "^0.4.2",
     "react": "^17.0.1",
     "react-dom": "^17.0.1",
@@ -63,11 +63,12 @@
     "react-router-dom": "5.3.x",
     "react-router-dom-v5-compat": "^6.11.2",
     "style-loader": "^4.0.0",
-    "stylelint": "^16.25.0",
-    "stylelint-config-standard": "^39.0.1",
+    "stylelint": "^17.4.0",
+    "stylelint-config-standard": "^40.0.0",
     "ts-loader": "^9.5.4",
     "ts-node": "^10.9.2",
     "typescript": "^5.9.3",
+    "typescript-eslint": "^8.56.1",
     "webpack": "^5.100.0",
     "webpack-cli": "^6.0.1",
     "webpack-dev-server": "^5.2.3"

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 404 - 268
yarn.lock


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است