Skip to content
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

Integrate Knip #7847

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from
Open

Integrate Knip #7847

wants to merge 22 commits into from

Conversation

jamil314
Copy link
Collaborator

No description provided.

Copy link

Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:

  • Changelog is read by country implementors who might not always be familiar with all technical details of OpenCRVS. Keep language high-level, user friendly and avoid technical references to internals.
  • Answer "What's new?", "Why was the change made?" and "Why should I care?" for each change.
  • If it's a breaking change, include a migration guide answering "What do I need to do to upgrade?".

.github/workflows/lint-and-test.yml Outdated Show resolved Hide resolved
.github/workflows/lint-and-test.yml Outdated Show resolved Hide resolved
knip-reporter.ts Outdated
@@ -0,0 +1,18 @@
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this custom reporter? If yes, maybe we could create the file in the pipeline especially given that it would be added to the root of the repository

knip.ts Outdated
*/
import type { KnipConfig } from 'knip'

const config: KnipConfig = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you supply these options for the knip command inline so we wouldn't need to add a new file to the root of the project? I'm trying to avoid that as for newcomers these files can feel a bit daunting

package.json Outdated Show resolved Hide resolved
Comment on lines 151 to 152
- name: Create reporter
run: echo "const reporter = function (options) {const totalIssues = Object.values(options.issues).reduce((acc, issueRecords) =>acc +Object.values(issueRecords).reduce((acc2, issuesInFile) => acc2 + Object.keys(issuesInFile).length,0),0); console.log(JSON.stringify({ totalIssues }))}; export default reporter" > knip-reporter.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Create reporter
run: echo "const reporter = function (options) {const totalIssues = Object.values(options.issues).reduce((acc, issueRecords) =>acc +Object.values(issueRecords).reduce((acc2, issuesInFile) => acc2 + Object.keys(issuesInFile).length,0),0); console.log(JSON.stringify({ totalIssues }))}; export default reporter" > knip-reporter.js
- name: Create reporter
run: |
cat << 'EOF' > knip-reporter.js
const reporter = function (options) {
const totalIssues = Object.values(options.issues).reduce(
(acc, issueRecords) =>
acc + Object.values(issueRecords).reduce(
(acc2, issuesInFile) => acc2 + Object.keys(issuesInFile).length,
0
),
0
);
console.log(JSON.stringify({ totalIssues }));
};
export default reporter;
EOF

You might be able to do it like this as well

Comment on lines +204 to +215
security-scans:
needs: setup
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner in fs mode
uses: aquasecurity/[email protected]
with:
scan-type: 'fs'
scan-ref: '.'
trivy-config: trivy.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
security-scans:
needs: setup
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner in fs mode
uses: aquasecurity/[email protected]
with:
scan-type: 'fs'
scan-ref: '.'
trivy-config: trivy.yaml

@@ -41,11 +41,13 @@
},
"devDependencies": {
"@types/dotenv": "^6.1.0",
"@types/node": "^22.7.9",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"@types/node": "^22.7.9",

"concurrently": "^8.0.0",
"husky": "^9.1.6",
"lerna": "^8.0.0",
"lint-staged": "^15.2.10",
"prettier": "2.8.8"
"prettier": "2.8.8",
"typescript": "^5.6.3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"typescript": "^5.6.3"

@@ -27,13 +27,6 @@ export const getSystemRolesQuery = gql`
}
`

export const updateRoleQuery = gql`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run graphql type generator

@@ -35,56 +23,3 @@ const QueryMapper = {
export const getQueryMapping = (event: Event, action: Action) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving these somewhere else as well if the component is not used anymore (this being a file for the component originally)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants