8000 pre-pf5 cleanup by himdel · Pull Request #4863 · ansible/ansible-hub-ui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

pre-pf5 cleanup #4863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 43 commits into from
Feb 19, 2024
Merged

pre-pf5 cleanup #4863

merged 43 commits into from
Feb 19, 2024

Conversation

himdel
Copy link
Collaborator
@himdel himdel commented Feb 19, 2024

Rebasing various cleanups from the previous pf5 attempt.. (#4141, #2095)

  • consistently use static contextType
  • drop NAMESPACE_TERM - use mode
  • drop DEPLOYMENT_MODE - use IS_INSIGHTS/IS_COMMUNITY
  • drop EE *WithNamespace routes - use an optional namespace? route param
  • drop EE withContainerParamFix - use a containerName function
  • translateLockedRole - move constrant to function, avoid msg
  • translateTask - move to utilities, clean up names
  • clean up a bunch of single-use constants
  • remove prop={true} and prop={false} in favor of prop or nothing, unless the prop defaults to true
  • replace React.Fragment with short form or imported component
  • replace React.(anything) with just (anything), imported from react
  • replace FC -> FunctionComponent
  • replace useContext -> useHubContext
  • don't props.context

@himdel himdel added the cleanup Dead code removal, etc label Feb 19, 2024
@github-actions github-actions bot added backport-4.7 This PR should be backported to stable-4.7 (2.4) backport-4.9 This PR should be backported to stable-4.9 (2.4) labels Feb 19, 2024
@himdel himdel removed backport-4.7 This PR should be backported to stable-4.7 (2.4) backport-4.9 This PR should be backported to stable-4.9 (2.4) labels Feb 19, 2024
    perl -i -npe 's/^\s*(\w+):\s*\1,$/$1,/' {test,src}/**/*.*
    perl -i -npe 's/=\{true\}//g' src/**/*.*
    perl -i -npe 's/(\w+)=\{false\}//g' src/**/*.*

except:

DataListCell isFilled defaults to true
StatefulDropdown isPlain defaults to true
Modal showClose defaults true

No-Issue
    perl -i -npe 's/extends React.Component/extends Component/' src/**/*.*
    grep '^import React\b' `git st | sed 1d | col2` | cut -d: -f1 | while read foo; do
        sed -i 's/import React /import React, {} /' "$foo"
    done
    sed -i 's/import React, {/& Component,/' `git st | sed 1d | col2`
    npm run prettier
    perl -i -npe 's/\bReact\.ReactNode\b/ReactNode/g' src/**/*.*
    sed -i 's/import React /import React, {} /' `git st | sed 1d | col2`
    sed -i 's/import React, {/& ReactNode,/' `git st | sed 1d | col2`
    npm run prettier

(and a manual fixup for double `ReactNode` in `src/components/render-plugin-doc/render-plugin-doc.tsx`)
    perl -i -npe 's/\bReact\.FC\b/FunctionComponent/g' src/**/*.*
    perl -i -npe 's/\bReact\.FunctionComponent\b/FunctionComponent/g' src/**/*.*
    sed -i 's/import React /import React, {} /' `git st | sed 1d | col2`
    sed -i 's/import React, {/& FunctionComponent,/' `git st | sed 1d | col2`
    npm run prettier

and a manual fixup in src/components/signing/signature-badge.tsx
    perl -i -npe 's/\bReact\.ReactElement\b/ReactElement/g' src/**/*.*
    sed -i 's/import React /import React, {} /' `git st | sed 1d | col2`
    sed -i 's/import React, {/& ReactElement,/' `git st | sed 1d | col2`
    npm run prettier
    perl -i -pe 's/useContext/useHubContext/g' src/**/*.*

and a manual fixup in `src/loaders/app-context.ts`
    for x in Ref createRef FormEvent MouseEvent useState RefObject ReactFragment HTMLProps CSSProperties HTMLAttributes Children ; do
        perl -i -npe 's/\bReact\.'$x'\b/'$x'/g' src/**/*.*
        sed -i 's/import React /import React, {} /' `git st | sed 1d | col2`
        sed -i 's/import React, {/& '$x',/' `git st | sed 1d | col2`
        npm run prettier
        git commit -a -m 'TODO '$x
    done
@himdel himdel merged commit 5e9302e into ansible:master Feb 19, 2024
@himdel himdel deleted the revive branch February 19, 2024 22:13
This was referenced Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Dead code removal, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0