Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"plugins": ["import", "eslint-plugin-tsdoc", "prettier"],
"extends": [
"react-app",
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"env": {
"jest": true
},
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
// Enforce consistent brace style for all control statements for readability
"curly": "error",
"import/no-anonymous-default-export": "off"
},
"globals": {
"cy": true,
"before": true,
"context": true,
"Cypress": true,
"assert": true
}
}
75 changes: 75 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Lint Check

on:
push:
branches: ["**"]
pull_request:
branches:
- nightly
- production

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
timeout-minutes: 15
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20

- name: Install Linting Libraries
# Installs packages directly into node_modules without requiring package.json
run: >
npm install --no-save
eslint@8 eslint-plugin-diff
prettier eslint-plugin-prettier eslint-config-prettier
eslint-config-react-app eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-a11y eslint-plugin-import
@typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-tsdoc
@babel/core @babel/eslint-parser
eslint-plugin-jest eslint-plugin-testing-library eslint-plugin-flowtype

- name: Deduplicate TypeScript Plugin
# Forces ESLint to only use the root-level plugin by deleting the nested one
run: rm -rf node_modules/eslint-config-react-app/node_modules/@typescript-eslint

- name: Run ESLint strictly on Changed Lines (Blocking)
run: |
# 1. Create a temporary config that inherits your copied base config
# but applies the 'diff/ci' mode to filter output to changed lines only
echo '{ "extends": ["./.eslintrc.json", "plugin:diff/ci"] }' > .eslintrc.diff.json

# 2. Determine the target commit for the git diff comparison
if [ "${{ github.event_name }}" = "pull_request" ]; then
export ESLINT_PLUGIN_DIFF_COMMIT="${{ github.event.pull_request.base.sha }}"
else
BEFORE_COMMIT="${{ github.event.before }}"

if [ "$BEFORE_COMMIT" = "0000000000000000000000000000000000000000" ]; then
# Pushing a brand new branch
export ESLINT_PLUGIN_DIFF_COMMIT="HEAD~1"
else
# Verify if the 'before' commit actually exists in the local checkout
if git rev-parse --verify --quiet "$BEFORE_COMMIT" > /dev/null; then
export ESLINT_PLUGIN_DIFF_COMMIT="$BEFORE_COMMIT"
else
# Fallback for force pushes or rebases where the old commit is gone
echo "Warning: Commit $BEFORE_COMMIT not found locally. Falling back to HEAD~1"
export ESLINT_PLUGIN_DIFF_COMMIT="HEAD~1"
fi
fi
fi

# 3. Execute ESLint across the codebase using the temporary diff config via npx
npx eslint --max-warnings=0 --config .eslintrc.diff.json --ext .js,.jsx,.ts,.tsx .
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,20 @@
}
);
}

function Calculate_Total( items:any[],tax ) {

Check failure on line 91 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type

Check failure on line 91 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `·items:any[],tax·` with `items:·any[],·tax`

Check failure on line 91 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

'Calculate_Total' is defined but never used

Check failure on line 91 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type

Check failure on line 91 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `·items:any[],tax·` with `items:·any[],·tax`

Check failure on line 91 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

'Calculate_Total' is defined but never used
var Total = 0;

Check failure on line 92 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected var, use let or const instead

Check failure on line 92 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected var, use let or const instead

Check failure on line 93 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `··`

Check failure on line 93 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `··`
for (let i = 0; i < items.length; i++) {
let Item = items[i];

Check failure on line 95 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

'Item' is never reassigned. Use 'const' instead

Check failure on line 95 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

'Item' is never reassigned. Use 'const' instead
var price = Item.price;

Check failure on line 96 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected var, use let or const instead

Check failure on line 96 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected var, use let or const instead
Total = Total + price;
}

if (tax == null) {
let tax = 0.05;

Check failure on line 101 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

'tax' is never reassigned. Use 'const' instead

Check failure on line 101 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

'tax' is assigned a value but never used

Check failure on line 101 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

'tax' is never reassigned. Use 'const' instead

Check failure on line 101 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

'tax' is assigned a value but never used
}

return Total * (1 + tax)

Check failure on line 104 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `;`

Check failure on line 104 in extensions/ohif-gradienthealth-extension/src/utils/addAutoSegmentationSavingHandler.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `;`
}

Loading