diff --git a/.eslintrc b/.eslintrc index 4fb1f48d237..46353933711 100644 --- a/.eslintrc +++ b/.eslintrc @@ -34,6 +34,7 @@ ], "newlines-between": "always" }], + "no-nested-ternary": "off", "prettier/prettier": "error", "react/react-in-jsx-scope": 0, "react/function-component-definition": [1, { diff --git a/package-lock.json b/package-lock.json index 53a6b61ad23..578227578cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,6 @@ "@asyncapi/avro-schema-parser": "^1.1.0", "@asyncapi/openapi-schema-parser": "^2.0.3", "@asyncapi/parser": "^1.18.1", - "@asyncapi/protobuf-schema-parser": "^1.0.0", "@asyncapi/react-component": "=1.0.0-next.48", "@babel/runtime": "^7.23.2", "@braintree/sanitize-url": "^6.0.3", @@ -82,7 +81,7 @@ "jest-canvas-mock": "^2.5.2", "jest-watch-typeahead": "^2.2.2", "lint-staged": "^15.0.2", - "prettier": "^3.0.3", + "prettier": "^3.1.0", "react-scripts": "file:./create-react-app/packages/react-scripts", "rimraf": "^5.0.5", "sass": "^1.69.5", @@ -22929,9 +22928,9 @@ } }, "node_modules/prettier": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", - "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz", + "integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" diff --git a/package.json b/package.json index 87545a265f7..3ace746660e 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "jest-canvas-mock": "^2.5.2", "jest-watch-typeahead": "^2.2.2", "lint-staged": "^15.0.2", - "prettier": "^3.0.3", + "prettier": "^3.1.0", "react-scripts": "file:./create-react-app/packages/react-scripts", "rimraf": "^5.0.5", "sass": "^1.69.5", diff --git a/src/plugins/editor-content-type/selectors.js b/src/plugins/editor-content-type/selectors.js index 84e581338da..84539d64929 100644 --- a/src/plugins/editor-content-type/selectors.js +++ b/src/plugins/editor-content-type/selectors.js @@ -91,17 +91,15 @@ export const selectInferFileNameFromContent = createSelector( selectIsContentTypeOpenAPI31x, selectIsContentTypeAsyncAPI2, (isOpenAPI20, isOpenAPI30x, isOpenAPI31x, isAsyncAPI2) => { - /* eslint-disable no-nested-ternary */ return isOpenAPI20 ? 'openapi2' : isOpenAPI30x - ? 'openapi3_0' - : isOpenAPI31x - ? 'openapi3_1' - : isAsyncAPI2 - ? 'asyncapi2' - : 'definition'; - /* eslint-enable */ + ? 'openapi3_0' + : isOpenAPI31x + ? 'openapi3_1' + : isAsyncAPI2 + ? 'asyncapi2' + : 'definition'; } ); diff --git a/src/plugins/editor-monaco-language-apidom/language/actions/dereference.js b/src/plugins/editor-monaco-language-apidom/language/actions/dereference.js index 86f5e86377b..861ebb6fdf1 100644 --- a/src/plugins/editor-monaco-language-apidom/language/actions/dereference.js +++ b/src/plugins/editor-monaco-language-apidom/language/actions/dereference.js @@ -16,7 +16,7 @@ const createDereferenceActionDescriptor = ({ getSystem }) => ({ const worker = await getWorker()(model.uri); const dereferenced = await worker.doDeref(model.uri.toString(), { baseURI: globalThis.document.baseURI || globalThis.location.href, - format: isContentJSON ? 0 : isContentYAML ? 1 : 'unknown', // eslint-disable-line no-nested-ternary + format: isContentJSON ? 0 : isContentYAML ? 1 : 'unknown', }); if (isContentYAML) { diff --git a/src/plugins/editor-preview-asyncapi/components/EditorPreviewAsyncAPI/EditorPreviewAsyncAPI.jsx b/src/plugins/editor-preview-asyncapi/components/EditorPreviewAsyncAPI/EditorPreviewAsyncAPI.jsx index 9082b4990e6..15e815298c3 100644 --- a/src/plugins/editor-preview-asyncapi/components/EditorPreviewAsyncAPI/EditorPreviewAsyncAPI.jsx +++ b/src/plugins/editor-preview-asyncapi/components/EditorPreviewAsyncAPI/EditorPreviewAsyncAPI.jsx @@ -1,8 +1,8 @@ import React, { Suspense, useEffect } from 'react'; import PropTypes from 'prop-types'; -const AsyncApiReactComponent = React.lazy(() => - import('@asyncapi/react-component/lib/esm/without-parser.js') +const AsyncApiReactComponent = React.lazy( + () => import('@asyncapi/react-component/lib/esm/without-parser.js') ); const Loading = () =>
Loading...
; diff --git a/src/plugins/top-bar/actions/convert-openapi-20-to-openapi-30x.js b/src/plugins/top-bar/actions/convert-openapi-20-to-openapi-30x.js index 2eca379b2c4..484bf798ef8 100644 --- a/src/plugins/top-bar/actions/convert-openapi-20-to-openapi-30x.js +++ b/src/plugins/top-bar/actions/convert-openapi-20-to-openapi-30x.js @@ -35,15 +35,13 @@ export const convertOpenAPI20ToOpenAPI30xSuccess = ({ }); export const convertOpenAPI20ToOpenAPI30xFailure = ({ error, openAPI2Content, requestId }) => { - /* eslint-disable no-nested-ternary */ const errorMessage = error.response ? 'The request was made and the server responded with a status code that falls out of the range of 2xx' : error.request - ? 'The request was made but no response was received' - : error.message - ? error.message - : 'Unknown error occurred'; - /* eslint-enable */ + ? 'The request was made but no response was received' + : error.message + ? error.message + : 'Unknown error occurred'; return { type: EDITOR_CONVERT_OPENAPI_2_TO_OPENAPI_30X_FAILURE, diff --git a/src/plugins/top-bar/actions/fetch-openapi2-generator-client-list.js b/src/plugins/top-bar/actions/fetch-openapi2-generator-client-list.js index 074c77d4322..a938d3f22a6 100644 --- a/src/plugins/top-bar/actions/fetch-openapi2-generator-client-list.js +++ b/src/plugins/top-bar/actions/fetch-openapi2-generator-client-list.js @@ -31,15 +31,13 @@ export const fetchOpenAPI2GeneratorClientListSuccess = ({ clientList, url, reque }); export const fetchOpenAPI2GeneratorClientListFailure = ({ error, url, requestId }) => { - /* eslint-disable no-nested-ternary */ const errorMessage = error.response ? 'The request was made and the server responded with a status code that falls out of the range of 2xx' : error.request - ? 'The request was made but no response was received' - : error.message - ? error.message - : 'Unknown error occurred'; - /* eslint-enable */ + ? 'The request was made but no response was received' + : error.message + ? error.message + : 'Unknown error occurred'; return { type: EDITOR_TOP_BAR_FETCH_OPENAPI2_GENERATOR_CLIENT_LIST_FAILURE, diff --git a/src/plugins/top-bar/actions/fetch-openapi2-generator-server-list.js b/src/plugins/top-bar/actions/fetch-openapi2-generator-server-list.js index 81044bb6724..668c1b303a0 100644 --- a/src/plugins/top-bar/actions/fetch-openapi2-generator-server-list.js +++ b/src/plugins/top-bar/actions/fetch-openapi2-generator-server-list.js @@ -31,15 +31,13 @@ export const fetchOpenAPI2GeneratorServerListSuccess = ({ serverList, url, reque }); export const fetchOpenAPI2GeneratorServerListFailure = ({ error, url, requestId }) => { - /* eslint-disable no-nested-ternary */ const errorMessage = error.response ? 'The request was made and the server responded with a status code that falls out of the range of 2xx' : error.request - ? 'The request was made but no response was received' - : error.message - ? error.message - : 'Unknown error occurred'; - /* eslint-enable */ + ? 'The request was made but no response was received' + : error.message + ? error.message + : 'Unknown error occurred'; return { type: EDITOR_TOP_BAR_FETCH_OPENAPI2_GENERATOR_SERVER_LIST_FAILURE, diff --git a/src/plugins/top-bar/actions/fetch-openapi3-generator-client-list.js b/src/plugins/top-bar/actions/fetch-openapi3-generator-client-list.js index 93e4b2384f4..007195cab33 100644 --- a/src/plugins/top-bar/actions/fetch-openapi3-generator-client-list.js +++ b/src/plugins/top-bar/actions/fetch-openapi3-generator-client-list.js @@ -31,15 +31,13 @@ export const fetchOpenAPI3GeneratorClientListSuccess = ({ clientList, url, reque }); export const fetchOpenAPI3GeneratorClientListFailure = ({ error, url, requestId }) => { - /* eslint-disable no-nested-ternary */ const errorMessage = error.response ? 'The request was made and the server responded with a status code that falls out of the range of 2xx' : error.request - ? 'The request was made but no response was received' - : error.message - ? error.message - : 'Unknown error occurred'; - /* eslint-enable */ + ? 'The request was made but no response was received' + : error.message + ? error.message + : 'Unknown error occurred'; return { type: EDITOR_TOP_BAR_FETCH_OPENAPI3_GENERATOR_CLIENT_LIST_FAILURE, diff --git a/src/plugins/top-bar/actions/fetch-openapi3-generator-server-list.js b/src/plugins/top-bar/actions/fetch-openapi3-generator-server-list.js index b869bdc8c0b..d13a6a5fdb4 100644 --- a/src/plugins/top-bar/actions/fetch-openapi3-generator-server-list.js +++ b/src/plugins/top-bar/actions/fetch-openapi3-generator-server-list.js @@ -31,15 +31,13 @@ export const fetchOpenAPI3GeneratorServerListSuccess = ({ serverList, url, reque }); export const fetchOpenAPI3GeneratorServerListFailure = ({ error, url, requestId }) => { - /* eslint-disable no-nested-ternary */ const errorMessage = error.response ? 'The request was made and the server responded with a status code that falls out of the range of 2xx' : error.request - ? 'The request was made but no response was received' - : error.message - ? error.message - : 'Unknown error occurred'; - /* eslint-enable */ + ? 'The request was made but no response was received' + : error.message + ? error.message + : 'Unknown error occurred'; return { type: EDITOR_TOP_BAR_FETCH_OPENAPI3_GENERATOR_SERVER_LIST_FAILURE, diff --git a/src/plugins/top-bar/actions/generate-client-code-from-openapi-20.js b/src/plugins/top-bar/actions/generate-client-code-from-openapi-20.js index 23dbe44de7c..2e3e32f2e10 100644 --- a/src/plugins/top-bar/actions/generate-client-code-from-openapi-20.js +++ b/src/plugins/top-bar/actions/generate-client-code-from-openapi-20.js @@ -40,15 +40,13 @@ export const generateClientCodeFromOpenAPI20Success = ({ }); export const generateClientCodeFromOpenAPI20Failure = ({ error, content, language, requestId }) => { - /* eslint-disable no-nested-ternary */ const errorMessage = error.response ? 'The request was made and the server responded with a status code that falls out of the range of 2xx' : error.request - ? 'The request was made but no response was received' - : error.message - ? error.message - : 'Unknown error occurred'; - /* eslint-enable */ + ? 'The request was made but no response was received' + : error.message + ? error.message + : 'Unknown error occurred'; return { type: EDITOR_TOP_BAR_GENERATE_CLIENT_CODE_FROM_OPENAPI20_FAILURE, diff --git a/src/plugins/top-bar/actions/generate-client-code-from-openapi-3.js b/src/plugins/top-bar/actions/generate-client-code-from-openapi-3.js index 739c74550d8..bdd94c4b8e6 100644 --- a/src/plugins/top-bar/actions/generate-client-code-from-openapi-3.js +++ b/src/plugins/top-bar/actions/generate-client-code-from-openapi-3.js @@ -40,15 +40,13 @@ export const generateClientCodeFromOpenAPI3Success = ({ }); export const generateClientCodeFromOpenAPI3Failure = ({ error, content, language, requestId }) => { - /* eslint-disable no-nested-ternary */ const errorMessage = error.response ? 'The request was made and the server responded with a status code that falls out of the range of 2xx' : error.request - ? 'The request was made but no response was received' - : error.message - ? error.message - : 'Unknown error occurred'; - /* eslint-enable */ + ? 'The request was made but no response was received' + : error.message + ? error.message + : 'Unknown error occurred'; return { type: EDITOR_TOP_BAR_GENERATE_CLIENT_CODE_FROM_OPENAPI3_FAILURE, diff --git a/src/plugins/top-bar/actions/generate-server-code-from-openapi-20.js b/src/plugins/top-bar/actions/generate-server-code-from-openapi-20.js index bf43fd505e0..aa7641e7dd7 100644 --- a/src/plugins/top-bar/actions/generate-server-code-from-openapi-20.js +++ b/src/plugins/top-bar/actions/generate-server-code-from-openapi-20.js @@ -45,15 +45,13 @@ export const generateServerCodeFromOpenAPI20Failure = ({ framework, requestId, }) => { - /* eslint-disable no-nested-ternary */ const errorMessage = error.response ? 'The request was made and the server responded with a status code that falls out of the range of 2xx' : error.request - ? 'The request was made but no response was received' - : error.message - ? error.message - : 'Unknown error occurred'; - /* eslint-enable */ + ? 'The request was made but no response was received' + : error.message + ? error.message + : 'Unknown error occurred'; return { type: EDITOR_TOP_BAR_GENERATE_SERVER_CODE_FROM_OPENAPI20_FAILURE, diff --git a/src/plugins/top-bar/actions/generate-server-code-from-openapi-3.js b/src/plugins/top-bar/actions/generate-server-code-from-openapi-3.js index 44bbd384ac7..9379ae53f2d 100644 --- a/src/plugins/top-bar/actions/generate-server-code-from-openapi-3.js +++ b/src/plugins/top-bar/actions/generate-server-code-from-openapi-3.js @@ -40,15 +40,13 @@ export const generateServerCodeFromOpenAPI3Success = ({ }); export const generateServerCodeFromOpenAPI3Failure = ({ error, content, framework, requestId }) => { - /* eslint-disable no-nested-ternary */ const errorMessage = error.response ? 'The request was made and the server responded with a status code that falls out of the range of 2xx' : error.request - ? 'The request was made but no response was received' - : error.message - ? error.message - : 'Unknown error occurred'; - /* eslint-enable */ + ? 'The request was made but no response was received' + : error.message + ? error.message + : 'Unknown error occurred'; return { type: EDITOR_TOP_BAR_GENERATE_SERVER_CODE_FROM_OPENAPI3_FAILURE, diff --git a/src/plugins/top-bar/actions/import-url.js b/src/plugins/top-bar/actions/import-url.js index 84873d7aea5..9e08b6f2a96 100644 --- a/src/plugins/top-bar/actions/import-url.js +++ b/src/plugins/top-bar/actions/import-url.js @@ -29,15 +29,13 @@ export const importUrlSuccess = ({ definition, requestId }) => ({ }); export const importUrlFailure = ({ error, url, requestId }) => { - /* eslint-disable no-nested-ternary */ const errorMessage = error.response ? 'The request was made and the server responded with a status code that falls out of the range of 2xx' : error.request - ? 'The request was made but no response was received' - : error.message - ? error.message - : 'Unknown error occurred'; - /* eslint-enable */ + ? 'The request was made but no response was received' + : error.message + ? error.message + : 'Unknown error occurred'; return { type: EDITOR_IMPORT_URL_FAILURE, diff --git a/src/plugins/top-bar/components/FileMenu/items/SaveAsMenuItem.jsx b/src/plugins/top-bar/components/FileMenu/items/SaveAsMenuItem.jsx index e11b76b9dbb..3878b6e7de0 100644 --- a/src/plugins/top-bar/components/FileMenu/items/SaveAsMenuItem.jsx +++ b/src/plugins/top-bar/components/FileMenu/items/SaveAsMenuItem.jsx @@ -2,12 +2,11 @@ import PropTypes from 'prop-types'; const SaveAsMenuItem = ({ getComponent, editorSelectors, onClick, children }) => { const DropdownMenuItem = getComponent('DropdownMenuItem'); - // eslint-disable-next-line no-nested-ternary const itemName = editorSelectors.selectIsContentFormatJSON() ? 'Save (as JSON)' : editorSelectors.selectIsContentFormatYAML() - ? 'Save (as YAML)' - : 'Save'; + ? 'Save (as YAML)' + : 'Save'; return {children || itemName}; };